Skip to content

Config serializer - #2982

Merged
ripplebiz merged 9 commits into
devfrom
config-serializer
Jul 27, 2026
Merged

Config serializer#2982
ripplebiz merged 9 commits into
devfrom
config-serializer

Conversation

@ripplebiz

Copy link
Copy Markdown
Member

config for Companion, Repeater and Room server migrated to a simple JSON representation.

To keep the impact minimal, the same member variable access is used by modules using the prefs structures. Just the storage is affected at this stage.

The prefs now group related properties into sub objects: "gps", "radio", "bridge", "power"
Prefs related to repeating packets are in "repeat" sub object
Room server related in "room"
Companion related prefs in "comp"

Some common top-level properties are: "name", "lat", "lon"

A subsequent step/PR could be to refactor all the accesses of prefs, making a new common prefs classes with common components, lie gps, radio, etc

The new ConfigSerializer class makes declaring the JSON structures simple. It can handle the various scalar values, like integers, can handle C string values, and even nested objects. It cannot do JSON arrays, tho

@ripplebiz
ripplebiz merged commit c86e63d into dev Jul 27, 2026
15 checks passed
agessaman added a commit to agessaman/MeshCore that referenced this pull request Jul 30, 2026
Absorbs 106 upstream commits. Seven files conflicted; the substantive one
was upstream's new JSON ConfigSerializer (PR meshcore-dev#2982), which replaces the
binary /com_prefs layout with /prefs.json and makes NodePrefs a
ConfigSerializer subclass.

Prefs migration
- Adopt upstream's ConfigSerializer. writeCommonPrefsImage() and its
  documented offsets (0-294) are deleted, along with the now-unreachable
  saveCommonPrefsImageAtomically()/CommonPrefsFileStore atomic rename path.
- Load order is /prefs.json, then /com_prefs, then /node_prefs. Upstream
  dropped the /node_prefs fallback; it is restored here so devices that
  never advanced past that filename keep their config.
- Legacy files are never removed, so migration cannot destroy its own
  source and a deferred or failed save simply retries next boot.
- /com_prefs is treated as a format migration only, not an "upgrade", so
  it does not trip the bridge.source tx->rx flip on existing nodes.
- The MQTTPrefsAtomicStore legacy gate is retained: the observer tail
  recovered from an old-format file still commits to /mqtt_prefs before
  /prefs.json is written.
- MQTTPrefs and /mqtt_prefs are untouched; savePrefs keeps its save_mqtt
  parameter and now returns upstream's bool.

Fixes to upstream code
- RadioPrefs::structure() bound both "rxgain" and "fem_rxgain" to
  rx_boosted_gain, so radio_fem_rxgain was never persisted. Bound to the
  correct field.
- discovery_mod_timestamp was dropped from structure(); it gates
  'since'-filtered DISCOVER replies and is set on every config change, so
  losing it would silently stop discovery responses after a reboot. Added
  as "disc_mod".

Merge artifacts repaired
- Restored bblanchon/ArduinoJson to the native test env; a clean but wrong
  auto-merge at the lib_deps block boundary dropped it and broke all 19
  host test suites.
- Migrated the fork's WebConfig UITask screens off the removed
  DisplayDriver::Color enum to upstream's UIColor element types.
- Removed duplicate getCADEnabled() definitions in companion MyMesh.cpp
  and simple_sensor SensorMesh.cpp that both sides had added.
- Dropped memset(&_prefs, 0, ...) in the four example meshes; NodePrefs now
  has a vtable. guard gains an initializer that memset used to provide.

Other resolutions
- simple_room_server keeps both the fork's discover.* commands and
  upstream's new room.post.
- docs/payloads.md taken from upstream, undoing content earlier merges had
  reverted (Control data section, split login tables).

Verified: 273/273 host tests pass across native and native_kiss_modem;
Heltec v3 repeater, repeater_observer_mqtt, room_server_observer_mqtt,
sensor, and companion_radio_ble all build clean.
dl9sau pushed a commit to dl9sau/MeshCore-fork-DL9SAU that referenced this pull request Aug 10, 2026
…er adoptiert)

Merge companion-v1.17.0 in den DL9SAU-Fork. Core-Protokoll 0-Diff (kein Wire-Bruch).

Config (Weg B -- binaer behalten, JSON meshcore-dev#2982 NICHT adoptiert):
- NodePrefs.h / DataStore.{cpp,h} / MyMesh.h savePrefs auf --ours (2-arg, unser
  feldweises Binaerformat). ConfigSerializer.* liegt ungenutzt (nur native-Test).
  Bestandsgeraete: null Migration (/new_prefs binaer weiter).
- MyMesh.cpp: unsere Logik (client_repeat statt isRepeatEn/setRepeatEn, memset+
  Sentinels, cad_enabled, 2-arg loadPrefs). Upstreams MCU-Temperatur-Telemetrie
  (onContactRequest + handleCmdFrame) BEHALTEN.

Adoptiert:
- interface_manager (MultiSerialInterface, multi-interface: USB-CLI + BLE-App
  gleichzeitig). main.cpp setup()/loop() rekonstruiert mit unseren Boot-Anpassungen
  (DIAG / earlyShutdownCheck / OTA-Skip / configureBatteryWake +
  applyShutdownPendingCheck NACH BLE = SoftDevice-up).
- esp32 SerialBLEInterface: FreeRTOS thread-safe recv-Queue (meshcore-dev#3007) + unsere
  Diagnostik/Overflow-Counter + FRAME_QUEUE_SIZE 16.
- USE_CC310_HW_CRYPTO (meshcore-dev#2824), listen-before-talk configSideDetectors (meshcore-dev#3036/meshcore-dev#2977).

Auto-Merge-Fixes (Upstream-Refactors trafen unsere Andock-Zeilen):
- AbstractUITask _serial -> _interfaceManager (ui-orig / ui-tiny).
- DisplayDriver enum Color -> UIColor-Klasse (meshcore-dev#3034): YELLOW -> warning_txt (ui-new).

CI: action.yml unsere -DL9SAU-Prefix-Strip + upstream dispatch-branch; build.sh
unser Build-Tracking (kein set -e) + upstream Matrix-get-*-firmwares-Commands.

FIRMWARE_VERSION -> v1.17.0-DL9SAU (dl9sau_version.py-Sync beim Release).

Builds gruen: t1000e_companion_radio_ble (nRF52), Heltec_v3_companion_radio_ble (esp32).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
alustenberg added a commit to alustenberg/MeshCore that referenced this pull request Aug 11, 2026
…-serializer"

This reverts commit c86e63d, reversing
changes made to 301bc10.
@liamcottle
liamcottle deleted the config-serializer branch August 19, 2026 07:24
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