mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-21 02:02:23 +00:00
Lazy probe of GPS (#2781)
* First attempt at lazy config of GPS * More GPS rework Break GPS init into smaller, interruptable steps Move more GPS commands into ubx.h Combine Setup functions * Move the rest of UBX messages to ubs.h
This commit is contained in:
22
src/main.cpp
22
src/main.cpp
@@ -559,6 +559,7 @@ void setup()
|
||||
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
|
||||
|
||||
nodeStatus->observe(&nodeDB.newStatus);
|
||||
gps = createGps();
|
||||
|
||||
service.init();
|
||||
|
||||
@@ -736,27 +737,6 @@ void setup()
|
||||
PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS
|
||||
powerFSMthread = new PowerFSMThread();
|
||||
|
||||
gps = createGps();
|
||||
|
||||
if (gps) {
|
||||
gpsStatus->observe(&gps->newStatus);
|
||||
if (config.position.gps_enabled == false && config.position.fixed_position == false) {
|
||||
doGPSpowersave(false);
|
||||
}
|
||||
} else {
|
||||
LOG_WARN("No GPS found - running without GPS\n");
|
||||
}
|
||||
// We have now loaded our saved preferences from flash
|
||||
|
||||
// ONCE we will factory reset the GPS for bug #327
|
||||
if (gps && !devicestate.did_gps_reset) {
|
||||
LOG_WARN("GPS FactoryReset requested\n");
|
||||
if (gps->factoryReset()) { // If we don't succeed try again next time
|
||||
devicestate.did_gps_reset = true;
|
||||
nodeDB.saveToDisk(SEGMENT_DEVICESTATE);
|
||||
}
|
||||
}
|
||||
// setBluetoothEnable(false); we now don't start bluetooth until we enter the proper state
|
||||
setCPUFast(false); // 80MHz is fine for our slow peripherals
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user