Skip to content

Commit

Permalink
Fixed an issue where time to time the unicast and multicast ping-slot…
Browse files Browse the repository at this point in the history
… windows could stop being opened up until the next beacon reception
  • Loading branch information
mluis1 committed Sep 25, 2023
1 parent d08d0d5 commit 0dc4903
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions src/mac/LoRaMacClassB.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,11 +1023,19 @@ static void LoRaMacClassBProcessPingSlot( void )
pingSlotTime += pingSlotRxConfig.WindowOffset;
}
}

// Start the timer if the ping slot time is in range
LoRaMacClassBSetPingSlotState( PINGSLOT_STATE_IDLE );
TimerSetValue( &Ctx.PingSlotTimer, pingSlotTime );
TimerStart( &Ctx.PingSlotTimer );
if( pingSlotTime < CLASSB_BEACON_INTERVAL )
{
// Start the timer if the ping slot time is in range
LoRaMacClassBSetPingSlotState( PINGSLOT_STATE_IDLE );
TimerSetValue( &Ctx.PingSlotTimer, pingSlotTime );
TimerStart( &Ctx.PingSlotTimer );
}
else
{
LoRaMacClassBSetMulticastSlotState( PINGSLOT_STATE_CALC_PING_OFFSET );
TimerSetValue( &Ctx.PingSlotTimer, 1 );
TimerStart( &Ctx.PingSlotTimer );
}
}
break;
}
Expand Down Expand Up @@ -1196,11 +1204,19 @@ static void LoRaMacClassBProcessMulticastSlot( void )
{// Apply the window offset
multicastSlotTime += multicastSlotRxConfig.WindowOffset;
}

// Start the timer if the ping slot time is in range
LoRaMacClassBSetMulticastSlotState( PINGSLOT_STATE_IDLE );
TimerSetValue( &Ctx.MulticastSlotTimer, multicastSlotTime );
TimerStart( &Ctx.MulticastSlotTimer );
if( multicastSlotTime < CLASSB_BEACON_INTERVAL )
{
// Start the timer if the ping slot time is in range
LoRaMacClassBSetMulticastSlotState( PINGSLOT_STATE_IDLE );
TimerSetValue( &Ctx.MulticastSlotTimer, multicastSlotTime );
TimerStart( &Ctx.MulticastSlotTimer );
}
else
{
LoRaMacClassBSetMulticastSlotState( PINGSLOT_STATE_CALC_PING_OFFSET );
TimerSetValue( &Ctx.MulticastSlotTimer, 1 );
TimerStart( &Ctx.MulticastSlotTimer );
}
}
break;
}
Expand Down

1 comment on commit 0dc4903

@sborshch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to use LoRaMacClassBSetMulticastSlotState() in line 1035 or it is mistype and should be LoRaMacClassBSetPingSlotState()?

Please sign in to comment.