mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-07 12:46:12 +00:00
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:
@@ -357,17 +357,7 @@ private:
|
||||
bool selIsStart() const { return hasStart() && _wp_sel == 0; }
|
||||
int wpIndex() const { return _wp_sel - (hasStart() ? 1 : 0); } // index into WaypointStore
|
||||
|
||||
static bool ownPos(int32_t& lat, int32_t& lon) {
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
LocationProvider* loc = sensors.getLocationProvider();
|
||||
if (loc && loc->isValid()) {
|
||||
lat = (int32_t)loc->getLatitude();
|
||||
lon = (int32_t)loc->getLongitude();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
bool ownPos(int32_t& lat, int32_t& lon) const { return _task->currentLocation(lat, lon); }
|
||||
|
||||
void handleMarkHere() {
|
||||
int32_t lat, lon;
|
||||
|
||||
Reference in New Issue
Block a user