Skip to content

Commit 8eb8d9b

Browse files
author
Daniel Jäckle
committed
Issue(#74): Drop frames with a downlink counter difference greater or equal to MAX_FCNT_GAP.
1 parent e3de8d4 commit 8eb8d9b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/mac/LoRaMac.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ static ChannelParams_t Channels[LORA_MAX_NB_CHANNELS];
369369
* Contains the channels which remain to be applied.
370370
*/
371371
static uint16_t ChannelsMaskRemaining[6];
372-
373372
#else
374373
#error "Please define a frequency band in the compiler options."
375374
#endif
@@ -1102,6 +1101,15 @@ static void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t
11021101
}
11031102
}
11041103

1104+
// Check for a the maximum allowed counter difference
1105+
if( sequenceCounterDiff >= MAX_FCNT_GAP )
1106+
{
1107+
McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOSS;
1108+
McpsIndication.DownLinkCounter = downLinkCounter;
1109+
PrepareRxDoneAbort( );
1110+
return;
1111+
}
1112+
11051113
if( isMicOk == true )
11061114
{
11071115
McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_OK;

src/mac/LoRaMac.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,10 @@ typedef enum eLoRaMacEventInfoStatus
540540
* of the downlink counter of the node.
541541
*/
542542
LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED,
543+
/*!
544+
* The node has lost MAX_FCNT_GAP or more frames.
545+
*/
546+
LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOSS,
543547
/*!
544548
* An address error occured
545549
*/

0 commit comments

Comments
 (0)