Skip to content

Commit

Permalink
Fix for address renewal confirmation
Browse files Browse the repository at this point in the history
Found address confirmations missing occasionally. Store the last
assignment and accept confirmations during normal mesh.update() function
- Increase default wait time for address confirmation to defined network
routeTimeout
  • Loading branch information
TMRh20 committed Mar 24, 2016
1 parent a58a257 commit adabf7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions RF24Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ uint8_t RF24Mesh::update(){
addrList[i].address = 0;
}
}
}
}else
if(type == MESH_ADDR_CONFIRM){
RF24NetworkHeader& header = *(RF24NetworkHeader*)network.frame_buffer;
if(header.from_node == lastAddress){
setAddress(lastID,lastAddress);
}
}

#endif
return type;
}
Expand Down Expand Up @@ -605,9 +612,10 @@ void RF24Mesh::DHCP(){
//addrMap[from_id] = newAddress;
}
uint32_t timer=millis();
lastAddress = newAddress;
lastID = from_id;
while(network.update() != MESH_ADDR_CONFIRM){
if(millis()-timer>45){
//printf("No addr confirmation from 0%o\n",header.to_node);
if(millis()-timer > network.routeTimeout){
return;
}

Expand Down
2 changes: 1 addition & 1 deletion RF24Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class RF24Mesh
uint32_t lastSaveTime;
uint32_t lastFileSave;
uint8_t radio_channel;

uint16_t lastID,lastAddress;

};

Expand Down

0 comments on commit adabf7d

Please sign in to comment.