feat(gps): Do not start gps if lora region is unset (#10386)
* Disable gps thread on startup if lora region is unset There is little reason to waste battery on the gps if the data cannot yet be used. * fix goobered merge Refactor GPS enabling logic and remove duplicate code. * trunk --------- Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
This commit is contained in:
co-authored by
Jonathan Bennett
parent
29b3cfaeca
commit
9cef69a9d3
5 files changed
+27
No files matched your search
@@ -971,6 +971,12 @@ void setup()
|
||||
gps = GPS::createGps();
|
||||
if (gps) {
|
||||
gpsStatus->observe(&gps->newStatus);
|
||||
|
||||
// If lora region is unset, disable the gps thread
|
||||
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET &&
|
||||
config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
|
||||
gps->disable();
|
||||
}
|
||||
} else {
|
||||
LOG_DEBUG("Run without GPS");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user