fix(gps): hold GPS awake during waypoint nav/avg/track-back and message-location navigate

These views run the same live bearing/distance readout as Compass/Nearby's
navigate mode, which already held GPS awake -- these three didn't, so
duty-cycling could leave them stuck on a stale fix until the next scheduled
wake (up to the configured sleep interval).
This commit is contained in:
MarekZegare4
2026-08-14 00:40:50 +02:00
parent cc591e8cee
commit 55cb5d25d3
5 changed files with 16 additions and 1 deletions
@@ -627,6 +627,10 @@ public:
// The history rings + per-channel unread counters init in MessageHistory. // The history rings + per-channel unread counters init in MessageHistory.
} }
// Forwarded to UITask's GPS duty-cycle hold — true while showing the
// bearing/distance view to a location shared in a message.
bool navActive() const { return _nav_active; }
// First free channel slot (existing config or blank name), or -1 if full. // First free channel slot (existing config or blank name), or -1 if full.
int findFreeChannelSlot() const { int findFreeChannelSlot() const {
for (int i = 0; i < MAX_GROUP_CHANNELS; i++) { for (int i = 0; i < MAX_GROUP_CHANNELS; i++) {
@@ -114,6 +114,9 @@ public:
// KEY_CANCEL returns there, not to Tools. // KEY_CANCEL returns there, not to Tools.
void showMapView() { _view = V_MAP; _return_home = true; } void showMapView() { _view = V_MAP; _return_home = true; }
// Forwarded to UITask's GPS duty-cycle hold — see WaypointsView::needsLiveGps().
bool wpNeedsLiveGps() const { return _wp.needsLiveGps(); }
int render(DisplayDriver& display) override { int render(DisplayDriver& display) override {
display.setTextSize(1); display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT); display.setColor(DisplayDriver::LIGHT);
@@ -2590,6 +2590,8 @@ void UITask::loop() {
|| (_node_prefs && _node_prefs->locator_enabled && _node_prefs->locator_has_target) || (_node_prefs && _node_prefs->locator_enabled && _node_prefs->locator_has_target)
|| curr == compass_screen || curr == compass_screen
|| (curr == nearby_screen && ((NearbyScreen*)nearby_screen)->isNavigating()) || (curr == nearby_screen && ((NearbyScreen*)nearby_screen)->isNavigating())
|| (curr == trail_screen && ((TrailScreen*)trail_screen)->wpNeedsLiveGps())
|| (curr == messages_screen && ((MessagesScreen*)messages_screen)->navActive())
|| the_mesh.isGpsFixPending(); || the_mesh.isGpsFixPending();
_sensors->setGpsKeepAwake(gps_needed_live); _sensors->setGpsKeepAwake(gps_needed_live);
// A fresh wake (either a duty-cycle wake, or GPS forced continuously back // A fresh wake (either a duty-cycle wake, or GPS forced continuously back
@@ -274,6 +274,12 @@ public:
// True while the component owns the screen (a sub-mode or the keyboard is up). // True while the component owns the screen (a sub-mode or the keyboard is up).
bool active() const { return _mode != OFF || _kb_active; } bool active() const { return _mode != OFF || _kb_active; }
// True in the sub-modes that read a live, continuous GPS position (bearing
// to target, running average, walking a track back) -- as opposed to LIST
// (just browsing) or ADD (typed coordinates, no fix involved). Used by
// UITask's GPS duty-cycle hold so these don't stall waiting on a nap.
bool needsLiveGps() const { return _mode == NAV || _mode == AVG || _mode == TRACKBACK; }
// Entry points called from TrailScreen's action menu. // Entry points called from TrailScreen's action menu.
void openList() { _mode = LIST; _sel = 0; _scroll = 0; } void openList() { _mode = LIST; _sel = 0; _scroll = 0; }
void markHere() { void markHere() {
+1 -1
View File
@@ -5,7 +5,7 @@
- **Experimental: M5Stack Cardputer ADV and LilyGO T-Echo Lite + KeyShield board support** — built-in keyboard, no CardKB or joystick needed. Full companion/solo/repeater/room-server env range. - **Experimental: M5Stack Cardputer ADV and LilyGO T-Echo Lite + KeyShield board support** — built-in keyboard, no CardKB or joystick needed. Full companion/solo/repeater/room-server env range.
- **Experimental: solo builds for Heltec V3 and V4** — full on-device UI, driven by CardKB or a wired joystick. - **Experimental: solo builds for Heltec V3 and V4** — full on-device UI, driven by CardKB or a wired joystick.
- **Screenshot support added to the Heltec V3/V4 solo builds.** - **Screenshot support added to the Heltec V3/V4 solo builds.**
- **GPS duty-cycling** (Settings System "GPS pwr") — sleeps GPS between fixes to save power. Stays on automatically when Trail, Live share, Locator, Compass/Nearby, or `!gps fix` need it. - **GPS duty-cycling** (Settings System "GPS pwr") — sleeps GPS between fixes to save power. Stays on automatically when Trail (including waypoint navigate/average/track-back), Live share, Locator, Compass/Nearby, navigating a shared location, or `!gps fix` need it.
- **RX power-save (Settings Radio Pwr save) now recovers on its own** if the hardware duty-cycle sequencer gets stuck. - **RX power-save (Settings Radio Pwr save) now recovers on its own** if the hardware duty-cycle sequencer gets stuck.
- **Updated upstream base to companion-v1.17.0** — hardware Channel Activity Detection, MCU temperature telemetry, LR2021 standby fix, and misc upstream fixes. - **Updated upstream base to companion-v1.17.0** — hardware Channel Activity Detection, MCU temperature telemetry, LR2021 standby fix, and misc upstream fixes.