mirror of
https://github.com/micropython/micropython.git
synced 2026-01-28 06:40:19 +01:00
unix/unix_mphal: Ensure mp_hal_delay_ms handles pending tasks.
This ensures that zero-duration delays run scheduled callbacks. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
committed by
Damien George
parent
16ccf55fd8
commit
8e3ee303ce
@@ -242,9 +242,13 @@ uint64_t mp_hal_time_ns(void) {
|
||||
|
||||
#ifndef mp_hal_delay_ms
|
||||
void mp_hal_delay_ms(mp_uint_t ms) {
|
||||
mp_uint_t start = mp_hal_ticks_ms();
|
||||
while (mp_hal_ticks_ms() - start < ms) {
|
||||
mp_event_wait_ms(1);
|
||||
if (ms) {
|
||||
mp_uint_t start = mp_hal_ticks_ms();
|
||||
while (mp_hal_ticks_ms() - start < ms) {
|
||||
mp_event_wait_ms(1);
|
||||
}
|
||||
} else {
|
||||
mp_handle_pending(true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user