Skip to content

Commit

Permalink
Merge branch 'meshtastic:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Mictronics authored Jan 23, 2024
2 parents 8fb73cd + 4ae5443 commit c7a1523
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,10 +879,11 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
if ((*numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < meshtastic_NodeInfoLite_size * 3)) {
if (screen)
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
uint32_t oldest = UINT32_MAX;
int oldestIndex = -1;
for (int i = 0; i < *numMeshNodes; i++) {
for (int i = 1; i < *numMeshNodes; i++) {
if (meshNodes[i].last_heard < oldest) {
oldest = meshNodes[i].last_heard;
oldestIndex = i;
Expand Down Expand Up @@ -926,4 +927,4 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
LOG_ERROR("A critical failure occurred, portduino is exiting...");
exit(2);
#endif
}
}
2 changes: 2 additions & 0 deletions src/modules/PositionModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ int32_t PositionModule::runOnce()
}

meshtastic_NodeInfoLite *node = nodeDB.getMeshNode(nodeDB.getNodeNum());
if (node == nullptr)
return RUNONCE_INTERVAL;

// We limit our GPS broadcasts to a max rate
uint32_t now = millis();
Expand Down

0 comments on commit c7a1523

Please sign in to comment.