Forgot a part of the 1.3 fix

This commit is contained in:
Thomas Göttgens 2022-05-30 00:05:40 +02:00
parent 8e8158ebbc
commit 33fac6d0f5
4 changed files with 22 additions and 8 deletions

View File

@ -203,6 +203,11 @@ GPS::~GPS()
bool GPS::hasLock() { return hasValidLocation; } bool GPS::hasLock() { return hasValidLocation; }
bool GPS::hasFlow()
{
return hasGPS;
}
// Allow defining the polarity of the WAKE output. default is active high // Allow defining the polarity of the WAKE output. default is active high
#ifndef GPS_WAKE_ACTIVE #ifndef GPS_WAKE_ACTIVE
#define GPS_WAKE_ACTIVE 1 #define GPS_WAKE_ACTIVE 1
@ -342,7 +347,7 @@ int32_t GPS::runOnce()
} else { } else {
#ifdef GPS_UBLOX #ifdef GPS_UBLOX
// reset the GPS on next bootup // 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"); DEBUG_MSG("GPS is not communicating, trying factory reset on next bootup.\n");
devicestate.did_gps_reset = false; devicestate.did_gps_reset = false;
nodeDB.saveToDisk(); nodeDB.saveToDisk();

View File

@ -57,6 +57,9 @@ class GPS : private concurrency::OSThread
/// Returns true if we have acquired GPS lock. /// Returns true if we have acquired GPS lock.
virtual bool hasLock(); 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 /// Return true if we are connected to a GPS
bool isConnected() const { return hasGPS; } bool isConnected() const { return hasGPS; }

View File

@ -27,7 +27,7 @@ bool NMEAGPS::factoryReset()
_serial_gps->write(_message_reset,sizeof(_message_reset)); _serial_gps->write(_message_reset,sizeof(_message_reset));
delay(1000); delay(1000);
#endif #endif
return true; return true;
} }
bool NMEAGPS::setupGPS() bool NMEAGPS::setupGPS()
@ -235,6 +235,10 @@ bool NMEAGPS::hasLock()
return false; return false;
} }
bool NMEAGPS::hasFlow()
{
return reader.passedChecksum() > 0;
}
bool NMEAGPS::whileIdle() bool NMEAGPS::whileIdle()
{ {

View File

@ -51,4 +51,6 @@ class NMEAGPS : public GPS
virtual bool lookForLocation() override; virtual bool lookForLocation() override;
virtual bool hasLock() override; virtual bool hasLock() override;
virtual bool hasFlow() override;
}; };