always use gps.isConnected to check for GPS, it is the only thing

guaranteed to be fresh and accurate
This commit is contained in:
geeksville
2020-03-27 12:32:18 -07:00
parent cc3bac7ea0
commit a0c97825e8
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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