Skip to content

Commit 8ff45c7

Browse files
author
Daniel Jaeckle
committed
Issue(#425): Fix retransmission issue for class c
1 parent a8ab2d2 commit 8ff45c7

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/mac/LoRaMac.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,13 @@ static void EventConfirmQueueNvmCtxChanged( void );
713713
*/
714714
static void EventFCntHandlerNvmCtxChanged( void );
715715

716+
/*!
717+
* \brief Verifies if a request is pending currently
718+
*
719+
*\retval 1: Request pending, 0: request not pending
720+
*/
721+
static uint8_t IsRequestPending( void );
722+
716723
/*!
717724
* Structure used to store the radio Tx event data
718725
*/
@@ -1096,13 +1103,19 @@ static void ProcessRadioRxDone( void )
10961103
{
10971104
// We are not the destination of this frame.
10981105
MacCtx.McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL;
1106+
1107+
// Abort the reception, if we are not in RX_SLOT_WIN_CLASS_C
1108+
if( MacCtx.McpsIndication.RxSlot != RX_SLOT_WIN_CLASS_C )
1109+
{
1110+
PrepareRxDoneAbort( );
1111+
}
10991112
}
11001113
else
11011114
{
11021115
// MIC calculation fail
11031116
MacCtx.McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_MIC_FAIL;
1117+
PrepareRxDoneAbort( );
11041118
}
1105-
PrepareRxDoneAbort( );
11061119
return;
11071120
}
11081121

@@ -1410,7 +1423,7 @@ void LoRaMacProcess( void )
14101423
}
14111424

14121425
// An error occurs during transmitting
1413-
if( ( MacCtx.MacFlags.Bits.MlmeReq == 1 ) || ( ( MacCtx.MacFlags.Bits.McpsReq == 1 ) ) )
1426+
if( IsRequestPending( ) > 0 )
14141427
{
14151428
// Get a status of any request and check if we have a TX timeout
14161429
MacCtx.MlmeConfirm.Status = LoRaMacConfirmQueueGetStatusCmn( );
@@ -2878,11 +2891,22 @@ static void EventConfirmQueueNvmCtxChanged( void )
28782891
CallNvmCtxCallback( LORAMAC_NVMCTXMODULE_CONFIRM_QUEUE );
28792892
}
28802893

2881-
void EventFCntHandlerNvmCtxChanged( void )
2894+
static void EventFCntHandlerNvmCtxChanged( void )
28822895
{
28832896
CallNvmCtxCallback( LORAMAC_NVMCTXMODULE_FCNT_HANDLER );
28842897
}
28852898

2899+
static uint8_t IsRequestPending( void )
2900+
{
2901+
if( ( MacCtx.MacFlags.Bits.MlmeReq == 1 ) ||
2902+
( MacCtx.MacFlags.Bits.McpsReq == 1 ) )
2903+
{
2904+
return 1;
2905+
}
2906+
return 0;
2907+
}
2908+
2909+
28862910
LoRaMacStatus_t LoRaMacInitialization( LoRaMacPrimitives_t* primitives, LoRaMacCallback_t* callbacks, LoRaMacRegion_t region )
28872911
{
28882912
GetPhyParams_t getPhy;

0 commit comments

Comments
 (0)