mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-16 07:42:37 +00:00
Persist favourites on NodeDB reset (#8292)
* Conditionally delete favourited nodes on reset * trunk fmt * Fix equality check, use existing macro for role validation * Extend favourite persistence setting to devices of all roles * Refactor: Decoupled role/config check and set role defaults appropriately * Use American-English spelling * Use existing reference * Convert reset to bool, regen protos * Add optional arg to nodedb_reset in favor of additional device setting * Use correct proto commit ID * Regen protos * Log preservation status * Pull latest from master
This commit is contained in:
@@ -289,7 +289,12 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
case meshtastic_AdminMessage_nodedb_reset_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Initiate node-db reset");
|
||||
nodeDB->resetNodes();
|
||||
// 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
|
||||
bool rolePreference =
|
||||
isOneOf(config.device.role, meshtastic_Config_DeviceConfig_Role_CLIENT_BASE,
|
||||
meshtastic_Config_DeviceConfig_Role_ROUTER, meshtastic_Config_DeviceConfig_Role_ROUTER_LATE);
|
||||
nodeDB->resetNodes(rolePreference ? rolePreference : r->nodedb_reset);
|
||||
reboot(DEFAULT_REBOOT_SECONDS);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user