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.
This commit is contained in:
parent
af100b7029
commit
0b26efe73d
@ -328,6 +328,9 @@ STATIC mp_obj_t machine_i2c_scan(mp_obj_t self_in) {
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
mp_obj_list_append(list, MP_OBJ_NEW_SMALL_INT(addr));
|
mp_obj_list_append(list, MP_OBJ_NEW_SMALL_INT(addr));
|
||||||
}
|
}
|
||||||
|
#ifdef MICROPY_EVENT_POLL_HOOK
|
||||||
|
MICROPY_EVENT_POLL_HOOK
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user