Skip to content
Snippets Groups Projects
Commit 34e224a4 authored by Damien George's avatar Damien George
Browse files

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.
parent bdc875e6
No related branches found
No related tags found
No related merge requests found
...@@ -297,7 +297,7 @@ STATIC mp_uint_t machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t siz ...@@ -297,7 +297,7 @@ STATIC mp_uint_t machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t siz
int bytes_read = uart_read_bytes(self->uart_num, buf_in, size, time_to_wait); int bytes_read = uart_read_bytes(self->uart_num, buf_in, size, time_to_wait);
if (bytes_read < 0) { if (bytes_read <= 0) {
*errcode = MP_EAGAIN; *errcode = MP_EAGAIN;
return MP_STREAM_ERROR; return MP_STREAM_ERROR;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment