From a914ee133c1120b88c37e2990073e083c37989ab Mon Sep 17 00:00:00 2001 From: a-f-G-U-C <65810997+a-f-G-U-C@users.noreply.github.com> Date: Sat, 23 Oct 2021 03:21:59 +0000 Subject: [PATCH] fix a rare GPS data corruption condition (#890) * fix a rare GPS data corruption condition * don't use hasLock to determine validity --- src/gps/GPS.cpp | 2 +- src/mesh/MeshService.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 6b0f64ff6..89f2d79b5 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -206,7 +206,7 @@ void GPS::publishUpdate() // Notify any status instances that are observing us const meshtastic::GPSStatus status = - meshtastic::GPSStatus(hasLock(), isConnected(), latitude, longitude, altitude, dop, heading, numSatellites); + meshtastic::GPSStatus(hasValidLocation, isConnected(), latitude, longitude, altitude, dop, heading, numSatellites); newStatus.notifyObservers(&status); } } diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index c5e4481b6..b8d47ab8e 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -209,13 +209,13 @@ NodeInfo *MeshService::refreshMyNodeInfo() return node; } -int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused) +int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus) { // Update our local node info with our position (even if we don't decide to update anyone else) NodeInfo *node = refreshMyNodeInfo(); Position pos = node->position; - if (gps->hasLock()) { + if (newStatus->getHasLock()) { if (gps->altitude != 0) pos.altitude = gps->altitude; pos.latitude_i = gps->latitude;