Skip to content

Commit 099ef67

Browse files
committed
Prevent packet errors from growing
1 parent 04a6c70 commit 099ef67

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
@@ -186,7 +186,10 @@ bool RadioLibWrapper::isChannelActive() {
186186
if (_threshold == 0) return false; // interference check is disabled
187187

188188
int16_t result = performChannelScan();
189-
// scanChannel() leaves radio in standby — restart RX regardless of result
189+
// scanChannel() triggers DIO interrupt (CAD done) which sets STATE_INT_READY
190+
// via setFlag() ISR. Clear it before restarting RX so recvRaw() doesn't
191+
// try to read a non-existent packet and count a spurious recv error.
192+
state = STATE_IDLE;
190193
startRecv();
191194
return result != RADIOLIB_CHANNEL_FREE;
192195
}

0 commit comments

Comments
 (0)