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.
This commit is contained in:
Riku Isokoski 2023-02-16 11:26:36 +02:00 committed by NeroBurner
parent 191bb9a59b
commit 6c0488da74

View File

@ -6,11 +6,11 @@ uint32_t timer_callback_wrapper(uint32_t interval, void *param) {
if (!xTimer->running) { if (!xTimer->running) {
return 0; return 0;
} }
xTimer->running = false;
xTimer->pxCallbackFunction(*xTimer); xTimer->pxCallbackFunction(*xTimer);
if (xTimer->auto_reload) { if (xTimer->auto_reload) {
return xTimer->timer_period_in_ms; return xTimer->timer_period_in_ms;
} }
xTimer->running = false;
return 0; // cancel timer return 0; // cancel timer
} }