mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 14:42:05 +00:00
Reset nodedb wiring (#1724)
This commit is contained in:
parent
ab4b3a50ee
commit
ac235bcabb
@ -225,12 +225,19 @@ void NodeDB::installDefaultChannels()
|
|||||||
channelFile.version = DEVICESTATE_CUR_VER;
|
channelFile.version = DEVICESTATE_CUR_VER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeDB::resetNodes()
|
||||||
|
{
|
||||||
|
devicestate.node_db_count = 0;
|
||||||
|
memset(devicestate.node_db, 0, sizeof(devicestate.node_db));
|
||||||
|
saveDeviceStateToDisk();
|
||||||
|
}
|
||||||
|
|
||||||
void NodeDB::installDefaultDeviceState()
|
void NodeDB::installDefaultDeviceState()
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Installing default DeviceState\n");
|
DEBUG_MSG("Installing default DeviceState\n");
|
||||||
memset(&devicestate, 0, sizeof(DeviceState));
|
memset(&devicestate, 0, sizeof(DeviceState));
|
||||||
|
|
||||||
*numNodes = 0; // Forget node DB
|
*numNodes = 0;
|
||||||
|
|
||||||
// init our devicestate with valid flags so protobuf writing/reading will work
|
// init our devicestate with valid flags so protobuf writing/reading will work
|
||||||
devicestate.has_my_node = true;
|
devicestate.has_my_node = true;
|
||||||
|
@ -115,7 +115,7 @@ class NodeDB
|
|||||||
/// Return the number of nodes we've heard from recently (within the last 2 hrs?)
|
/// Return the number of nodes we've heard from recently (within the last 2 hrs?)
|
||||||
size_t getNumOnlineNodes();
|
size_t getNumOnlineNodes();
|
||||||
|
|
||||||
void initConfigIntervals(), initModuleConfigIntervals();
|
void initConfigIntervals(), initModuleConfigIntervals(), resetNodes();
|
||||||
|
|
||||||
bool factoryReset();
|
bool factoryReset();
|
||||||
|
|
||||||
|
@ -120,6 +120,12 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
|||||||
rebootAtMsec = millis() + (5 * 1000);
|
rebootAtMsec = millis() + (5 * 1000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AdminMessage_nodedb_reset_tag: {
|
||||||
|
DEBUG_MSG("Initiating node-db reset\n");
|
||||||
|
nodeDB.resetNodes();
|
||||||
|
rebootAtMsec = millis() + (5 * 1000);
|
||||||
|
break;
|
||||||
|
}
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
case AdminMessage_exit_simulator_tag:
|
case AdminMessage_exit_simulator_tag:
|
||||||
DEBUG_MSG("Exiting simulator\n");
|
DEBUG_MSG("Exiting simulator\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user