Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: LoRaMac.cpp
- Revision:
- 11:2426a05fe29e
- Parent:
- 6:d7a34ded7c87
--- a/LoRaMac.cpp Wed May 18 11:19:24 2016 +0000 +++ b/LoRaMac.cpp Tue Jul 17 22:48:35 2018 +0000 @@ -131,6 +131,8 @@ */ static uint32_t UpLinkCounter = 1; +static bool UpLinkCounterFlag = false; + /*! * LoRaMAC frame counter. Each time a packet is received the counter is incremented. * Only the 16 LSB bits are received @@ -1379,7 +1381,7 @@ } } if( ( LoRaMacFlags.Bits.MlmeReq == 1 ) || ( ( LoRaMacFlags.Bits.McpsReq == 1 ) ) ) - { + { if( ( ChannelsNbRepCounter >= ChannelsNbRep ) || ( LoRaMacFlags.Bits.McpsInd == 1 ) ) { ChannelsNbRepCounter = 0; @@ -1388,6 +1390,7 @@ if( IsUpLinkCounterFixed == false ) { UpLinkCounter++; + UpLinkCounterFlag = true; } LoRaMacState &= ~MAC_TX_RUNNING; @@ -1402,12 +1405,13 @@ } if( LoRaMacFlags.Bits.McpsInd == 1 ) - { + { if( ( McpsConfirm.AckReceived == true ) || ( AckTimeoutRetriesCounter > AckTimeoutRetries ) ) { AckTimeoutRetry = false; NodeAckRequested = false; - if( IsUpLinkCounterFixed == false ) + //if( ( IsUpLinkCounterFixed == false ) ) + if( ( IsUpLinkCounterFixed == false ) && ( UpLinkCounterFlag == false ) ) { UpLinkCounter++; } @@ -1416,6 +1420,8 @@ LoRaMacState &= ~MAC_TX_RUNNING; } } + + UpLinkCounterFlag = false; if( ( AckTimeoutRetry == true ) && ( ( LoRaMacState & MAC_TX_DELAYED ) == 0 ) ) {