Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to new defaults #4294

Merged
merged 6 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,26 @@ void NodeDB::loadFromDisk()
if (state == LoadFileResult::SUCCESS) {
LOG_INFO("Loaded OEMStore\n");
}

// 2.4.X - configuration migration to update new default intervals
if (moduleConfig.version < DEVICESTATE_CUR_VER) {
thebentern marked this conversation as resolved.
Show resolved Hide resolved
LOG_DEBUG("ModuleConfig version %d is stale, upgrading to new default intervals\n", moduleConfig.version);
moduleConfig.version = DEVICESTATE_CUR_VER;
if (moduleConfig.telemetry.device_update_interval == 900)
moduleConfig.telemetry.device_update_interval = 0;
if (moduleConfig.telemetry.environment_update_interval == 900)
moduleConfig.telemetry.environment_update_interval = 0;
if (moduleConfig.telemetry.air_quality_interval == 900)
moduleConfig.telemetry.air_quality_interval = 0;
if (moduleConfig.telemetry.power_update_interval == 900)
moduleConfig.telemetry.power_update_interval = 0;
if (moduleConfig.neighbor_info.update_interval == 900)
moduleConfig.neighbor_info.update_interval = 0;
if (moduleConfig.paxcounter.paxcounter_update_interval == 900)
moduleConfig.paxcounter.paxcounter_update_interval = 0;

saveToDisk(SEGMENT_MODULECONFIG);
}
}

/** Save a protobuf from a file, return true for success */
Expand Down
4 changes: 2 additions & 2 deletions src/mesh/NodeDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ DeviceState versions used to be defined in the .proto file but really only this
#define SEGMENT_DEVICESTATE 4
#define SEGMENT_CHANNELS 8

#define DEVICESTATE_CUR_VER 22
#define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER
#define DEVICESTATE_CUR_VER 23
#define DEVICESTATE_MIN_VER 22

extern meshtastic_DeviceState devicestate;
extern meshtastic_ChannelFile channelFile;
Expand Down
Loading