diff --git a/library.properties b/library.properties index 09525b64..0ac00bfa 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TheThingsNetwork -version=2.5.2 +version=2.5.3 author=The Things Network maintainer=Johan Stokking sentence=The Things Network Arduino Library. diff --git a/src/TheThingsNetwork.cpp b/src/TheThingsNetwork.cpp index 6fc51c47..cee9e67e 100755 --- a/src/TheThingsNetwork.cpp +++ b/src/TheThingsNetwork.cpp @@ -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);