extmod/machine_i2c: Call MICROPY_PY_EVENT_HOOK during i2c.scan().

Avoiding a watchdog reset during i2c.scan() if the hardware is not properly
set up (eg on esp8266), and also allowing to stop the scan with a
KeyboardInterrupt.

Fixes issue #8876.
pull/9005/head^2
robert-hh 2022-08-28 18:14:53 +02:00 zatwierdzone przez Damien George
rodzic af100b7029
commit 0b26efe73d
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -328,6 +328,9 @@ STATIC mp_obj_t machine_i2c_scan(mp_obj_t self_in) {
if (ret == 0) {
mp_obj_list_append(list, MP_OBJ_NEW_SMALL_INT(addr));
}
#ifdef MICROPY_EVENT_POLL_HOOK
MICROPY_EVENT_POLL_HOOK
#endif
}
return list;
}