summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-03-14 13:18:43 +1100
committerDamien George <damien.p.george@gmail.com>2018-03-14 13:18:43 +1100
commit34e224a4afbacbc8f1621c415b6d3fc42ed84cb8 (patch)
treec552e8109f6f4bf80e8bccad592d230487a12591
parentbdc875e602f687bf0fb28c3a18565ffec4157f59 (diff)
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.
-rw-r--r--ports/esp32/machine_uart.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/esp32/machine_uart.c b/ports/esp32/machine_uart.c
index 06d9c0b0d..26cbc88fc 100644
--- a/ports/esp32/machine_uart.c
+++ b/ports/esp32/machine_uart.c
@@ -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);
- if (bytes_read < 0) {
+ if (bytes_read <= 0) {
*errcode = MP_EAGAIN;
return MP_STREAM_ERROR;
}