mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-07 04:36:11 +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:
@@ -111,17 +111,8 @@ class NearbyScreen : public UIScreen {
|
||||
|
||||
void refresh() {
|
||||
_count = 0;
|
||||
_own_gps = false;
|
||||
_own_lat = _own_lon = 0;
|
||||
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
LocationProvider* loc = sensors.getLocationProvider();
|
||||
if (loc && loc->isValid()) {
|
||||
_own_lat = loc->getLatitude();
|
||||
_own_lon = loc->getLongitude();
|
||||
_own_gps = true;
|
||||
}
|
||||
#endif
|
||||
_own_gps = _task->currentLocation(_own_lat, _own_lon);
|
||||
|
||||
int nc = the_mesh.getNumContacts();
|
||||
for (int i = 0; i < nc && _count < MAX_NEARBY; i++) {
|
||||
|
||||
Reference in New Issue
Block a user