From 1dc2493217afbd68e339b6a855799a19f52b675b Mon Sep 17 00:00:00 2001 From: Marcel Verdult Date: Thu, 12 Nov 2026 13:01:57 +0100 Subject: [PATCH] Persist extra_sf and discovery_mod_timestamp in /prefs.json NodePrefs::saveSerial()/loadSerial() leave out two fields that the firmware keeps as live state, so both are reset on every reboot of a node that boots from /prefs.json: - discovery_mod_timestamp ("has this node changed since", read by the repeater and sensor discovery replies). The legacy binary loader still reads it, so it was lost only after the move to /prefs.json. - extra_sf (side detector spread factors set with "extra.sf"). It was never persisted in either format. Both are now written ("disc_mod" next to the advert intervals, "extra_sf" in the radio object as hex, like the companion's scope key). The constructor zeroes extra_sf, which had no initialiser and is now written out. Compatibility: a file without the keys loads as before, the serializer leaves a field alone when its key is missing. A firmware that does not know the keys skips them like any unknown key. --- src/helpers/CommonCLI.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/helpers/CommonCLI.h b/src/helpers/CommonCLI.h index cb85f6f993..9134bb0897 100644 --- a/src/helpers/CommonCLI.h +++ b/src/helpers/CommonCLI.h @@ -99,6 +99,7 @@ class NodePrefs : public ConfigSerializer { def("agc_int", _parent->agc_reset_interval); def("hash_mode", _parent->path_hash_mode); def("multi_ack", _parent->multi_acks); + def("extra_sf", (void *) _parent->extra_sf, sizeof(_parent->extra_sf)); } public: RadioPrefs(NodePrefs* parent) : _parent(parent) { } @@ -242,6 +243,7 @@ class NodePrefs : public ConfigSerializer { def("owner", owner_info, sizeof(owner_info)); def("adv_int", advert_interval); def("f_adv_int", flood_advert_interval); + def("disc_mod", discovery_mod_timestamp); def("lat", node_lat); def("lon", node_lon); def("radio", radio); @@ -260,6 +262,7 @@ class NodePrefs : public ConfigSerializer { guest_password[0] = 0; bridge_secret[0] = 0; owner_info[0] = 0; + memset(extra_sf, 0, sizeof(extra_sf)); } CommonRadioPrefs* getRadioPrefs() { return &radio; }