Skip to content

Commit

Permalink
Skip favorite nodes when clearing out oldest in NodeDB (#3464)
Browse files Browse the repository at this point in the history
* Skip favorite nodes when clearing out oldest in NodeDB

* We should actually map between the types
  • Loading branch information
thebentern committed Mar 22, 2024
1 parent a57f773 commit 7aa013a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
uint32_t oldest = UINT32_MAX;
int oldestIndex = -1;
for (int i = 1; i < numMeshNodes; i++) {
if (meshNodes->at(i).last_heard < oldest) {
if (!meshNodes->at(i).is_favorite && meshNodes->at(i).last_heard < oldest) {
oldest = meshNodes->at(i).last_heard;
oldestIndex = i;
}
Expand Down
1 change: 1 addition & 0 deletions src/mesh/TypeConversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ meshtastic_NodeInfo TypeConversions::ConvertToNodeInfo(const meshtastic_NodeInfo
info.channel = lite->channel;
info.via_mqtt = lite->via_mqtt;
info.hops_away = lite->hops_away;
info.is_favorite = lite->is_favorite;

if (lite->has_position) {
info.has_position = true;
Expand Down

0 comments on commit 7aa013a

Please sign in to comment.