summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-01-31 19:38:32 +1100
committerDamien George <damien.p.george@gmail.com>2018-01-31 19:38:32 +1100
commit23f9f9495f0b64e70470b17ba38cf1f2148724bd (patch)
tree9781b5784d430fc00433d3713320134cdb410984
parentbd257a838f605d4f45eb11edf9f89aa603ef2f33 (diff)
esp32/machine_uart: Fix check of UART id so it only allows valid UARTs.
-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 0b303d424..06d9c0b0d 100644
--- a/ports/esp32/machine_uart.c
+++ b/ports/esp32/machine_uart.c
@@ -187,7 +187,7 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args,
// get uart id
mp_int_t uart_num = mp_obj_get_int(args[0]);
- if (uart_num < 0 || uart_num > UART_NUM_MAX) {
+ if (uart_num < 0 || uart_num >= UART_NUM_MAX) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "UART(%d) does not exist", uart_num));
}