Browse Source

* Companion: applyGPSPrefs() now just in one place (moved out of UITask)

pull/2152/head
Scott Powell 2 months ago
parent
commit
2325973fec
  1. 5
      examples/companion_radio/MyMesh.h
  2. 12
      examples/companion_radio/ui-new/UITask.cpp

5
examples/companion_radio/MyMesh.h

@ -168,6 +168,11 @@ public:
#if ENV_INCLUDE_GPS == 1 #if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() { void applyGpsPrefs() {
sensors.setSettingValue("gps", _prefs.gps_enabled ? "1" : "0"); sensors.setSettingValue("gps", _prefs.gps_enabled ? "1" : "0");
if (_prefs.gps_interval > 0) {
char interval_str[12]; // Max: 24 hours = 86400 seconds (5 digits + null)
sprintf(interval_str, "%u", _prefs.gps_interval);
sensors.setSettingValue("gps_interval", interval_str);
}
} }
#endif #endif

12
examples/companion_radio/ui-new/UITask.cpp

@ -560,18 +560,6 @@ void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* no
_node_prefs = node_prefs; _node_prefs = node_prefs;
#if ENV_INCLUDE_GPS == 1
// Apply GPS preferences from stored prefs
if (_sensors != NULL && _node_prefs != NULL) {
_sensors->setSettingValue("gps", _node_prefs->gps_enabled ? "1" : "0");
if (_node_prefs->gps_interval > 0) {
char interval_str[12]; // Max: 24 hours = 86400 seconds (5 digits + null)
sprintf(interval_str, "%u", _node_prefs->gps_interval);
_sensors->setSettingValue("gps_interval", interval_str);
}
}
#endif
if (_display != NULL) { if (_display != NULL) {
_display->turnOn(); _display->turnOn();
} }

Loading…
Cancel
Save