From 6c0488da7465399919870f9338747b498e94ad6f Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Thu, 16 Feb 2023 11:26:36 +0200 Subject: [PATCH] timers: Fix restarting timer from a timer Running xTimerChangePeriod and xTimerStart on the expired timer from a callback function returns successfully, but doesn't actually set the timer. --- sim/timers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/timers.cpp b/sim/timers.cpp index c4d6c54..ded5f21 100644 --- a/sim/timers.cpp +++ b/sim/timers.cpp @@ -6,11 +6,11 @@ uint32_t timer_callback_wrapper(uint32_t interval, void *param) { if (!xTimer->running) { return 0; } + xTimer->running = false; xTimer->pxCallbackFunction(*xTimer); if (xTimer->auto_reload) { return xTimer->timer_period_in_ms; } - xTimer->running = false; return 0; // cancel timer }