From eadb3741e3a64116d65ba3a62480daef9a4472e0 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 6 Jul 2023 18:39:39 +0200 Subject: [PATCH] ztimer/periodic: remove timer on init if already running --- sys/ztimer/periodic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/ztimer/periodic.c b/sys/ztimer/periodic.c index 5d9d8e9ef91a..ddd82b8d771c 100644 --- a/sys/ztimer/periodic.c +++ b/sys/ztimer/periodic.c @@ -57,6 +57,7 @@ void ztimer_periodic_init(ztimer_clock_t *clock, ztimer_periodic_t *timer, bool (*callback)( void *), void *arg, uint32_t interval) { + ztimer_remove(clock, &timer->timer); *timer = (ztimer_periodic_t){ .clock = clock, .interval = interval, .callback = callback, .arg = arg,