Skip to content

Commit 0dc4903

Browse files
committed
Fixed an issue where time to time the unicast and multicast ping-slot windows could stop being opened up until the next beacon reception
1 parent d08d0d5 commit 0dc4903

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

src/mac/LoRaMacClassB.c

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,11 +1023,19 @@ static void LoRaMacClassBProcessPingSlot( void )
10231023
pingSlotTime += pingSlotRxConfig.WindowOffset;
10241024
}
10251025
}
1026-
1027-
// Start the timer if the ping slot time is in range
1028-
LoRaMacClassBSetPingSlotState( PINGSLOT_STATE_IDLE );
1029-
TimerSetValue( &Ctx.PingSlotTimer, pingSlotTime );
1030-
TimerStart( &Ctx.PingSlotTimer );
1026+
if( pingSlotTime < CLASSB_BEACON_INTERVAL )
1027+
{
1028+
// Start the timer if the ping slot time is in range
1029+
LoRaMacClassBSetPingSlotState( PINGSLOT_STATE_IDLE );
1030+
TimerSetValue( &Ctx.PingSlotTimer, pingSlotTime );
1031+
TimerStart( &Ctx.PingSlotTimer );
1032+
}
1033+
else
1034+
{
1035+
LoRaMacClassBSetMulticastSlotState( PINGSLOT_STATE_CALC_PING_OFFSET );
1036+
TimerSetValue( &Ctx.PingSlotTimer, 1 );
1037+
TimerStart( &Ctx.PingSlotTimer );
1038+
}
10311039
}
10321040
break;
10331041
}
@@ -1196,11 +1204,19 @@ static void LoRaMacClassBProcessMulticastSlot( void )
11961204
{// Apply the window offset
11971205
multicastSlotTime += multicastSlotRxConfig.WindowOffset;
11981206
}
1199-
1200-
// Start the timer if the ping slot time is in range
1201-
LoRaMacClassBSetMulticastSlotState( PINGSLOT_STATE_IDLE );
1202-
TimerSetValue( &Ctx.MulticastSlotTimer, multicastSlotTime );
1203-
TimerStart( &Ctx.MulticastSlotTimer );
1207+
if( multicastSlotTime < CLASSB_BEACON_INTERVAL )
1208+
{
1209+
// Start the timer if the ping slot time is in range
1210+
LoRaMacClassBSetMulticastSlotState( PINGSLOT_STATE_IDLE );
1211+
TimerSetValue( &Ctx.MulticastSlotTimer, multicastSlotTime );
1212+
TimerStart( &Ctx.MulticastSlotTimer );
1213+
}
1214+
else
1215+
{
1216+
LoRaMacClassBSetMulticastSlotState( PINGSLOT_STATE_CALC_PING_OFFSET );
1217+
TimerSetValue( &Ctx.MulticastSlotTimer, 1 );
1218+
TimerStart( &Ctx.MulticastSlotTimer );
1219+
}
12041220
}
12051221
break;
12061222
}

0 commit comments

Comments
 (0)