Skip to content

Commit

Permalink
Merge pull request #194 from BCsabaEngine/master
Browse files Browse the repository at this point in the history
Thanks for this!

MESH_CALLBACK and eliminate delay in renewAddress()
  • Loading branch information
TMRh20 authored Jul 21, 2021
2 parents a343ac4 + 804c68f commit aa5422b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion RF24Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,12 @@ uint16_t RF24Mesh::renewAddress(uint32_t timeout)
while (!requestAddress(reqCounter)) {
if (millis() - start > timeout) { return 0; }

delay(50 + ((totalReqs + 1) * (reqCounter + 1)) * 2);
uint32_t timeoutInternal = 50 + ((totalReqs + 1) * (reqCounter + 1)) * 2;
uint32_t startInternal = millis();
while (millis() - startInternal < timeoutInternal) {
MESH_CALLBACK
delay(1);
}
reqCounter++;
reqCounter = reqCounter % 4;
totalReqs++;
Expand Down

0 comments on commit aa5422b

Please sign in to comment.