From b1c7a3d05f7b7c69fe60279ea9037e130d32e8c3 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 4 Jun 2013 10:58:56 +0200 Subject: [PATCH] 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. --- .../arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp b/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp index 8476deb8a..605c78840 100644 --- a/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp +++ b/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp @@ -178,6 +178,9 @@ inline void SoftwareSerial::tunedDelay(uint16_t delay) { // one and returns true if it replaces another bool SoftwareSerial::listen() { + if (!_rx_delay_stopbit) + return false; + if (active_object != this) { _buffer_overflow = false;