Skip to content

Commit bc9a93e

Browse files
authored
Merge pull request #1277 from ACRIOS-Systems/master
Fixed class B multicast handling in LoRaMacClassBProcessMulticastSlot()
2 parents fe8247e + a0fe9c6 commit bc9a93e

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/mac/LoRaMacClassB.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,12 +1133,15 @@ static void LoRaMacClassBProcessMulticastSlot( void )
11331133
case PINGSLOT_STATE_CALC_PING_OFFSET:
11341134
{
11351135
// Compute all offsets for every multicast slots
1136-
for( uint8_t i = 0; i < 4; i++ )
1136+
for( uint8_t i = 0; i < LORAMAC_MAX_MC_CTX; i++ )
11371137
{
1138-
ComputePingOffset( Ctx.BeaconCtx.BeaconTime.Seconds,
1139-
cur->ChannelParams.Address,
1140-
cur->PingPeriod,
1141-
&( cur->PingOffset ) );
1138+
if( cur->ChannelParams.IsEnabled )
1139+
{
1140+
ComputePingOffset( Ctx.BeaconCtx.BeaconTime.Seconds,
1141+
cur->ChannelParams.Address,
1142+
cur->PingPeriod,
1143+
&( cur->PingOffset ) );
1144+
}
11421145
cur++;
11431146
}
11441147
Ctx.MulticastSlotState = PINGSLOT_STATE_SET_TIMER;
@@ -1151,14 +1154,17 @@ static void LoRaMacClassBProcessMulticastSlot( void )
11511154

11521155
for( uint8_t i = 0; i < LORAMAC_MAX_MC_CTX; i++ )
11531156
{
1154-
// Calculate the next slot time for every multicast slot
1155-
if( CalcNextSlotTime( cur->PingOffset, cur->PingPeriod, cur->PingNb, &slotTime ) == true )
1157+
if( cur->ChannelParams.IsEnabled )
11561158
{
1157-
if( ( multicastSlotTime == 0 ) || ( multicastSlotTime > slotTime ) )
1159+
// Calculate the next slot time for every multicast slot
1160+
if( CalcNextSlotTime( cur->PingOffset, cur->PingPeriod, cur->PingNb, &slotTime ) == true )
11581161
{
1159-
// Update the slot time and the next multicast channel
1160-
multicastSlotTime = slotTime;
1161-
Ctx.PingSlotCtx.NextMulticastChannel = cur;
1162+
if( ( multicastSlotTime == 0 ) || ( multicastSlotTime > slotTime ) )
1163+
{
1164+
// Update the slot time and the next multicast channel
1165+
multicastSlotTime = slotTime;
1166+
Ctx.PingSlotCtx.NextMulticastChannel = cur;
1167+
}
11621168
}
11631169
}
11641170
cur++;

0 commit comments

Comments
 (0)