fix(mqtt): hold newer-version /mqtt_prefs across saves + pin frozen layouts

The unknown-version path kept defaults at boot but any later savePrefs()
(every CLI set command) rewrote /mqtt_prefs as v1 with defaults, destroying
the newer config after a firmware downgrade. Latch _mqtt_prefs_hold when an
unsupported version is seen and refuse to write while it is set — checked
before the NRF52/STM32 open path, which deletes the file first.

Also pin the frozen legacy /mqtt_prefs layouts (472/1464/2904 bytes + 8-byte
header) with static_asserts so every target build re-verifies the deployed
fleet's file offsets, and null-check _obs in AlertReporter::onLoop.
This commit is contained in:
agessaman committed 2026-07-09 12:16:20 -07:00
1 parent 58b9cb66a6
commit c3b8633aa7
4 files changed
+33 -4

No files matched your search

+1 -1
View File
@@ -206,7 +206,7 @@ void AlertReporter::formatAge(unsigned long age_ms, char* out, size_t out_size)
}
void AlertReporter::onLoop(unsigned long now_ms) {
if (!_prefs || !_obs->alert_enabled) return;
if (!_prefs || !_obs || !_obs->alert_enabled) return;
if (!_mesh) return;
// Throttle: ~5 s cadence. The thresholds are minutes-scale so this is fine.