Skip to content

Commit

Permalink
Adds an error message to HardwareSerial::setPins() (#7040)
Browse files Browse the repository at this point in the history
* Adds an error message to HardwareSerial::setPins() 
In order to avoid problems if the user tries to setPins() before initializing the Serial port with begin()
  • Loading branch information
SuGlider committed Jul 26, 2022
1 parent 03e2ad9 commit c996036
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cores/esp32/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ void HardwareSerial::setRxInvert(bool invert)
// negative Pin value will keep it unmodified
void HardwareSerial::setPins(int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
{
if(_uart == NULL) {
log_e("setPins() shall be called after begin() - nothing done");
return;
}
uartSetPins(_uart, rxPin, txPin, ctsPin, rtsPin);
}

Expand Down

0 comments on commit c996036

Please sign in to comment.