Permalink
Browse files

update bugfix

  • Loading branch information...
gioblu committed Apr 23, 2016
1 parent 082853f commit e75689e87718492c45b064b7239778e68e497f63
Showing with 8 additions and 4 deletions.
  1. +8 −4 PJON.cpp
@@ -310,10 +310,12 @@ uint16_t PJON::send(uint8_t id, char *packet, uint8_t length, uint32_t timing) {
void PJON::update() {
for(uint8_t i = 0; i < MAX_PACKETS; i++) {
if(packets[i].state != NULL)
if(micros() - packets[i].registration > packets[i].timing + pow(packets[i].attempts, 3))
packets[i].state = send_string(packets[i].device_id, packets[i].content, packets[i].length);
else continue;
if(packets[i].state == NULL) return;
if(micros() - packets[i].registration > packets[i].timing + pow(packets[i].attempts, 3))
packets[i].state = send_string(packets[i].device_id, packets[i].content, packets[i].length);
else continue;
if(packets[i].state == ACK) {
if(!packets[i].timing)
@@ -324,6 +326,7 @@ void PJON::update() {
packets[i].state = TO_BE_SENT;
}
}
if(packets[i].state == FAIL) {
packets[i].attempts++;
@@ -343,6 +346,7 @@ void PJON::update() {
}
}
}
}
}

0 comments on commit e75689e

Please sign in to comment.