Skip to content

Commit

Permalink
Merge pull request #1277 from ACRIOS-Systems/master
Browse files Browse the repository at this point in the history
Fixed class B multicast handling in LoRaMacClassBProcessMulticastSlot()
  • Loading branch information
mluis1 authored Mar 10, 2022
2 parents fe8247e + a0fe9c6 commit bc9a93e
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/mac/LoRaMacClassB.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,12 +1133,15 @@ static void LoRaMacClassBProcessMulticastSlot( void )
case PINGSLOT_STATE_CALC_PING_OFFSET:
{
// Compute all offsets for every multicast slots
for( uint8_t i = 0; i < 4; i++ )
for( uint8_t i = 0; i < LORAMAC_MAX_MC_CTX; i++ )
{
ComputePingOffset( Ctx.BeaconCtx.BeaconTime.Seconds,
cur->ChannelParams.Address,
cur->PingPeriod,
&( cur->PingOffset ) );
if( cur->ChannelParams.IsEnabled )
{
ComputePingOffset( Ctx.BeaconCtx.BeaconTime.Seconds,
cur->ChannelParams.Address,
cur->PingPeriod,
&( cur->PingOffset ) );
}
cur++;
}
Ctx.MulticastSlotState = PINGSLOT_STATE_SET_TIMER;
Expand All @@ -1151,14 +1154,17 @@ static void LoRaMacClassBProcessMulticastSlot( void )

for( uint8_t i = 0; i < LORAMAC_MAX_MC_CTX; i++ )
{
// Calculate the next slot time for every multicast slot
if( CalcNextSlotTime( cur->PingOffset, cur->PingPeriod, cur->PingNb, &slotTime ) == true )
if( cur->ChannelParams.IsEnabled )
{
if( ( multicastSlotTime == 0 ) || ( multicastSlotTime > slotTime ) )
// Calculate the next slot time for every multicast slot
if( CalcNextSlotTime( cur->PingOffset, cur->PingPeriod, cur->PingNb, &slotTime ) == true )
{
// Update the slot time and the next multicast channel
multicastSlotTime = slotTime;
Ctx.PingSlotCtx.NextMulticastChannel = cur;
if( ( multicastSlotTime == 0 ) || ( multicastSlotTime > slotTime ) )
{
// Update the slot time and the next multicast channel
multicastSlotTime = slotTime;
Ctx.PingSlotCtx.NextMulticastChannel = cur;
}
}
}
cur++;
Expand Down

0 comments on commit bc9a93e

Please sign in to comment.