From b837ac8023a71608e57719da5d003247473928bb Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Tue, 22 Dec 2020 09:53:43 +0100 Subject: [PATCH] SoftwareSerial stopListening at the begining When begining the transaction, the active_listener is not yet assigned, but null. Then it differs from this but should not act as if it was listening. This is the case when testing on nucleo_l552ze board. Signed-off-by: Francois Ramu --- libraries/SoftwareSerial/src/SoftwareSerial.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/SoftwareSerial/src/SoftwareSerial.cpp b/libraries/SoftwareSerial/src/SoftwareSerial.cpp index e4a5a7c047..25c7839d01 100644 --- a/libraries/SoftwareSerial/src/SoftwareSerial.cpp +++ b/libraries/SoftwareSerial/src/SoftwareSerial.cpp @@ -148,7 +148,9 @@ bool SoftwareSerial::listen() if (active_listener != this) { // wait for any transmit to complete as we may change speed while (active_out); - active_listener->stopListening(); + if (active_listener != nullptr) { + active_listener->stopListening(); + } rx_tick_cnt = 1; // 1 : next interrupt will decrease rx_tick_cnt to 0 which means RX pin level will be considered. rx_bit_cnt = -1; // rx_bit_cnt = -1 : waiting for start bit setSpeed(_speed);