Always set user (nodeinfo) role to device config's current role (#2973)

This commit is contained in:
Ben Meadors
2023-12-01 07:00:19 -06:00
committed by GitHub
parent fb89482129
commit def4ec5822
4 changed files with 15 additions and 9 deletions

View File

@@ -370,7 +370,6 @@ void NodeDB::installDefaultDeviceState()
pickNewNodeNum(); // based on macaddr now
snprintf(owner.long_name, sizeof(owner.long_name), "Meshtastic %02x%02x", ourMacAddr[4], ourMacAddr[5]);
snprintf(owner.short_name, sizeof(owner.short_name), "%02x%02x", ourMacAddr[4], ourMacAddr[5]);
snprintf(owner.id, sizeof(owner.id), "!%08x", getNodeNum()); // Default node ID now based on nodenum
memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr));
}
@@ -395,6 +394,8 @@ void NodeDB::init()
// Set our board type so we can share it with others
owner.hw_model = HW_VENDOR;
// Ensure user (nodeinfo) role is set to whatever we're configured to
owner.role = config.device.role;
// Include our owner in the node db under our nodenum
meshtastic_NodeInfoLite *info = getOrCreateMeshNode(getNodeNum());