summaryrefslogtreecommitdiff
path: root/extmod/utime_mphal.c
diff options
context:
space:
mode:
authorJosh Lloyd <j.nevercast@gmail.com>2019-11-20 17:21:35 +1300
committerDamien George <damien@micropython.org>2021-07-22 00:05:17 +1000
commitdb6d60b07967f6d75d74349b021b262cb8fee628 (patch)
tree1a70c2abe2d7b6ad74e80d7a8aa9a9f946d2e441 /extmod/utime_mphal.c
parent6a9133a8b5fc2c19635ae0260569837aaaad2b37 (diff)
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.
Diffstat (limited to 'extmod/utime_mphal.c')
-rw-r--r--extmod/utime_mphal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/utime_mphal.c b/extmod/utime_mphal.c
index d053cf128..3d1cdfd82 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;