From 4df97ae5ed568b01ae1328d964b1580ce93f4825 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Mon, 18 May 2026 09:39:10 +0200 Subject: [PATCH] fix: persist auto_lock setting across reboots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit auto_lock was defined in NodePrefs but missing from both loadPrefsInt and savePrefs in DataStore.cpp. Added at the end of the serialization chain (inside if(file.available())) for backwards compatibility with existing saved files — old files default to auto_lock=0 (disabled). Co-Authored-By: Claude Sonnet 4.6 --- examples/companion_radio/DataStore.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/companion_radio/DataStore.cpp b/examples/companion_radio/DataStore.cpp index e3e8657c..d9e0d10c 100644 --- a/examples/companion_radio/DataStore.cpp +++ b/examples/companion_radio/DataStore.cpp @@ -283,6 +283,9 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no file.read((uint8_t *)&_prefs.ch_notif_melody_2, sizeof(_prefs.ch_notif_melody_2)); if (file.available()) { file.read((uint8_t *)_prefs.dm_melody, sizeof(_prefs.dm_melody)); + if (file.available()) { + file.read((uint8_t *)&_prefs.auto_lock, sizeof(_prefs.auto_lock)); + } } } } @@ -371,6 +374,7 @@ void DataStore::savePrefs(const NodePrefs& _prefs, double node_lat, double node_ file.write((uint8_t *)&_prefs.ch_notif_melody_set, sizeof(_prefs.ch_notif_melody_set)); file.write((uint8_t *)&_prefs.ch_notif_melody_2, sizeof(_prefs.ch_notif_melody_2)); file.write((uint8_t *)_prefs.dm_melody, sizeof(_prefs.dm_melody)); + file.write((uint8_t *)&_prefs.auto_lock, sizeof(_prefs.auto_lock)); file.close(); }