Skip to content

Commit

Permalink
Merge branch '1.2-legacy' into cyrillic-support
Browse files Browse the repository at this point in the history
  • Loading branch information
thebentern authored May 30, 2022
2 parents a3267c8 + 0adc5ce commit ac60859
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/gps/GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/gps/GPS.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
18 changes: 11 additions & 7 deletions src/gps/NMEAGPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -235,6 +235,10 @@ bool NMEAGPS::hasLock()
return false;
}

bool NMEAGPS::hasFlow()
{
return reader.passedChecksum() > 0;
}

bool NMEAGPS::whileIdle()
{
Expand Down
2 changes: 2 additions & 0 deletions src/gps/NMEAGPS.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ class NMEAGPS : public GPS
virtual bool lookForLocation() override;

virtual bool hasLock() override;

virtual bool hasFlow() override;
};
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[VERSION]
major = 1
minor = 2
build = 64
build = 65

0 comments on commit ac60859

Please sign in to comment.