Only set NodeNum based on MAC if it's still zero ()

* Only set NodeNum based on MAC if it's still zero

* Already declared
This commit is contained in:
GUVWAF 2024-04-10 18:29:29 +02:00 committed by GitHub
parent fcab20fb3b
commit 3bee6ce9c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -517,11 +517,12 @@ void NodeDB::installDefaultDeviceState()
*/
void NodeDB::pickNewNodeNum()
{
getMacAddr(ourMacAddr); // Make sure ourMacAddr is set
// Pick an initial nodenum based on the macaddr
NodeNum nodeNum = (ourMacAddr[2] << 24) | (ourMacAddr[3] << 16) | (ourMacAddr[4] << 8) | ourMacAddr[5];
NodeNum nodeNum = myNodeInfo.my_node_num;
if (nodeNum == 0) {
getMacAddr(ourMacAddr); // Make sure ourMacAddr is set
// Pick an initial nodenum based on the macaddr
nodeNum = (ourMacAddr[2] << 24) | (ourMacAddr[3] << 16) | (ourMacAddr[4] << 8) | ourMacAddr[5];
}
meshtastic_NodeInfoLite *found;
while ((nodeNum == NODENUM_BROADCAST || nodeNum < NUM_RESERVED) ||