File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -456,14 +456,28 @@ LoRaMacCommandStatus_t LoRaMacCommandsRemoveNoneStickyCmds( void )
456456
457457LoRaMacCommandStatus_t LoRaMacCommandsRemoveStickyAnsCmds ( void )
458458{
459- MacCommand_t * macCmd ;
459+ MacCommand_t * curElement ;
460+ MacCommand_t * nexElement ;
460461
461- for ( uint8_t i = 0 ; i < sizeof ( CIDsStickyAnsCmds ); i ++ )
462+ // Start at the head of the list
463+ curElement = NvmCtx .MacCommandList .First ;
464+
465+ // Loop through all elements
466+ while ( curElement != NULL )
462467 {
463- if ( LoRaMacCommandsGetCmd ( CIDsStickyAnsCmds [i ], & macCmd ) == LORAMAC_COMMANDS_SUCCESS )
468+ nexElement = curElement -> Next ;
469+ if ( curElement -> IsSticky == true )
464470 {
465- LoRaMacCommandsRemoveCmd ( macCmd );
471+ for ( uint8_t i = 0 ; i < sizeof ( CIDsStickyAnsCmds ); i ++ )
472+ {
473+ if ( curElement -> CID == CIDsStickyAnsCmds [i ] )
474+ {
475+ LoRaMacCommandsRemoveCmd ( curElement );
476+ break ;
477+ }
478+ }
466479 }
480+ curElement = nexElement ;
467481 }
468482
469483 NvmCtxCallback ( );
You can’t perform that action at this time.
0 commit comments