* new DynamicConfigSerializer

* board/variant KeyValueStore now can write to 'custom' object in Json prefs
This commit is contained in:
Scott Powell
2026-08-24 17:12:56 +10:00
parent a1cf5bd806
commit 5a162ff4c6
11 changed files with 139 additions and 20 deletions
+1 -1
View File
@@ -990,7 +990,7 @@ void MyMesh::begin(bool has_display) {
radio_driver.setTxPower(_prefs.tx_power_dbm);
radio_driver.setRxBoostedGainMode(_prefs.rx_boosted_gain);
board.attachDynamicPrefs(_prefs.getRadioPrefs());
board.attachDynamicPrefs(_prefs.getCustom());
MESH_DEBUG_PRINTLN("RX Boosted Gain Mode: %s",
radio_driver.getRxBoostedGainMode() ? "Enabled" : "Disabled");
+7 -1
View File
@@ -2,6 +2,7 @@
#include <cstdint> // For uint8_t, uint32_t
#include <helpers/ConfigSerializer.h>
#include <helpers/CommonRadioPrefs.h>
#include <helpers/DynamicConfigSerializer.h>
#define TELEM_MODE_DENY 0
#define TELEM_MODE_ALLOW_FLAGS 1 // use contact.flags
@@ -154,6 +155,8 @@ private:
};
CompanionPrefs companion;
DynamicConfigSerializer custom;
protected:
void structure() override {
def("name", node_name, sizeof(node_name));
@@ -165,9 +168,10 @@ protected:
def("gps", gps);
def("repeat", repeat);
def("comp", companion);
def("custom", custom);
}
public:
NodePrefs() : radio(this), gps(this), companion(this) {
NodePrefs() : radio(this), gps(this), companion(this), custom(&radio) {
node_name[0] = 0;
default_scope_name[0] = 0;
memset(default_scope_key, 0, sizeof(default_scope_key));
@@ -177,6 +181,8 @@ public:
void setRepeatEn(bool en) { repeat.disable_fwd = en ? 0 : 1; }
CommonRadioPrefs* getRadioPrefs() { return &radio; }
KeyValueStore* getCustom() { return &custom; }
bool isDirty() const override { return ConfigSerializer::isDirty() || radio.isDirty(); }
void clearDirty() override { ConfigSerializer::clearDirty(); radio.clearDirty(); }
};
+1 -1
View File
@@ -983,7 +983,7 @@ void MyMesh::begin(FILESYSTEM *fs) {
MESH_DEBUG_PRINTLN("RX Boosted Gain Mode: %s",
radio_driver.getRxBoostedGainMode() ? "Enabled" : "Disabled");
board.attachDynamicPrefs(_prefs.getRadioPrefs());
board.attachDynamicPrefs(_prefs.getCustom());
updateAdvertTimer();
updateFloodAdvertTimer();
+1 -1
View File
@@ -726,7 +726,7 @@ void MyMesh::begin(FILESYSTEM *fs) {
radio_driver.setTxPower(_prefs.tx_power_dbm);
radio_driver.setRxBoostedGainMode(_prefs.rx_boosted_gain);
board.attachDynamicPrefs(_prefs.getRadioPrefs());
board.attachDynamicPrefs(_prefs.getCustom());
updateAdvertTimer();
updateFloodAdvertTimer();
+1 -1
View File
@@ -772,7 +772,7 @@ void SensorMesh::begin(FILESYSTEM* fs) {
radio_driver.setParams(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
radio_driver.setTxPower(_prefs.tx_power_dbm);
board.attachDynamicPrefs(_prefs.getRadioPrefs());
board.attachDynamicPrefs(_prefs.getCustom());
updateAdvertTimer();
updateFloodAdvertTimer();