aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2024-01-07 17:53:53 +0100
committerDamien George <damien@micropython.org>2024-01-16 08:53:34 +1100
commit07472d05db64a0990b4d47cb001d1a40ba78414f (patch)
treebaa9dc26607ff518f756bd29d5911f6c6f02a38f
parentbd21820b4cc7d3c6c293b2fd104cb8214df686cd (diff)
rp2/machine_uart: Fix event wait in uart.flush() and uart.read().
Do not wait in the worst case up to the timeout. Fixes issue #13377. Signed-off-by: robert-hh <robert@hammelrath.com>
-rw-r--r--ports/rp2/machine_uart.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/rp2/machine_uart.c b/ports/rp2/machine_uart.c
index d751b7af0..bca07cebf 100644
--- a/ports/rp2/machine_uart.c
+++ b/ports/rp2/machine_uart.c
@@ -483,7 +483,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
return i;
}
}
- mp_event_wait_ms(timeout - elapsed);
+ mp_event_handle_nowait();
}
*dest++ = ringbuf_get(&(self->read_buffer));
start = mp_hal_ticks_ms(); // Inter-character timeout
@@ -559,7 +559,7 @@ STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uint
if (now >= timeout) {
break;
}
- mp_event_wait_ms((timeout - now) / 1000);
+ mp_event_handle_nowait();
}
*errcode = MP_ETIMEDOUT;
ret = MP_STREAM_ERROR;