diff --git a/geeksville-private/TODO.md b/geeksville-private/TODO.md index 7b9139fa..6d36d09d 100644 --- a/geeksville-private/TODO.md +++ b/geeksville-private/TODO.md @@ -2,24 +2,6 @@ You probably don't care about this section - skip to the next one. - - -* fix assertion failure -``` -22:57:36 64409 [PositionPlugin] FIXME-update-db Sniffing packet -22:57:36 64409 [PositionPlugin] Delivering rx packet (id=0x5851f437 Fr0xa1 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=3 rxtime=1628895456 priority=10) -22:57:36 64409 [PositionPlugin] Forwarding to phone (id=0x5851f437 Fr0xa1 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=3 rxtime=1628895456 priority=10) -22:57:36 64409 [PositionPlugin] Update DB node 0x85f4da1, rx_time=1628895456 -22:57:36 64409 [PositionPlugin] Plugin routing considered -22:57:36 64409 [PositionPlugin] Add packet record (id=0x5851f437 Fr0xa1 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=3 rxtime=1628895456 priority=10) -22:57:36 64409 [PositionPlugin] Expanding short PSK #1 -22:57:36 64409 [PositionPlugin] Installing AES128 key! -22:57:36 64409 [PositionPlugin] enqueuing for send (id=0x5851f437 Fr0xa1 To0xff, WantAck0, HopLim3 Ch0xb1 encrypted rxtime=1628895456 priority=10) -22:57:36 64409 [PositionPlugin] (bw=125, sf=12, cr=4/8) packet symLen=32 ms, payloadSize=22, time 2596 ms -22:57:36 64409 [PositionPlugin] txGood=6,rxGood=10,rxBad=0 -22:57:36 64409 [PositionPlugin] AirTime - Packet transmitted : 2596ms -22:57:36 64409 [RadioIf] assert failed src/mesh/RadioLibInterface.cpp: 240, void RadioLibInterface::handleReceiveInterrupt(), test=isReceiving -``` * send debug info 'in-band' * fix wifi connections for mqtt * usb lora dongle from pine64 diff --git a/src/concurrency/NotifiedWorkerThread.cpp b/src/concurrency/NotifiedWorkerThread.cpp index a7f8fe49..9be2bc90 100644 --- a/src/concurrency/NotifiedWorkerThread.cpp +++ b/src/concurrency/NotifiedWorkerThread.cpp @@ -72,14 +72,21 @@ bool NotifiedWorkerThread::notifyLater(uint32_t delay, uint32_t v, bool overwrit return didIt; } -int32_t NotifiedWorkerThread::runOnce() +void NotifiedWorkerThread::checkNotification() { auto n = notification; - enabled = false; // Only run once per notification notification = 0; // clear notification if (n) { onNotify(n); } +} + + + +int32_t NotifiedWorkerThread::runOnce() +{ + enabled = false; // Only run once per notification + checkNotification(); return RUN_SAME; } diff --git a/src/concurrency/NotifiedWorkerThread.h b/src/concurrency/NotifiedWorkerThread.h index cdb37c35..62827785 100644 --- a/src/concurrency/NotifiedWorkerThread.h +++ b/src/concurrency/NotifiedWorkerThread.h @@ -38,8 +38,14 @@ class NotifiedWorkerThread : public OSThread protected: virtual void onNotify(uint32_t notification) = 0; + /// just calls checkNotification() virtual int32_t runOnce(); + /// Sometimes we might want to check notifications independently of when our thread was getting woken up (i.e. if we are about to change + /// radio transmit/receive modes we want to handle any pending interrupts first). You can call this method and if any notifications are currently + /// pending they will be handled immediately. + void checkNotification(); + private: /** * Notify this thread so it can run diff --git a/src/mesh/SX1262Interface.cpp b/src/mesh/SX1262Interface.cpp index 8af6d0c1..002050f1 100644 --- a/src/mesh/SX1262Interface.cpp +++ b/src/mesh/SX1262Interface.cpp @@ -146,6 +146,8 @@ void INTERRUPT_ATTR SX1262Interface::disableInterrupt() void SX1262Interface::setStandby() { + checkNotification(); // handle any pending interrupts before we force standby + int err = lora.standby(); assert(err == ERR_NONE);