Skip to content

Commit 34e224a

Browse files
committed
esp32/machine_uart: Return None from UART read if no data is available.
This is instead of returning an empty bytes object, and matches how other ports handle non-blocking UART read behaviour.
1 parent bdc875e commit 34e224a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ports/esp32/machine_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ STATIC mp_uint_t machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t siz
297297

298298
int bytes_read = uart_read_bytes(self->uart_num, buf_in, size, time_to_wait);
299299

300-
if (bytes_read < 0) {
300+
if (bytes_read <= 0) {
301301
*errcode = MP_EAGAIN;
302302
return MP_STREAM_ERROR;
303303
}

0 commit comments

Comments
 (0)