From c8b95f769181bcac36957909fd18e6061f235c7c Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 18 Mar 2020 18:34:22 -0700 Subject: [PATCH] oops - I broke compass display with my gps changes and didn't notice till testing with two gps equipped devices. fixed. --- src/GPS.cpp | 6 ++++-- src/MeshService.cpp | 15 ++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/GPS.cpp b/src/GPS.cpp index 52feaf651..e120b73f1 100644 --- a/src/GPS.cpp +++ b/src/GPS.cpp @@ -146,7 +146,9 @@ void GPS::doTask() ublox.checkUblox(); // See if new data is available. Process bytes as they come in. // If we don't have a fix (a quick check), don't try waiting for a solution) - fixtype = ublox.getFixType(); + // Hmmm my fix type reading returns zeros for fix, which doesn't seem correct, because it is still sptting out positions + // turn off for now + // fixtype = ublox.getFixType(); DEBUG_MSG("fix type %d\n", fixtype); } @@ -154,7 +156,7 @@ void GPS::doTask() // DEBUG_MSG("lat %d\n", ublox.getLatitude()); // any fix that has time - if ((fixtype >= 2 && fixtype <= 5) && !timeSetFromGPS && ublox.getT()) { + if (!timeSetFromGPS && ublox.getT()) { struct timeval tv; /* Convert to unix time diff --git a/src/MeshService.cpp b/src/MeshService.cpp index ec6003cc8..40af6ccdb 100644 --- a/src/MeshService.cpp +++ b/src/MeshService.cpp @@ -329,14 +329,15 @@ void MeshService::onGPSChanged() MeshPacket *p = allocForSending(); p->payload.which_variant = SubPacket_position_tag; -#if 0 Position &pos = p->payload.variant.position; - if (gps.altitude.isValid()) - pos.altitude = gps.altitude.meters(); - pos.latitude = gps.location.lat(); - pos.longitude = gps.location.lng(); - pos.time = gps.getValidTime(); -#endif + // !zero or !zero lat/long means valid + if(gps.latitude != 0 || gps.longitude != 0) { + if (gps.altitude != 0) + pos.altitude = gps.altitude; + pos.latitude = gps.latitude; + pos.longitude = gps.longitude; + pos.time = gps.getValidTime(); + } // We limit our GPS broadcasts to a max rate static uint32_t lastGpsSend;