Просмотр исходного кода

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

Scott Powell 4 месяцев назад
Родитель
Сommit
2325973fec
2 измененных файлов с 5 добавлено и 12 удалено
  1. 5 0
      examples/companion_radio/MyMesh.h
  2. 0 12
      examples/companion_radio/ui-new/UITask.cpp

+ 5 - 0
examples/companion_radio/MyMesh.h

@@ -168,6 +168,11 @@ public:
 #if ENV_INCLUDE_GPS == 1
   void applyGpsPrefs() {
     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
 

+ 0 - 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;
 
-#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) {
     _display->turnOn();
   }