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

guaranteed to be fresh and accurate
1.2-legacy
geeksville 2020-03-27 12:32:18 -07:00
rodzic cc3bac7ea0
commit a0c97825e8
2 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

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

Wyświetl plik

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