summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Leech <andrew@alelec.net>2024-10-14 05:32:41 +1100
committerDamien George <damien@micropython.org>2024-10-16 14:50:11 +1100
commit3fecab58a0bab6db736d24c0be7e78e04c651cb0 (patch)
tree902680b05ceac44d51016544d5ac2cf2630f8701
parent838f21298ac5a6515d77ce4e4a1b627c8574125f (diff)
esp32/mphalport: Always poll stdin ring-buffer to include UART use.
This fixes a regression introduced in commit 4247921c4ebfced79aa7ccfbb835c9f60ad6f0fc, where this ring-buffer polling was accidentally put inside the `#if MICROPY_HW_ESP_USB_SERIAL_JTAG`. Signed-off-by: Andrew Leech <andrew@alelec.net>
-rw-r--r--ports/esp32/mphalport.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ports/esp32/mphalport.c b/ports/esp32/mphalport.c
index 59ec6d6b1..1cd99f4ae 100644
--- a/ports/esp32/mphalport.c
+++ b/ports/esp32/mphalport.c
@@ -109,12 +109,6 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) {
uintptr_t ret = 0;
#if MICROPY_HW_ESP_USB_SERIAL_JTAG
usb_serial_jtag_poll_rx();
- if ((poll_flags & MP_STREAM_POLL_RD) && ringbuf_peek(&stdin_ringbuf) != -1) {
- ret |= MP_STREAM_POLL_RD;
- }
- if (poll_flags & MP_STREAM_POLL_WR) {
- ret |= MP_STREAM_POLL_WR;
- }
#endif
#if MICROPY_HW_USB_CDC
ret |= mp_usbd_cdc_poll_interfaces(poll_flags);
@@ -122,6 +116,13 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) {
#if MICROPY_PY_OS_DUPTERM
ret |= mp_os_dupterm_poll(poll_flags);
#endif
+ // Check ringbuffer directly for uart and usj.
+ if ((poll_flags & MP_STREAM_POLL_RD) && ringbuf_peek(&stdin_ringbuf) != -1) {
+ ret |= MP_STREAM_POLL_RD;
+ }
+ if (poll_flags & MP_STREAM_POLL_WR) {
+ ret |= MP_STREAM_POLL_WR;
+ }
return ret;
}