From 6b1662f60b97becd6dd9f0c6a8f7b56d0f73fe33 Mon Sep 17 00:00:00 2001 From: Clive Blackledge Date: Mon, 13 Oct 2025 16:02:48 -0700 Subject: [PATCH] removing bitfield and making its only entry a flag. (saves 4 bits) --- src/mesh/NodeDB.cpp | 5 +++-- src/mesh/NodeDB.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index fd0fb9f6c..ce89c0148 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -151,7 +151,6 @@ void NodeDB::syncHotFromCold(size_t index) hot.snr = node.snr; hot.channel = node.channel; hot.next_hop = node.next_hop; - hot.bitfield = node.bitfield; hot.role = static_cast(node.user.role); hot.hops_away = node.hops_away; @@ -164,6 +163,8 @@ void NodeDB::syncHotFromCold(size_t index) flags |= HOT_FLAG_IS_IGNORED; if (node.has_hops_away) flags |= HOT_FLAG_HAS_HOPS; + if (node.bitfield & NODEINFO_BITFIELD_IS_KEY_MANUALLY_VERIFIED_MASK) + flags |= HOT_FLAG_IS_KEY_VERIFIED; hot.flags = flags; hotDirty[index] = false; @@ -2309,7 +2310,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n) for (int i = 1; i < numMeshNodes; i++) { const NodeHotEntry &hot = hotNodes[i]; if (!(hot.flags & HOT_FLAG_IS_FAVORITE) && !(hot.flags & HOT_FLAG_IS_IGNORED) && - !(hot.bitfield & NODEINFO_BITFIELD_IS_KEY_MANUALLY_VERIFIED_MASK) && hot.last_heard < oldest) { + !(hot.flags & HOT_FLAG_IS_KEY_VERIFIED) && hot.last_heard < oldest) { oldest = hot.last_heard; oldestIndex = i; } diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index f3042f6cb..fc65b76ac 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -53,7 +53,6 @@ struct NodeHotEntry { uint32_t num = 0; uint32_t last_heard = 0; float snr = 0.0f; - uint32_t bitfield = 0; uint8_t role = meshtastic_Config_DeviceConfig_Role_CLIENT; uint8_t channel = 0; uint8_t next_hop = 0; @@ -392,7 +391,8 @@ class NodeDB HOT_FLAG_VIA_MQTT = 1 << 0, HOT_FLAG_IS_FAVORITE = 1 << 1, HOT_FLAG_IS_IGNORED = 1 << 2, - HOT_FLAG_HAS_HOPS = 1 << 3 + HOT_FLAG_HAS_HOPS = 1 << 3, + HOT_FLAG_IS_KEY_VERIFIED = 1 << 4 }; void initHotCache();