提交 171032b7 编写于 作者: C copercini 提交者: Me No Dev

Print an error when serial number is invalid (#691)

* Print error when serial number is invalid

* Move to the first check, change end by return
上级 17a1a240
......@@ -11,6 +11,10 @@ HardwareSerial::HardwareSerial(int uart_nr) : _uart_nr(uart_nr), _uart(NULL) {}
void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin)
{
if(0 > _uart_nr || _uart_nr > 2) {
log_e("Serial number is invalid, please use 0, 1 or 2");
return;
}
if(_uart) {
end();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册