Skip to content

Commit

Permalink
esp8266/modmachine: Call ets_event_poll after waiti in machine.idle.
Browse files Browse the repository at this point in the history
Because "waiti 0" may have waited for a while (eg 500ms) and the internal
WDT may need to be fed immediately.

Fixes issue #4459.
  • Loading branch information
dpgeorge committed Feb 28, 2019
1 parent 9b2a97a commit 8ce2266
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ports/esp8266/modmachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ STATIC mp_obj_t machine_idle(void) {
uint32_t t = mp_hal_ticks_cpu();
asm("waiti 0");
t = mp_hal_ticks_cpu() - t;
ets_event_poll(); // handle any events after possibly a long wait (eg feed WDT)
return MP_OBJ_NEW_SMALL_INT(t);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);
Expand Down

0 comments on commit 8ce2266

Please sign in to comment.