windows/windows_mphal: Fix mp_hal_delay_ms() so it runs events.

This changed behaviour in c393f5c123 when the
MICROPY_EVENT_POLL_HOOK macro was removed.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2024-01-05 15:56:34 +11:00
parent 0640ff3b97
commit 42eab32a36
1 changed files with 2 additions and 2 deletions

View File

@ -279,10 +279,10 @@ int usleep(__int64 usec) {
#endif #endif
void mp_hal_delay_ms(mp_uint_t ms) { void mp_hal_delay_ms(mp_uint_t ms) {
#ifdef MICROPY_EVENT_POLL_HOOK #if MICROPY_ENABLE_SCHEDULER
mp_uint_t start = mp_hal_ticks_ms(); mp_uint_t start = mp_hal_ticks_ms();
while (mp_hal_ticks_ms() - start < ms) { while (mp_hal_ticks_ms() - start < ms) {
MICROPY_EVENT_POLL_HOOK mp_event_wait_ms(1);
} }
#else #else
msec_sleep((double)ms); msec_sleep((double)ms);