Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed class B multicast handling in LoRaMacClassBProcessMulticastSlot() #1277

Merged
merged 1 commit into from
Mar 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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