refactor(nav): single GPS-position accessor + reset COG window after a gap

UITask::currentLocation() becomes the one place that reads the
LocationProvider fix. TrailScreen::ownPos, CompassScreen::gpsValid and
NearbyScreen::refresh now delegate to it instead of each duplicating the
getLocationProvider/isValid dance (and the ENV_INCLUDE_GPS guard).

pushCogFix now restarts the course-over-ground ring when the gap since the
previous fix exceeds 15 s: after losing GPS for a while, a window spanning
the stale old fixes would compute a bogus "teleport" heading. The
last-good heading is kept for display continuity.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-06-04 00:12:15 +02:00
co-authored by Claude Opus 4.8
parent bd364ccfd1
commit 55d164c074
5 changed files with 24 additions and 30 deletions
+4
View File
@@ -152,6 +152,10 @@ public:
// Current course over ground in degrees (0..359), or false if not enough
// recent movement to derive a stable heading. Independent of trail logging.
bool currentCourse(int& deg_out) const;
// Current GPS position (1e6-scaled degrees), false when there's no usable
// fix. Single source of truth for "where am I", shared by the nav / compass
// / map screens so the LocationProvider lookup isn't duplicated per screen.
bool currentLocation(int32_t& lat, int32_t& lon) const;
void playMelody(const char* melody);
void stopMelody();
bool isMelodyPlaying();