Skip to content

Commit f39bcb3

Browse files
committed
esp8266/modmachine: Changing params of a timer requires disarming it first.
1 parent 7193086 commit f39bcb3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

esp8266/modmachine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ STATIC mp_obj_t esp_timer_init_helper(esp_timer_obj_t *self, mp_uint_t n_args, c
7575
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
7676

7777
self->callback = args[2].u_obj;
78+
// Be sure to disarm timer before making any changes
79+
os_timer_disarm(&self->timer);
7880
os_timer_setfn(&self->timer, esp_timer_cb, self);
7981
os_timer_arm(&self->timer, args[0].u_int, args[1].u_int);
8082

0 commit comments

Comments
 (0)