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
GitHub
Jonathan Bennett
parent
29b3cfaeca
commit
9cef69a9d3
@@ -214,6 +214,11 @@ static void applyLoraRegion(meshtastic_Config_LoRaConfig_RegionCode region, bool
|
||||
snprintf(moduleConfig.mqtt.root, sizeof(moduleConfig.mqtt.root), "%s/%s", default_mqtt_root, myRegion->name);
|
||||
changes |= SEGMENT_MODULECONFIG;
|
||||
}
|
||||
#if !MESHTASTIC_EXCLUDE_GPS
|
||||
// Enable gps if it was previously disabled due to region not being set
|
||||
if (gps != nullptr && !gps->isEnabled() && config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED)
|
||||
gps->enable();
|
||||
#endif
|
||||
service->reloadConfig(changes);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user