removing bitfield and making its only entry a flag. (saves 4 bits)

This commit is contained in:
Clive Blackledge 2025-10-13 16:02:48 -07:00
parent 825d333ea4
commit 6b1662f60b
2 changed files with 5 additions and 4 deletions

View File

@ -151,7 +151,6 @@ void NodeDB::syncHotFromCold(size_t index)
hot.snr = node.snr; hot.snr = node.snr;
hot.channel = node.channel; hot.channel = node.channel;
hot.next_hop = node.next_hop; hot.next_hop = node.next_hop;
hot.bitfield = node.bitfield;
hot.role = static_cast<uint8_t>(node.user.role); hot.role = static_cast<uint8_t>(node.user.role);
hot.hops_away = node.hops_away; hot.hops_away = node.hops_away;
@ -164,6 +163,8 @@ void NodeDB::syncHotFromCold(size_t index)
flags |= HOT_FLAG_IS_IGNORED; flags |= HOT_FLAG_IS_IGNORED;
if (node.has_hops_away) if (node.has_hops_away)
flags |= HOT_FLAG_HAS_HOPS; flags |= HOT_FLAG_HAS_HOPS;
if (node.bitfield & NODEINFO_BITFIELD_IS_KEY_MANUALLY_VERIFIED_MASK)
flags |= HOT_FLAG_IS_KEY_VERIFIED;
hot.flags = flags; hot.flags = flags;
hotDirty[index] = false; hotDirty[index] = false;
@ -2309,7 +2310,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
for (int i = 1; i < numMeshNodes; i++) { for (int i = 1; i < numMeshNodes; i++) {
const NodeHotEntry &hot = hotNodes[i]; const NodeHotEntry &hot = hotNodes[i];
if (!(hot.flags & HOT_FLAG_IS_FAVORITE) && !(hot.flags & HOT_FLAG_IS_IGNORED) && 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; oldest = hot.last_heard;
oldestIndex = i; oldestIndex = i;
} }

View File

@ -53,7 +53,6 @@ struct NodeHotEntry {
uint32_t num = 0; uint32_t num = 0;
uint32_t last_heard = 0; uint32_t last_heard = 0;
float snr = 0.0f; float snr = 0.0f;
uint32_t bitfield = 0;
uint8_t role = meshtastic_Config_DeviceConfig_Role_CLIENT; uint8_t role = meshtastic_Config_DeviceConfig_Role_CLIENT;
uint8_t channel = 0; uint8_t channel = 0;
uint8_t next_hop = 0; uint8_t next_hop = 0;
@ -392,7 +391,8 @@ class NodeDB
HOT_FLAG_VIA_MQTT = 1 << 0, HOT_FLAG_VIA_MQTT = 1 << 0,
HOT_FLAG_IS_FAVORITE = 1 << 1, HOT_FLAG_IS_FAVORITE = 1 << 1,
HOT_FLAG_IS_IGNORED = 1 << 2, 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(); void initHotCache();