fix a rare GPS data corruption condition (#890)

* fix a rare GPS data corruption condition

* don't use hasLock to determine validity
This commit is contained in:
a-f-G-U-C
2021-10-23 03:21:59 +00:00
committed by GitHub
parent d0fb363422
commit a914ee133c
2 changed files with 3 additions and 3 deletions

View File

@@ -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;