mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 09:42:35 +00:00
ask for factory reset if GPS does not talk to us.
This commit is contained in:
parent
44159f75f1
commit
7f9c07ae37
@ -96,12 +96,16 @@ bool GPS::setupGPS()
|
|||||||
delay(250);
|
delay(250);
|
||||||
#endif
|
#endif
|
||||||
#ifdef GPS_UBLOX
|
#ifdef GPS_UBLOX
|
||||||
|
delay(250);
|
||||||
// Set the UART port to output NMEA only
|
// Set the UART port to output NMEA only
|
||||||
byte _message_nmea[] = {0xB5, 0x62, 0x06, 0x00, 0x14, 0x00,
|
byte _message_nmea[] = {0xB5, 0x62, 0x06, 0x00, 0x14, 0x00,
|
||||||
0x01, 0x00, 0x00, 0x00, 0xC0, 0x08, 0x00, 0x00, 0x80, 0x25, 0x00, 0x00, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x01, 0x00, 0x00, 0x00, 0xC0, 0x08, 0x00, 0x00, 0x80, 0x25, 0x00, 0x00, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x91, 0xAF};
|
0x91, 0xAF};
|
||||||
_serial_gps->write(_message_nmea,sizeof(_message_nmea));
|
_serial_gps->write(_message_nmea,sizeof(_message_nmea));
|
||||||
|
if (!getACK(0x06, 0x00)) {
|
||||||
|
DEBUG_MSG("WARNING: Unable to enable NMEA Mode.\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// disable GGL
|
// disable GGL
|
||||||
byte _message_GGL[] = {0xB5, 0x62, 0x06, 0x01, 0x08, 0x00,
|
byte _message_GGL[] = {0xB5, 0x62, 0x06, 0x01, 0x08, 0x00,
|
||||||
0xF0, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
|
0xF0, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||||
@ -335,6 +339,15 @@ int32_t GPS::runOnce()
|
|||||||
if (whileIdle()) {
|
if (whileIdle()) {
|
||||||
// if we have received valid NMEA claim we are connected
|
// if we have received valid NMEA claim we are connected
|
||||||
setConnected();
|
setConnected();
|
||||||
|
} else {
|
||||||
|
#ifdef GPS_UBLOX
|
||||||
|
// reset the GPS on next bootup
|
||||||
|
if(devicestate.did_gps_reset && (millis() > 60000)) {
|
||||||
|
DEBUG_MSG("GPS is not communicating, trying factory reset on next bootup.\n");
|
||||||
|
devicestate.did_gps_reset = false;
|
||||||
|
nodeDB.saveToDisk();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are overdue for an update, turn on the GPS and at least publish the current status
|
// If we are overdue for an update, turn on the GPS and at least publish the current status
|
||||||
|
@ -17,6 +17,19 @@ static int32_t toDegInt(RawDegrees d)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool NMEAGPS::setupGPS()
|
bool NMEAGPS::setupGPS()
|
||||||
{
|
{
|
||||||
GPS::setupGPS();
|
GPS::setupGPS();
|
||||||
|
@ -25,6 +25,8 @@ class NMEAGPS : public GPS
|
|||||||
public:
|
public:
|
||||||
virtual bool setupGPS() override;
|
virtual bool setupGPS() override;
|
||||||
|
|
||||||
|
virtual bool factoryReset() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Subclasses should look for serial rx characters here and feed it to their GPS parser
|
/** Subclasses should look for serial rx characters here and feed it to their GPS parser
|
||||||
*
|
*
|
||||||
|
@ -567,6 +567,7 @@ void setup()
|
|||||||
|
|
||||||
// ONCE we will factory reset the GPS for bug #327
|
// ONCE we will factory reset the GPS for bug #327
|
||||||
if (gps && !devicestate.did_gps_reset) {
|
if (gps && !devicestate.did_gps_reset) {
|
||||||
|
DEBUG_MSG("GPS FactoryReset requested\n");
|
||||||
if (gps->factoryReset()) { // If we don't succeed try again next time
|
if (gps->factoryReset()) { // If we don't succeed try again next time
|
||||||
devicestate.did_gps_reset = true;
|
devicestate.did_gps_reset = true;
|
||||||
nodeDB.saveToDisk();
|
nodeDB.saveToDisk();
|
||||||
|
Loading…
Reference in New Issue
Block a user