Skip to content

Commit

Permalink
Keep the Join counter at 0 when the first fails
Browse files Browse the repository at this point in the history
When we fail to send the very first OTAA Join, the Join retransmission
logic must not set joins_left to a non-zero value. Otherwise, all future
joins would fail since the variable would never be reset to zero.

Closes #92
  • Loading branch information
janakj committed Aug 7, 2022
1 parent e7a6283 commit 659f703
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lrw.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,9 @@ int lrw_join(uint8_t datarate, uint8_t tries)
#ifdef RESTORE_CHMASK_AFTER_JOIN
save_chmask();
#endif
joins_left = tries;
return send_join();
LoRaMacStatus_t rc = send_join();
if (rc == LORAMAC_STATUS_OK) joins_left = tries;
return rc;
}
}

Expand Down

0 comments on commit 659f703

Please sign in to comment.