Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 171032b

Browse filesBrowse files
copercinime-no-dev
authored andcommitted
Print an error when serial number is invalid (espressif#691)
* Print error when serial number is invalid * Move to the first check, change end by return
1 parent 17a1a24 commit 171032b
Copy full SHA for 171032b

File tree

Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed

‎cores/esp32/HardwareSerial.cpp

Copy file name to clipboardExpand all lines: cores/esp32/HardwareSerial.cpp
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ HardwareSerial::HardwareSerial(int uart_nr) : _uart_nr(uart_nr), _uart(NULL) {}
1111

1212
void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin)
1313
{
14+
if(0 > _uart_nr || _uart_nr > 2) {
15+
log_e("Serial number is invalid, please use 0, 1 or 2");
16+
return;
17+
}
1418
if(_uart) {
1519
end();
1620
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.