Skip to content

Commit

Permalink
esp32/mphalport: Always poll stdin ring-buffer to include UART use.
Browse files Browse the repository at this point in the history
This fixes a regression introduced in commit
4247921, where this ring-buffer polling
was accidentally put inside the `#if MICROPY_HW_ESP_USB_SERIAL_JTAG`.

Signed-off-by: Andrew Leech <[email protected]>
  • Loading branch information
andrewleech authored and dpgeorge committed Oct 16, 2024
1 parent 838f212 commit 3fecab5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ports/esp32/mphalport.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,20 @@ 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);
#endif
#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;
}

Expand Down

0 comments on commit 3fecab5

Please sign in to comment.