This commit is contained in:
Ben Meadors
2025-03-16 08:19:17 -05:00
parent 1640fb105d
commit dc100e4d3e
10 changed files with 61 additions and 51 deletions

View File

@@ -400,18 +400,12 @@ bool isBroadcast(uint32_t dest)
return dest == NODENUM_BROADCAST || dest == NODENUM_BROADCAST_NO_LORA;
}
bool NodeDB::resetRadioConfig(bool factory_reset, bool is_fresh_install)
void NodeDB::resetRadioConfig(bool is_fresh_install)
{
bool didFactoryReset = false;
if (is_fresh_install) {
radioGeneration++;
}
if (factory_reset) {
didFactoryReset = factoryReset();
}
if (channelFile.channels_count != MAX_NUM_CHANNELS) {
LOG_INFO("Set default channel and radio preferences!");
@@ -422,14 +416,6 @@ bool NodeDB::resetRadioConfig(bool factory_reset, bool is_fresh_install)
// Update the global myRegion
initRegion();
if (didFactoryReset) {
LOG_INFO("Reboot due to factory reset");
screen->startAlert("Rebooting...");
rebootAtMsec = millis() + (5 * 1000);
}
return didFactoryReset;
}
bool NodeDB::factoryReset(bool eraseBleBonds)
@@ -591,7 +577,7 @@ void NodeDB::installDefaultConfig(bool preserveKey = false)
config.device.node_info_broadcast_secs = default_node_info_broadcast_secs;
config.security.serial_enabled = true;
config.security.admin_channel_enabled = false;
resetRadioConfig(false, true); // This also triggers NodeInfo/Position requests since we're fresh
resetRadioConfig(true); // This also triggers NodeInfo/Position requests since we're fresh
strncpy(config.network.ntp_server, "meshtastic.pool.ntp.org", 32);
#if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3) || defined(SENSECAP_INDICATOR)) && \