Skip to content

Commit 9b291b8

Browse files
Let SoftwareSerial::listen() fail on invalid rx baud rates
In this case, SoftwareSerial::begin will not have enabled the interrupts, so better not allow the SoftwareSerial instance to enter the listening state either.
1 parent 4d3ccb4 commit 9b291b8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libraries/SoftwareSerial/SoftwareSerial.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ inline void SoftwareSerial::tunedDelay(uint16_t delay) {
178178
// one and returns true if it replaces another
179179
bool SoftwareSerial::listen()
180180
{
181+
if (!_rx_delay_stopbit)
182+
return false;
183+
181184
if (active_object != this)
182185
{
183186
_buffer_overflow = false;

0 commit comments

Comments
 (0)