Skip to content

Commit 2503155

Browse files
committed
Relocate reset of MacCommandsBufferIndex
1 parent 8050de6 commit 2503155

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/mac/LoRaMac.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,11 +1699,10 @@ static void OnMacStateCheckTimerEvent( void )
16991699
{
17001700
LoRaMacParams.ChannelsDatarate = MAX( LoRaMacParams.ChannelsDatarate - 1, LORAMAC_TX_MIN_DATARATE );
17011701
}
1702-
if( ValidatePayloadLength( LoRaMacTxPayloadLen, LoRaMacParams.ChannelsDatarate, MacCommandsBufferIndex ) == true )
1702+
// Try to send the frame again
1703+
if( ScheduleTx( ) == LORAMAC_STATUS_OK )
17031704
{
17041705
LoRaMacFlags.Bits.MacDone = 0;
1705-
// Sends the same frame again
1706-
ScheduleTx( );
17071706
}
17081707
else
17091708
{
@@ -1769,6 +1768,8 @@ static void OnMacStateCheckTimerEvent( void )
17691768
LoRaMacFlags.Bits.MlmeReq = 0;
17701769
}
17711770

1771+
// Procedure done. Reset variables.
1772+
MacCommandsBufferIndex = 0;
17721773
LoRaMacFlags.Bits.MacDone = 0;
17731774
}
17741775
else
@@ -2902,10 +2903,6 @@ static LoRaMacStatus_t ScheduleTx( void )
29022903
RxWindow2Delay = LoRaMacParams.ReceiveDelay2 + RxWindowsParams[1].RxOffset;
29032904
}
29042905

2905-
// MacCommandsBufferIndex variable is reset here because we now have
2906-
// managed all uplink & downlink parameters.
2907-
MacCommandsBufferIndex = 0;
2908-
29092906
// Schedule transmission of frame
29102907
if( dutyCycleTimeOff == 0 )
29112908
{

0 commit comments

Comments
 (0)