cherry-pick: device-ui persistency (#5570)
* device-ui persistency * review update --------- Co-authored-by: mverch67 <manuel.verch@gmx.de>
This commit is contained in:
@@ -57,6 +57,7 @@ NodeDB *nodeDB = nullptr;
|
||||
EXT_RAM_BSS_ATTR meshtastic_DeviceState devicestate;
|
||||
meshtastic_MyNodeInfo &myNodeInfo = devicestate.my_node;
|
||||
meshtastic_LocalConfig config;
|
||||
meshtastic_DeviceUIConfig uiconfig{.screen_brightness = 153, .screen_timeout = 30};
|
||||
meshtastic_LocalModuleConfig moduleConfig;
|
||||
meshtastic_ChannelFile channelFile;
|
||||
|
||||
@@ -895,6 +896,7 @@ void NodeDB::pickNewNodeNum()
|
||||
|
||||
static const char *prefFileName = "/prefs/db.proto";
|
||||
static const char *configFileName = "/prefs/config.proto";
|
||||
static const char *uiconfigFileName = "/prefs/uiconfig.proto";
|
||||
static const char *moduleConfigFileName = "/prefs/module.proto";
|
||||
static const char *channelFileName = "/prefs/channels.proto";
|
||||
|
||||
@@ -1054,6 +1056,12 @@ void NodeDB::loadFromDisk()
|
||||
}
|
||||
}
|
||||
|
||||
state = loadProto(uiconfigFileName, meshtastic_DeviceUIConfig_size, sizeof(meshtastic_DeviceUIConfig),
|
||||
&meshtastic_DeviceUIConfig_msg, &uiconfig);
|
||||
if (state == LoadFileResult::LOAD_SUCCESS) {
|
||||
LOG_INFO("Loaded UIConfig\n");
|
||||
}
|
||||
|
||||
// 2.4.X - configuration migration to update new default intervals
|
||||
if (moduleConfig.version < 23) {
|
||||
LOG_DEBUG("ModuleConfig version %d is stale, upgrading to new default intervals", moduleConfig.version);
|
||||
|
||||
Reference in New Issue
Block a user