diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index a7ed9e9205..ae92f52420 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -203,6 +203,11 @@ GPS::~GPS() bool GPS::hasLock() { return hasValidLocation; } +bool GPS::hasFlow() +{ + return hasGPS; +} + // Allow defining the polarity of the WAKE output. default is active high #ifndef GPS_WAKE_ACTIVE #define GPS_WAKE_ACTIVE 1 @@ -342,7 +347,7 @@ int32_t GPS::runOnce() } else { #ifdef GPS_UBLOX // reset the GPS on next bootup - if(devicestate.did_gps_reset && (millis() > 60000)) { + if(devicestate.did_gps_reset && (millis() > 60000) && !hasFlow()) { DEBUG_MSG("GPS is not communicating, trying factory reset on next bootup.\n"); devicestate.did_gps_reset = false; nodeDB.saveToDisk(); diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 836114d2e3..ff3b09b60a 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -57,6 +57,9 @@ class GPS : private concurrency::OSThread /// Returns true if we have acquired GPS lock. virtual bool hasLock(); + /// Returns true if there's valid data flow with the chip. + virtual bool hasFlow(); + /// Return true if we are connected to a GPS bool isConnected() const { return hasGPS; } diff --git a/src/gps/NMEAGPS.cpp b/src/gps/NMEAGPS.cpp index 4b0baee665..363eb8263b 100644 --- a/src/gps/NMEAGPS.cpp +++ b/src/gps/NMEAGPS.cpp @@ -20,14 +20,14 @@ static int32_t toDegInt(RawDegrees d) bool NMEAGPS::factoryReset() { #ifdef GPS_UBLOX - // Factory Reset - byte _message_reset[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, - 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0x00, 0x00, 0x17, 0x2B, 0x7E}; - _serial_gps->write(_message_reset,sizeof(_message_reset)); - delay(1000); + // Factory Reset + byte _message_reset[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, + 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x00, 0x00, 0x17, 0x2B, 0x7E}; + _serial_gps->write(_message_reset,sizeof(_message_reset)); + delay(1000); #endif -return true; + return true; } bool NMEAGPS::setupGPS() @@ -235,6 +235,10 @@ bool NMEAGPS::hasLock() return false; } +bool NMEAGPS::hasFlow() +{ + return reader.passedChecksum() > 0; +} bool NMEAGPS::whileIdle() { diff --git a/src/gps/NMEAGPS.h b/src/gps/NMEAGPS.h index 6ef5609622..c97be08ce1 100644 --- a/src/gps/NMEAGPS.h +++ b/src/gps/NMEAGPS.h @@ -51,4 +51,6 @@ class NMEAGPS : public GPS virtual bool lookForLocation() override; virtual bool hasLock() override; + + virtual bool hasFlow() override; }; diff --git a/version.properties b/version.properties index b6655fbf2b..a669c68fd2 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 2 -build = 64 +build = 65