Allow packet and nodenums to be 32 bits long (but don't change yet)

This commit is contained in:
geeksville
2020-06-03 13:46:31 -07:00
parent a34cfb0ee0
commit 5b1488ddf0
6 changed files with 15 additions and 7 deletions

View File

@@ -178,8 +178,10 @@ void NodeDB::init()
*/
void NodeDB::pickNewNodeNum()
{
// FIXME not the right way to guess node numes
uint8_t r = ourMacAddr[5];
// Pick an initial nodenum based on the macaddr
NodeNum r = sizeof(NodeNum) == 1 ? ourMacAddr[5]
: ((ourMacAddr[2] << 24) | (ourMacAddr[3] << 16) | (ourMacAddr[4] << 8) | ourMacAddr[5]);
if (r == 0xff || r < NUM_RESERVED)
r = NUM_RESERVED; // don't pick a reserved node number