This commit is contained in:
IoTThinks 2026-04-20 19:43:00 +12:00 committed by GitHub
commit 58744d693e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View file

@ -2191,3 +2191,11 @@ bool MyMesh::advert() {
return false;
}
}
// To check if there is pending work
bool MyMesh::hasPendingWork() const {
#if defined(WITH_BRIDGE)
if (bridge.isRunning()) return true; // bridge needs WiFi radio, can't sleep
#endif
return _mgr->getOutboundTotal() > 0;
}

View file

@ -177,6 +177,9 @@ public:
}
#endif
// To check if there is pending work
bool hasPendingWork() const;
private:
void writeOKFrame();
void writeErrFrame(uint8_t err_code);

View file

@ -229,4 +229,10 @@ void loop() {
ui_task.loop();
#endif
rtc_clock.tick();
if (!the_mesh.hasPendingWork()) {
#if defined(NRF52_PLATFORM)
board.sleep(0); // nrf ignores seconds param, sleeps whenever possible
#endif
}
}