fix(nrf52): keep BLE active during reset cleanup (#10873)
This commit is contained in:
@@ -1696,16 +1696,17 @@ void menuHandler::resetNodeDBMenu()
|
|||||||
bannerOptions.optionsCount = 3;
|
bannerOptions.optionsCount = 3;
|
||||||
bannerOptions.bannerCallback = [](int selected) -> void {
|
bannerOptions.bannerCallback = [](int selected) -> void {
|
||||||
if (selected == 1 || selected == 2) {
|
if (selected == 1 || selected == 2) {
|
||||||
disableBluetooth();
|
|
||||||
screen->setFrames(Screen::FOCUS_DEFAULT);
|
screen->setFrames(Screen::FOCUS_DEFAULT);
|
||||||
}
|
}
|
||||||
if (selected == 1) {
|
if (selected == 1) {
|
||||||
LOG_INFO("Initiate node-db reset");
|
LOG_INFO("Initiate node-db reset");
|
||||||
nodeDB->resetNodes();
|
nodeDB->resetNodes();
|
||||||
|
disableBluetooth();
|
||||||
rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000);
|
rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000);
|
||||||
} else if (selected == 2) {
|
} else if (selected == 2) {
|
||||||
LOG_INFO("Initiate node-db reset but keeping favorites");
|
LOG_INFO("Initiate node-db reset but keeping favorites");
|
||||||
nodeDB->resetNodes(1);
|
nodeDB->resetNodes(1);
|
||||||
|
disableBluetooth();
|
||||||
rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000);
|
rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000);
|
||||||
} else if (selected == 0) {
|
} else if (selected == 0) {
|
||||||
menuQueue = NodeBaseMenu;
|
menuQueue = NodeBaseMenu;
|
||||||
|
|||||||
@@ -418,22 +418,22 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case meshtastic_AdminMessage_factory_reset_config_tag: {
|
case meshtastic_AdminMessage_factory_reset_config_tag: {
|
||||||
disableBluetooth();
|
|
||||||
LOG_INFO("Initiate factory config reset");
|
LOG_INFO("Initiate factory config reset");
|
||||||
|
// Keep BLE active while reset cleanup performs nRF flash operations.
|
||||||
nodeDB->factoryReset();
|
nodeDB->factoryReset();
|
||||||
LOG_INFO("Factory config reset finished, rebooting soon");
|
LOG_INFO("Factory config reset finished, rebooting soon");
|
||||||
|
disableBluetooth();
|
||||||
reboot(DEFAULT_REBOOT_SECONDS);
|
reboot(DEFAULT_REBOOT_SECONDS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case meshtastic_AdminMessage_factory_reset_device_tag: {
|
case meshtastic_AdminMessage_factory_reset_device_tag: {
|
||||||
disableBluetooth();
|
|
||||||
LOG_INFO("Initiate full factory reset");
|
LOG_INFO("Initiate full factory reset");
|
||||||
nodeDB->factoryReset(true);
|
nodeDB->factoryReset(true);
|
||||||
|
disableBluetooth();
|
||||||
reboot(DEFAULT_REBOOT_SECONDS);
|
reboot(DEFAULT_REBOOT_SECONDS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case meshtastic_AdminMessage_nodedb_reset_tag: {
|
case meshtastic_AdminMessage_nodedb_reset_tag: {
|
||||||
disableBluetooth();
|
|
||||||
LOG_INFO("Initiate node-db reset");
|
LOG_INFO("Initiate node-db reset");
|
||||||
// CLIENT_BASE, ROUTER and ROUTER_LATE are able to preserve the remaining hop count when relaying a packet via a
|
// CLIENT_BASE, ROUTER and ROUTER_LATE are able to preserve the remaining hop count when relaying a packet via a
|
||||||
// favorited node, so ensure that their favorites are kept on reset
|
// favorited node, so ensure that their favorites are kept on reset
|
||||||
@@ -441,6 +441,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
isOneOf(config.device.role, meshtastic_Config_DeviceConfig_Role_CLIENT_BASE,
|
isOneOf(config.device.role, meshtastic_Config_DeviceConfig_Role_CLIENT_BASE,
|
||||||
meshtastic_Config_DeviceConfig_Role_ROUTER, meshtastic_Config_DeviceConfig_Role_ROUTER_LATE);
|
meshtastic_Config_DeviceConfig_Role_ROUTER, meshtastic_Config_DeviceConfig_Role_ROUTER_LATE);
|
||||||
nodeDB->resetNodes(rolePreference ? rolePreference : r->nodedb_reset);
|
nodeDB->resetNodes(rolePreference ? rolePreference : r->nodedb_reset);
|
||||||
|
disableBluetooth();
|
||||||
reboot(DEFAULT_REBOOT_SECONDS);
|
reboot(DEFAULT_REBOOT_SECONDS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,9 +117,9 @@ int SystemCommandsModule::handleInputEvent(const InputEvent *event)
|
|||||||
return true;
|
return true;
|
||||||
// factory reset
|
// factory reset
|
||||||
case INPUT_BROKER_FACTORY_RST:
|
case INPUT_BROKER_FACTORY_RST:
|
||||||
disableBluetooth();
|
|
||||||
LOG_INFO("Initiate full factory reset");
|
LOG_INFO("Initiate full factory reset");
|
||||||
nodeDB->factoryReset(true);
|
nodeDB->factoryReset(true);
|
||||||
|
disableBluetooth();
|
||||||
// reboot(DEFAULT_REBOOT_SECONDS);
|
// reboot(DEFAULT_REBOOT_SECONDS);
|
||||||
LOG_INFO("Reboot in %d seconds", DEFAULT_REBOOT_SECONDS);
|
LOG_INFO("Reboot in %d seconds", DEFAULT_REBOOT_SECONDS);
|
||||||
if (screen)
|
if (screen)
|
||||||
|
|||||||
Reference in New Issue
Block a user