Skip to content

Commit d7087bc

Browse files
committed
Prevent packet errors from growing
1 parent 1bbb866 commit d7087bc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/helpers/radiolib/RadioLibWrappers.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ bool RadioLibWrapper::isChannelActive() {
176176
if (_threshold == 0) return false; // interference check is disabled
177177

178178
int16_t result = performChannelScan();
179-
// scanChannel() leaves radio in standby — restart RX regardless of result
179+
// scanChannel() triggers DIO interrupt (CAD done) which sets STATE_INT_READY
180+
// via setFlag() ISR. Clear it before restarting RX so recvRaw() doesn't
181+
// try to read a non-existent packet and count a spurious recv error.
182+
state = STATE_IDLE;
180183
startRecv();
181184
return result != RADIOLIB_CHANNEL_FREE;
182185
}

0 commit comments

Comments
 (0)