From 38e7b72b952b0f23007e09caf92820846bca6b7b Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 18 Sep 2023 16:48:23 +0200 Subject: [PATCH] timer lag --- stm32f1xx_hal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stm32f1xx_hal.c b/stm32f1xx_hal.c index 683c76e..af71b1d 100644 --- a/stm32f1xx_hal.c +++ b/stm32f1xx_hal.c @@ -45,9 +45,9 @@ static void* tim_handler(void* arg){ unsigned int nb_exec = time * 1000 / delay_ps; int backlog = nb_exec - exec_counter; + if(backlog > 10) + printf("timer simulation lagging behind (%d ticks)\n", backlog); while(backlog > 0){ - if(backlog > 10) - printf("timer simulation lagging behind (%d ticks)\n", backlog); HAL_TIM_PeriodElapsedCallback(htim); exec_counter++; backlog = nb_exec - exec_counter;