Skip to content

Commit

Permalink
Merge pull request #207 from TheThingsNetwork/fix/infinite-join
Browse files Browse the repository at this point in the history
Fix infinite join retry
  • Loading branch information
johanstokking authored Jun 7, 2017
2 parents e02f33b + fa757ac commit dedd359
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=TheThingsNetwork
version=2.5.2
version=2.5.3
author=The Things Network
maintainer=Johan Stokking <[email protected]>
sentence=The Things Network Arduino Library.
Expand Down
4 changes: 3 additions & 1 deletion src/TheThingsNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,12 @@ bool TheThingsNetwork::provision(const char *appEui, const char *appKey)

bool TheThingsNetwork::join(int8_t retries, uint32_t retryDelay)
{
int8_t attempts = 0;
configureChannels(fsb);
setSF(sf);
while (retries == -1 || retries-- >= 0)
while (retries == -1 || attempts <= retries)
{
attempts++;
if (!sendJoinSet(MAC_JOIN_MODE_OTAA))
{
debugPrintMessage(ERR_MESSAGE, ERR_JOIN_FAILED);
Expand Down

0 comments on commit dedd359

Please sign in to comment.