Skip to content

Commit 9c28a93

Browse files
author
Daniel Jäckle
committed
Accept MAC information of duplicated, confirmed downlinks.
1 parent a184dd8 commit 9c28a93

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

src/mac/LoRaMac.c

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,7 @@ static void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t
905905
{
906906
LoRaMacHeader_t macHdr;
907907
LoRaMacFrameCtrl_t fCtrl;
908+
bool skipIndication = false;
908909

909910
uint8_t pktHeaderLen = 0;
910911
uint32_t address = 0;
@@ -1136,19 +1137,27 @@ static void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t
11361137
{
11371138
SrvAckRequested = true;
11381139
McpsIndication.McpsIndication = MCPS_CONFIRMED;
1140+
1141+
if( ( DownLinkCounter == downLinkCounter ) &&
1142+
( DownLinkCounter != 0 ) )
1143+
{
1144+
// Duplicated confirmed downlink. Skip indication.
1145+
skipIndication = true;
1146+
}
11391147
}
11401148
else
11411149
{
11421150
SrvAckRequested = false;
11431151
McpsIndication.McpsIndication = MCPS_UNCONFIRMED;
1144-
}
1145-
if( ( DownLinkCounter == downLinkCounter ) &&
1146-
( DownLinkCounter != 0 ) )
1147-
{
1148-
McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED;
1149-
McpsIndication.DownLinkCounter = downLinkCounter;
1150-
PrepareRxDoneAbort( );
1151-
return;
1152+
1153+
if( ( DownLinkCounter == downLinkCounter ) &&
1154+
( DownLinkCounter != 0 ) )
1155+
{
1156+
McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED;
1157+
McpsIndication.DownLinkCounter = downLinkCounter;
1158+
PrepareRxDoneAbort( );
1159+
return;
1160+
}
11521161
}
11531162
DownLinkCounter = downLinkCounter;
11541163
}
@@ -1210,12 +1219,18 @@ static void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t
12101219
downLinkCounter,
12111220
LoRaMacRxPayload );
12121221

1213-
McpsIndication.Buffer = LoRaMacRxPayload;
1214-
McpsIndication.BufferSize = frameLen;
1215-
McpsIndication.RxData = true;
1222+
if( skipIndication == false )
1223+
{
1224+
McpsIndication.Buffer = LoRaMacRxPayload;
1225+
McpsIndication.BufferSize = frameLen;
1226+
McpsIndication.RxData = true;
1227+
}
12161228
}
12171229
}
1218-
LoRaMacFlags.Bits.McpsInd = 1;
1230+
if( skipIndication == false )
1231+
{
1232+
LoRaMacFlags.Bits.McpsInd = 1;
1233+
}
12191234
}
12201235
else
12211236
{

0 commit comments

Comments
 (0)