Skip to content

Commit dedd359

Browse files
Merge pull request #207 from TheThingsNetwork/fix/infinite-join
Fix infinite join retry
2 parents e02f33b + fa757ac commit dedd359

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=TheThingsNetwork
2-
version=2.5.2
2+
version=2.5.3
33
author=The Things Network
44
maintainer=Johan Stokking <johan@thethingsnetwork.org>
55
sentence=The Things Network Arduino Library.

src/TheThingsNetwork.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,12 @@ bool TheThingsNetwork::provision(const char *appEui, const char *appKey)
499499

500500
bool TheThingsNetwork::join(int8_t retries, uint32_t retryDelay)
501501
{
502+
int8_t attempts = 0;
502503
configureChannels(fsb);
503504
setSF(sf);
504-
while (retries == -1 || retries-- >= 0)
505+
while (retries == -1 || attempts <= retries)
505506
{
507+
attempts++;
506508
if (!sendJoinSet(MAC_JOIN_MODE_OTAA))
507509
{
508510
debugPrintMessage(ERR_MESSAGE, ERR_JOIN_FAILED);

0 commit comments

Comments
 (0)