extmod/utime: Always invoke mp_hal_delay_ms when >= to 0ms.

This makes sleep_ms(0) useful as a "yield" so event processing and thread
switching can take place.

Fixes issue #5345.
pull/7554/head
Josh Lloyd 2019-11-20 17:21:35 +13:00 zatwierdzone przez Damien George
rodzic 6a9133a8b5
commit db6d60b079
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -48,7 +48,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_utime_sleep_obj, time_sleep);
STATIC mp_obj_t time_sleep_ms(mp_obj_t arg) {
mp_int_t ms = mp_obj_get_int(arg);
if (ms > 0) {
if (ms >= 0) {
mp_hal_delay_ms(ms);
}
return mp_const_none;