1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/ztimer/periodic: always set timer->last, no ztimer_now on last call

This commit is contained in:
Francisco Molina 2021-11-25 19:10:05 +01:00
parent 7d084a43ff
commit b65ab31971

View File

@ -43,11 +43,14 @@ static void _ztimer_periodic_reset(ztimer_periodic_t *timer, ztimer_now_t now)
static void _ztimer_periodic_callback(void *arg)
{
ztimer_periodic_t *timer = arg;
ztimer_now_t now = ztimer_now(timer->clock);
if (timer->callback(timer->arg) == ZTIMER_PERIODIC_KEEP_GOING) {
ztimer_now_t now = ztimer_now(timer->clock);
_ztimer_periodic_reset(timer, now);
}
else {
timer->last = timer->last + timer->interval;
}
}
void ztimer_periodic_init(ztimer_clock_t *clock, ztimer_periodic_t *timer,