Skip to content

Commit b566431

Browse files
committed
Fixed the way RX2DataRate != 0x0F is handled while processing a JoinAccept
1 parent f9bb6f9 commit b566431

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/mac/LoRaMac.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -997,18 +997,25 @@ static void ProcessRadioRxDone( void )
997997
joinType = MLME_REJOIN_2;
998998
}
999999

1000-
VerifyParams_t verifyRxDr;
1001-
bool rxDrValid = true;
1002-
1003-
if( macMsgJoinAccept.DLSettings.Bits.RX2DataRate != 0x0F )
1000+
if( LORAMAC_CRYPTO_SUCCESS == macCryptoStatus )
10041001
{
1005-
verifyRxDr.DatarateParams.Datarate = macMsgJoinAccept.DLSettings.Bits.RX2DataRate;
1006-
verifyRxDr.DatarateParams.DownlinkDwellTime = Nvm.MacGroup2.MacParams.DownlinkDwellTime;
1007-
rxDrValid = RegionVerify( Nvm.MacGroup2.Region, &verifyRxDr, PHY_RX_DR );
1008-
}
1002+
VerifyParams_t verifyRxDr;
1003+
1004+
if( macMsgJoinAccept.DLSettings.Bits.RX2DataRate != 0x0F )
1005+
{
1006+
verifyRxDr.DatarateParams.Datarate = macMsgJoinAccept.DLSettings.Bits.RX2DataRate;
1007+
verifyRxDr.DatarateParams.DownlinkDwellTime = Nvm.MacGroup2.MacParams.DownlinkDwellTime;
1008+
if( RegionVerify( Nvm.MacGroup2.Region, &verifyRxDr, PHY_RX_DR ) == false )
1009+
{
1010+
// MLME handling
1011+
if( LoRaMacConfirmQueueIsCmdActive( MLME_JOIN ) == true )
1012+
{
1013+
LoRaMacConfirmQueueSetStatus( LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL, MLME_JOIN );
1014+
}
1015+
break;
1016+
}
1017+
}
10091018

1010-
if( ( LORAMAC_CRYPTO_SUCCESS == macCryptoStatus ) && ( rxDrValid == true ) )
1011-
{
10121019
// Network ID
10131020
Nvm.MacGroup2.NetID = ( uint32_t ) macMsgJoinAccept.NetID[0];
10141021
Nvm.MacGroup2.NetID |= ( ( uint32_t ) macMsgJoinAccept.NetID[1] << 8 );

0 commit comments

Comments
 (0)