Skip to content

Commit 2325973

Browse files
author
Scott Powell
committed
* Companion: applyGPSPrefs() now just in one place (moved out of UITask)
1 parent 8637a74 commit 2325973

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

examples/companion_radio/MyMesh.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ class MyMesh : public BaseChatMesh, public DataStoreHost {
168168
#if ENV_INCLUDE_GPS == 1
169169
void applyGpsPrefs() {
170170
sensors.setSettingValue("gps", _prefs.gps_enabled ? "1" : "0");
171+
if (_prefs.gps_interval > 0) {
172+
char interval_str[12]; // Max: 24 hours = 86400 seconds (5 digits + null)
173+
sprintf(interval_str, "%u", _prefs.gps_interval);
174+
sensors.setSettingValue("gps_interval", interval_str);
175+
}
171176
}
172177
#endif
173178

examples/companion_radio/ui-new/UITask.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -560,18 +560,6 @@ void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* no
560560

561561
_node_prefs = node_prefs;
562562

563-
#if ENV_INCLUDE_GPS == 1
564-
// Apply GPS preferences from stored prefs
565-
if (_sensors != NULL && _node_prefs != NULL) {
566-
_sensors->setSettingValue("gps", _node_prefs->gps_enabled ? "1" : "0");
567-
if (_node_prefs->gps_interval > 0) {
568-
char interval_str[12]; // Max: 24 hours = 86400 seconds (5 digits + null)
569-
sprintf(interval_str, "%u", _node_prefs->gps_interval);
570-
_sensors->setSettingValue("gps_interval", interval_str);
571-
}
572-
}
573-
#endif
574-
575563
if (_display != NULL) {
576564
_display->turnOn();
577565
}

0 commit comments

Comments
 (0)