Move reboot

This commit is contained in:
Ben Meadors 2025-02-27 06:41:09 -06:00
parent 51dc2da83c
commit 96663218ee
2 changed files with 5 additions and 4 deletions

View File

@ -1675,11 +1675,10 @@ bool NodeDB::restorePreferences(meshtastic_AdminMessage_BackupLocation location,
}
success = saveToDisk(restoreWhat);
if (!success) {
LOG_ERROR("Failed to save restored preferences to flash");
if (success) {
LOG_INFO("Restored preferences from backup");
} else {
LOG_INFO("Restored preferences from backup... Rebooting");
rebootAtMsec = millis() + 1000;
LOG_ERROR("Failed to save restored preferences to flash");
}
} else {
LOG_ERROR("Failed to restore preferences from backup file");

View File

@ -387,7 +387,9 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
if (nodeDB->restorePreferences(r->backup_preferences,
SEGMENT_DEVICESTATE | SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_CHANNELS)) {
myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp);
LOG_DEBUG("Rebooting after successful restore of preferences");
disableBluetooth();
reboot(1000);
} else {
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
}