mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 06:32:06 +00:00
Don't ever delete own node from DB (#3122)
This commit is contained in:
parent
6b5101ec67
commit
4ae5443c3b
@ -879,10 +879,11 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
|
|||||||
if ((*numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < meshtastic_NodeInfoLite_size * 3)) {
|
if ((*numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < meshtastic_NodeInfoLite_size * 3)) {
|
||||||
if (screen)
|
if (screen)
|
||||||
screen->print("warning: node_db_lite full! erasing oldest entry\n");
|
screen->print("warning: node_db_lite full! erasing oldest entry\n");
|
||||||
|
LOG_INFO("warning: node_db_lite full! erasing oldest entry\n");
|
||||||
// look for oldest node and erase it
|
// look for oldest node and erase it
|
||||||
uint32_t oldest = UINT32_MAX;
|
uint32_t oldest = UINT32_MAX;
|
||||||
int oldestIndex = -1;
|
int oldestIndex = -1;
|
||||||
for (int i = 0; i < *numMeshNodes; i++) {
|
for (int i = 1; i < *numMeshNodes; i++) {
|
||||||
if (meshNodes[i].last_heard < oldest) {
|
if (meshNodes[i].last_heard < oldest) {
|
||||||
oldest = meshNodes[i].last_heard;
|
oldest = meshNodes[i].last_heard;
|
||||||
oldestIndex = i;
|
oldestIndex = i;
|
||||||
@ -926,4 +927,4 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
|
|||||||
LOG_ERROR("A critical failure occurred, portduino is exiting...");
|
LOG_ERROR("A critical failure occurred, portduino is exiting...");
|
||||||
exit(2);
|
exit(2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
@ -204,6 +204,8 @@ int32_t PositionModule::runOnce()
|
|||||||
}
|
}
|
||||||
|
|
||||||
meshtastic_NodeInfoLite *node = nodeDB.getMeshNode(nodeDB.getNodeNum());
|
meshtastic_NodeInfoLite *node = nodeDB.getMeshNode(nodeDB.getNodeNum());
|
||||||
|
if (node == nullptr)
|
||||||
|
return RUNONCE_INTERVAL;
|
||||||
|
|
||||||
// We limit our GPS broadcasts to a max rate
|
// We limit our GPS broadcasts to a max rate
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
|
Loading…
Reference in New Issue
Block a user