mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Added Power Saving for NRF52 companions
This commit is contained in:
parent
be780491ac
commit
bbc26d40d3
3 changed files with 17 additions and 0 deletions
|
|
@ -2144,3 +2144,11 @@ bool MyMesh::advert() {
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,9 @@ public:
|
||||||
sensors.setSettingValue("gps_interval", interval_str);
|
sensors.setSettingValue("gps_interval", interval_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To check if there is pending work
|
||||||
|
bool hasPendingWork() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -229,4 +229,10 @@ void loop() {
|
||||||
ui_task.loop();
|
ui_task.loop();
|
||||||
#endif
|
#endif
|
||||||
rtc_clock.tick();
|
rtc_clock.tick();
|
||||||
|
|
||||||
|
if (!the_mesh.hasPendingWork()) {
|
||||||
|
#if defined(NRF52_PLATFORM)
|
||||||
|
board.sleep(0); // nrf ignores seconds param, sleeps whenever possible
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue