From 12ef8a5ba2558a1dd9209c2b1b843a28fb2b584e Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 14 Nov 2023 16:17:24 +1100 Subject: [PATCH] rp2/mphalport: Optimise exit of mp_hal_delay_ms loop. best_effort_wfe_or_timeout() already calls time_reached() and returns the result of it, so no need to call it again. Signed-off-by: Damien George --- ports/rp2/mphalport.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ports/rp2/mphalport.c b/ports/rp2/mphalport.c index c567a560b1..1fb833f2e5 100644 --- a/ports/rp2/mphalport.c +++ b/ports/rp2/mphalport.c @@ -192,10 +192,9 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { void mp_hal_delay_ms(mp_uint_t ms) { absolute_time_t t = make_timeout_time_ms(ms); - while (!time_reached(t)) { + do { MICROPY_EVENT_POLL_HOOK_FAST; - best_effort_wfe_or_timeout(t); - } + } while (!best_effort_wfe_or_timeout(t)); } void mp_hal_time_ns_set_from_rtc(void) {