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
@@ -2257,6 +2257,11 @@ int32_t GPS::disable()
|
||||
return INT32_MAX;
|
||||
}
|
||||
|
||||
bool GPS::isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void GPS::toggleGpsMode()
|
||||
{
|
||||
if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
|
||||
|
||||
@@ -98,6 +98,9 @@ class GPS : private concurrency::OSThread
|
||||
// Disable the thread
|
||||
int32_t disable() override;
|
||||
|
||||
// Returns if the thread is enabled
|
||||
bool isEnabled();
|
||||
|
||||
// toggle between enabled/disabled
|
||||
void toggleGpsMode();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user