Skip to content

Commit 247dbe9

Browse files
committed
Simplification of indication handling.
1 parent c47b841 commit 247dbe9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/mac/LoRaMac.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,8 +1493,10 @@ static void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t
14931493
TimerStop( &AckTimeoutTimer );
14941494
}
14951495
}
1496-
LoRaMacFlags.Bits.McpsInd = 1;
14971496
}
1497+
// Provide always an indication, skip the callback to the user application,
1498+
// in case of a confirmed downlink retransmission.
1499+
LoRaMacFlags.Bits.McpsInd = 1;
14981500
LoRaMacFlags.Bits.McpsIndSkip = skipIndication;
14991501
}
15001502
else
@@ -1663,7 +1665,7 @@ static void OnMacStateCheckTimerEvent( void )
16631665
{// Procedure for all other frames
16641666
if( ( ChannelsNbRepCounter >= LoRaMacParams.ChannelsNbRep ) || ( LoRaMacFlags.Bits.McpsInd == 1 ) )
16651667
{
1666-
if( ( LoRaMacFlags.Bits.McpsInd == 0 ) && ( LoRaMacFlags.Bits.McpsIndSkip == 0 ) )
1668+
if( LoRaMacFlags.Bits.McpsInd == 0)
16671669
{ // Maximum repititions without downlink. Reset MacCommandsBufferIndex. Increase ADR Ack counter.
16681670
// Only process the case when the MAC did not receive a downlink.
16691671
MacCommandsBufferIndex = 0;
@@ -1788,7 +1790,6 @@ static void OnMacStateCheckTimerEvent( void )
17881790
}
17891791

17901792
// Procedure done. Reset variables.
1791-
LoRaMacFlags.Bits.McpsIndSkip = 0;
17921793
LoRaMacFlags.Bits.MacDone = 0;
17931794
}
17941795
else
@@ -1804,8 +1805,11 @@ static void OnMacStateCheckTimerEvent( void )
18041805
{// Activate RX2 window for Class C
18051806
OnRxWindow2TimerEvent( );
18061807
}
1807-
1808-
LoRaMacPrimitives->MacMcpsIndication( &McpsIndication );
1808+
if( LoRaMacFlags.Bits.McpsIndSkip == 0 )
1809+
{
1810+
LoRaMacPrimitives->MacMcpsIndication( &McpsIndication );
1811+
}
1812+
LoRaMacFlags.Bits.McpsIndSkip = 0;
18091813
LoRaMacFlags.Bits.McpsInd = 0;
18101814
}
18111815
}

0 commit comments

Comments
 (0)