Skip to content

Commit 2db6d4e

Browse files
committed
Prevent packet errors from growing
1 parent 78c29a0 commit 2db6d4e

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

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

0 commit comments

Comments
 (0)