esp8266: Update port to use new event functions.
This is necessary to avoid watchdog timeout in long i2c.scan(), as
previously machine_i2c.c would call MICROPY_EVENT_POLL_HOOK if
MICROPY_EVENT_POLL_HOOK_FAST was not available.
Compared to previous implementation, this implementation removes the
ets_event_poll() function and calls the SDK function ets_loop_iter() from
MICROPY_INTERNAL_EVENT_HOOK instead. This allows using the port-agnostic
functions in more places.
There is a small behaviour change, which is that the event loop gets
iterated in a few more places (i.e. anywhere that mp_event_handle_nowait()
is called). However, this looks like maybe only modselect.c - and is
probably good to process Wi-Fi events in that polling loop.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
diff --git a/ports/esp8266/modespnow.c b/ports/esp8266/modespnow.c
index 9aa5fdf..170e488 100644
--- a/ports/esp8266/modespnow.c
+++ b/ports/esp8266/modespnow.c
@@ -285,7 +285,7 @@
int status = 0;
while (((status = ringbuf_get_bytes(r, data, len)) == -1)
&& (timeout_ms < 0 || (mp_uint_t)(mp_hal_ticks_ms() - start) < (mp_uint_t)timeout_ms)) {
- MICROPY_EVENT_POLL_HOOK;
+ mp_event_wait_ms(1);
}
return status;
}