mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-19 17:22:59 +00:00
fix #327 always factory reset the GPS once
This commit is contained in:
17
src/main.cpp
17
src/main.cpp
@@ -231,15 +231,18 @@ void setup()
|
||||
// If we know we have a L80 GPS, don't try UBLOX
|
||||
#ifndef L80_RESET
|
||||
// Init GPS - first try ublox
|
||||
gps = new UBloxGPS();
|
||||
auto ublox = new UBloxGPS();
|
||||
gps = ublox;
|
||||
if (!gps->setup()) {
|
||||
DEBUG_MSG("ERROR: No UBLOX GPS found\n");
|
||||
|
||||
delete ublox;
|
||||
gps = ublox = NULL;
|
||||
|
||||
if (GPS::_serial_gps) {
|
||||
// Some boards might have only the TX line from the GPS connected, in that case, we can't configure it at all. Just
|
||||
// assume NEMA at 9600 baud.
|
||||
DEBUG_MSG("Hoping that NEMA might work\n");
|
||||
delete gps;
|
||||
|
||||
// dumb NEMA access only work for serial GPSes)
|
||||
gps = new NEMAGPS();
|
||||
@@ -255,6 +258,16 @@ void setup()
|
||||
|
||||
service.init();
|
||||
|
||||
// We have now loaded our saved preferences from flash
|
||||
|
||||
// ONCE we will factory reset the GPS for bug #327
|
||||
if (ublox && !devicestate.did_gps_reset) {
|
||||
if (ublox->factoryReset()) { // If we don't succeed try again next time
|
||||
devicestate.did_gps_reset = true;
|
||||
nodeDB.saveToDisk();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SX1262_ANT_SW
|
||||
// make analog PA vs not PA switch on SX1262 eval board work properly
|
||||
pinMode(SX1262_ANT_SW, OUTPUT);
|
||||
|
||||
Reference in New Issue
Block a user