Skip to content

Commit

Permalink
Fixed the way RX2DataRate != 0x0F is handled while processing a Joi…
Browse files Browse the repository at this point in the history
…nAccept
  • Loading branch information
mluis1 committed Dec 9, 2022
1 parent f9bb6f9 commit b566431
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/mac/LoRaMac.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,18 +997,25 @@ static void ProcessRadioRxDone( void )
joinType = MLME_REJOIN_2;
}

VerifyParams_t verifyRxDr;
bool rxDrValid = true;

if( macMsgJoinAccept.DLSettings.Bits.RX2DataRate != 0x0F )
if( LORAMAC_CRYPTO_SUCCESS == macCryptoStatus )
{
verifyRxDr.DatarateParams.Datarate = macMsgJoinAccept.DLSettings.Bits.RX2DataRate;
verifyRxDr.DatarateParams.DownlinkDwellTime = Nvm.MacGroup2.MacParams.DownlinkDwellTime;
rxDrValid = RegionVerify( Nvm.MacGroup2.Region, &verifyRxDr, PHY_RX_DR );
}
VerifyParams_t verifyRxDr;

if( macMsgJoinAccept.DLSettings.Bits.RX2DataRate != 0x0F )
{
verifyRxDr.DatarateParams.Datarate = macMsgJoinAccept.DLSettings.Bits.RX2DataRate;
verifyRxDr.DatarateParams.DownlinkDwellTime = Nvm.MacGroup2.MacParams.DownlinkDwellTime;
if( RegionVerify( Nvm.MacGroup2.Region, &verifyRxDr, PHY_RX_DR ) == false )
{
// MLME handling
if( LoRaMacConfirmQueueIsCmdActive( MLME_JOIN ) == true )
{
LoRaMacConfirmQueueSetStatus( LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL, MLME_JOIN );
}
break;
}
}

if( ( LORAMAC_CRYPTO_SUCCESS == macCryptoStatus ) && ( rxDrValid == true ) )
{
// Network ID
Nvm.MacGroup2.NetID = ( uint32_t ) macMsgJoinAccept.NetID[0];
Nvm.MacGroup2.NetID |= ( ( uint32_t ) macMsgJoinAccept.NetID[1] << 8 );
Expand Down

0 comments on commit b566431

Please sign in to comment.