Browse Source

esp32/machine_uart: Fix check of UART id so it only allows valid UARTs.

pull/3572/merge
Damien George 7 years ago
parent
commit
23f9f9495f
  1. 2
      ports/esp32/machine_uart.c

2
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));
}

Loading…
Cancel
Save