Skip to content

Commit

Permalink
Update the function LoRaMacCommandsRemoveStickyAnsCmds to remove all …
Browse files Browse the repository at this point in the history
…occurrences of a sticky Mac command

#529
  • Loading branch information
mluis1 committed Aug 31, 2018
1 parent 173f513 commit 5b4ac08
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/mac/LoRaMacCommands.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,28 @@ LoRaMacCommandStatus_t LoRaMacCommandsRemoveNoneStickyCmds( void )

LoRaMacCommandStatus_t LoRaMacCommandsRemoveStickyAnsCmds( void )
{
MacCommand_t* macCmd;
MacCommand_t* curElement;
MacCommand_t* nexElement;

for( uint8_t i = 0; i < sizeof( CIDsStickyAnsCmds ); i++)
// Start at the head of the list
curElement = NvmCtx.MacCommandList.First;

// Loop through all elements
while( curElement != NULL )
{
if( LoRaMacCommandsGetCmd( CIDsStickyAnsCmds[i], &macCmd ) == LORAMAC_COMMANDS_SUCCESS )
nexElement = curElement->Next;
if( curElement->IsSticky == true )
{
LoRaMacCommandsRemoveCmd( macCmd );
for( uint8_t i = 0; i < sizeof( CIDsStickyAnsCmds ); i++)
{
if( curElement->CID == CIDsStickyAnsCmds[i] )
{
LoRaMacCommandsRemoveCmd( curElement );
break;
}
}
}
curElement = nexElement;
}

NvmCtxCallback( );
Expand Down

0 comments on commit 5b4ac08

Please sign in to comment.