From db6d60b07967f6d75d74349b021b262cb8fee628 Mon Sep 17 00:00:00 2001 From: Josh Lloyd Date: Wed, 20 Nov 2019 17:21:35 +1300 Subject: [PATCH] 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. --- extmod/utime_mphal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/utime_mphal.c b/extmod/utime_mphal.c index d053cf128b..3d1cdfd820 100644 --- a/extmod/utime_mphal.c +++ b/extmod/utime_mphal.c @@ -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;