From a0c97825e8e7ca53eef0e2d25bfead3a8bc40437 Mon Sep 17 00:00:00 2001 From: geeksville Date: Fri, 27 Mar 2020 12:32:18 -0700 Subject: [PATCH] always use gps.isConnected to check for GPS, it is the only thing guaranteed to be fresh and accurate --- src/MeshService.cpp | 4 ++-- src/screen.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MeshService.cpp b/src/MeshService.cpp index 02ce6a09..bf170238 100644 --- a/src/MeshService.cpp +++ b/src/MeshService.cpp @@ -151,7 +151,7 @@ void MeshService::handleFromRadio(MeshPacket *mp) mp->rx_time = gps.getValidTime(); // store the arrival timestamp for the phone // If it is a position packet, perhaps set our clock (if we don't have a GPS of our own, otherwise wait for that to work) - if (!myNodeInfo.has_gps) + if (!gps.isConnected) handleIncomingPosition(mp); else { DEBUG_MSG("Ignoring incoming time, because we have a GPS\n"); @@ -263,7 +263,7 @@ void MeshService::sendToMesh(MeshPacket *p) // nodes shouldn't trust it anyways) Note: for now, we allow a device with a local GPS to include the time, so that gpsless // devices can get time. if (p->has_payload && p->payload.which_variant == SubPacket_position_tag) { - if (!myNodeInfo.has_gps) { + if (!gps.isConnected) { DEBUG_MSG("Stripping time %u from position send\n", p->payload.variant.position.time); p->payload.variant.position.time = 0; } else diff --git a/src/screen.cpp b/src/screen.cpp index 6d06b020..4c66f982 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -393,7 +393,7 @@ static void drawDebugInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16 snprintf(batStr, sizeof(batStr), "Batt %x%%", (isCharging << 1) + isUSBPowered); static char gpsStr[20]; - if (myNodeInfo.has_gps) + if (gps.isConnected) snprintf(gpsStr, sizeof(gpsStr), "GPS %d%%", 75); // FIXME, use something based on hdop else