Skip to content

fix(cli): persist mqtt.config, mqtt.filter.interval and slot extras - #26

Merged
Elektr0Vodka merged 1 commit into
dmc-observer-devfrom
fix/dmc-observer-dev-mqtt-prefs-persist
Oct 19, 2026
Merged

Elektr0Vodka merged 1 commit into
dmc-observer-devfrom
fix/dmc-observer-dev-mqtt-prefs-persist

Conversation

@Elektr0Vodka

Copy link
Copy Markdown

What was wrong

set mqtt.config, set mqtt.filter.interval and set mqttN.extras replied OK and took effect, but were lost on the next reboot.

These three DMC setters change MQTTPrefs but saved with plain savePrefs(). Since agessaman's 75f3e44, savePrefs() only writes /prefs.json (save_mqtt defaults to false), so /mqtt.json was never written. The failure path also skipped the observer rollback.

The setters were written (Aug 21–29) while savePrefs() still saved both files. The catch-up that brought in 75f3e44 merged without a conflict, so nothing flagged it.

Fix

All three now use persistObserverPrefs(reply), like every other observer setter. The value is written to /mqtt.json, and if the write fails the change is rolled back and an error is returned. ota branch keeps savePrefs(), because it writes NodePrefs.

Test

  • pio run -e heltec_v4_repeater_observer_mqtt builds.
  • No native test covers CommonCLI_Observer.cpp, so this is not unit-tested. To check on a device: set mqtt.config on, reboot, then get mqtt.config should still say on.

Notes

Found during the 2026-10-19 architecture review (side finding 1).

🤖 Generated with Claude Code

These three DMC setters change MQTTPrefs but saved with plain savePrefs().
Since 75f3e44 that only writes /prefs.json (save_mqtt defaults to false),
so the change replied OK, applied until reboot, and was then lost. The
failure path also skipped the observer rollback.

They now use persistObserverPrefs(reply), like every other observer
setter: written to /mqtt.json, rolled back with an error if the write
fails.

The setters were written while savePrefs() still saved both files; the
catch-up that brought in 75f3e44 merged without a conflict.

Verified: heltec_v4_repeater_observer_mqtt builds. No native test covers
CommonCLI_Observer.cpp.
@Elektr0Vodka
Elektr0Vodka merged commit 39a8b11 into dmc-observer-dev Oct 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant