Skip to content

Commit a63cc63

Browse files
smurfixdpgeorge
authored andcommitted
esp32/mphalport: Actually read from dupterm in mp_hal_stdin_rx_chr().
The esp32 port (and esp8266) doesn't read from dupterm in `mp_hal_stdin_rx_chr()` is because it uses `os.dupterm_notify()` instead, which forces a read of the dupterm sources from Python. That function should be called when it's known that there is input to read. Nevertheless, this commit adds code to explicitly poll dupterm in `mp_hal_stdin_rx_chr()`, following other ports like rp2. Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
1 parent ed7bfcb commit a63cc63

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ports/esp32/mphalport.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ int mp_hal_stdin_rx_chr(void) {
138138
if (c != -1) {
139139
return c;
140140
}
141+
#if MICROPY_PY_OS_DUPTERM
142+
int dupterm_c = mp_os_dupterm_rx_chr();
143+
if (dupterm_c >= 0) {
144+
return dupterm_c;
145+
}
146+
#endif
141147
MICROPY_EVENT_POLL_HOOK
142148
}
143149
}

0 commit comments

Comments
 (0)