Skip to content

Commit f4c200f

Browse files
FRASTMfpistm
authored andcommitted
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 <[email protected]>
1 parent b626ed2 commit f4c200f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/SoftwareSerial/src/SoftwareSerial.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ bool SoftwareSerial::listen()
148148
if (active_listener != this) {
149149
// wait for any transmit to complete as we may change speed
150150
while (active_out);
151-
active_listener->stopListening();
151+
if (active_listener != nullptr) {
152+
active_listener->stopListening();
153+
}
152154
rx_tick_cnt = 1; // 1 : next interrupt will decrease rx_tick_cnt to 0 which means RX pin level will be considered.
153155
rx_bit_cnt = -1; // rx_bit_cnt = -1 : waiting for start bit
154156
setSpeed(_speed);

0 commit comments

Comments
 (0)