diff --git a/RF24Mesh.cpp b/RF24Mesh.cpp index 513f84a..d16957e 100644 --- a/RF24Mesh.cpp +++ b/RF24Mesh.cpp @@ -389,7 +389,12 @@ bool RF24Mesh::requestAddress(uint8_t level){ header.type = MESH_ADDR_CONFIRM; while( !network.write(header,0,0) ){ - if(registerAddrCount++ >= 6 ){ return 0; } + if(registerAddrCount++ >= 6 ){ + network.begin(MESH_DEFAULT_ADDRESS); + mesh_address = MESH_DEFAULT_ADDRESS; + return 0; + } + delay(3); } return 1; @@ -416,13 +421,13 @@ void RF24Mesh::setNodeID(uint8_t nodeID){ /*****************************************************/ -void RF24Mesh::setStaticAddress(char nodeID, uint16_t address){ +void RF24Mesh::setStaticAddress(uint8_t nodeID, uint16_t address){ setAddress(nodeID,address); } /*****************************************************/ -void RF24Mesh::setAddress(char nodeID, uint16_t address){ +void RF24Mesh::setAddress(uint8_t nodeID, uint16_t address){ uint8_t position = addrListTop; diff --git a/RF24Mesh.h b/RF24Mesh.h index 5a41f9f..6092c2c 100644 --- a/RF24Mesh.h +++ b/RF24Mesh.h @@ -221,7 +221,7 @@ class RF24Mesh * @param address The octal RF24Network address to assign * @return If the nodeID exists in the list, */ - void setAddress(char nodeID, uint16_t address); + void setAddress(uint8_t nodeID, uint16_t address); void saveDHCP(); void loadDHCP(); @@ -260,7 +260,7 @@ class RF24Mesh /** * Calls setAddress() */ - void setStaticAddress(char nodeID, uint16_t address); + void setStaticAddress(uint8_t nodeID, uint16_t address); private: RF24& radio;