From 2325973fec4e34636deceb31d428605b2b04f478 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Wed, 25 Mar 2026 16:26:51 +1100 Subject: [PATCH] * Companion: applyGPSPrefs() now just in one place (moved out of UITask) --- examples/companion_radio/MyMesh.h | 5 +++++ examples/companion_radio/ui-new/UITask.cpp | 12 ------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index 2c49510c..3b02f5f6 100644 --- a/examples/companion_radio/MyMesh.h +++ b/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 diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 265532be..94a8ee3e 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/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(); }