RadioLib edge-triggered interrupts robustness (#9658)

* Fix potential race condition (read, ISR write, clear) in NotifiedWorkerThread

* Check for missed edge-triggered interrupts race condition between startReceive and enableInterrupt

* Occasionally poll to catch missed RX_DONE interrupts. (RadioLibInterface::pollMissedIrqs)

* Simplify RadioLibInterface::checkRxDoneIrqFlag()

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Mike Robbins
2026-02-21 06:14:04 -06:00
committed by GitHub
co-authored by GitHub Ben Meadors
parent a5523b04ef
commit 8feb34e7a8
9 changed files with 41 additions and 3 deletions
+16
View File
@@ -521,6 +521,22 @@ void RadioLibInterface::startReceive()
powerMon->setState(meshtastic_PowerMon_State_Lora_RXOn);
}
void RadioLibInterface::pollMissedIrqs()
{
// RadioLibInterface::enableInterrupt uses EDGE-TRIGGERED interrupts. Poll as a backup to catch missed edges.
if (isReceiving) {
checkRxDoneIrqFlag();
}
}
void RadioLibInterface::checkRxDoneIrqFlag()
{
if (iface->checkIrq(RADIOLIB_IRQ_RX_DONE)) {
LOG_WARN("caught missed RX_DONE");
notify(ISR_RX, true);
}
}
void RadioLibInterface::configHardwareForSend()
{
powerMon->setState(meshtastic_PowerMon_State_Lora_TXOn);