From f0570041229e5535dabf9f32830adfdae6318463 Mon Sep 17 00:00:00 2001 From: Phil Date: Sat, 22 Aug 2026 18:46:33 +0200 Subject: [PATCH] Fix #114: remove redundant initial state check in LC_SampleAPs The guard on the starting AP's state prevented sampling the entire range when the first AP happened to be PERMOFF or NOT_USED. LC_SampleSingleAP already checks each AP's state individually, making this pre-check redundant and harmful. --- fsw/src/lc_action.c | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/fsw/src/lc_action.c b/fsw/src/lc_action.c index 92c1d35..16ee7cb 100644 --- a/fsw/src/lc_action.c +++ b/fsw/src/lc_action.c @@ -41,37 +41,16 @@ void LC_SampleAPs(uint16 StartIndex, uint16 EndIndex) { uint16 TableIndex; - uint8 CurrentAPState; /* - ** Make sure the current state of the starting actionpoint - ** in the sample is valid for a sample request - */ - CurrentAPState = LC_OperData.ARTPtr[StartIndex].CurrentState; - - if ((CurrentAPState != LC_ACTION_NOT_USED) && (CurrentAPState != LC_APSTATE_PERMOFF)) + ** Sample selected actionpoints. + ** LC_SampleSingleAP handles per-AP state checks internally, + ** so no pre-check on the start index is needed. + */ + for (TableIndex = StartIndex; TableIndex <= EndIndex; TableIndex++) { - /* - ** Sample selected actionpoints - */ - for (TableIndex = StartIndex; TableIndex <= EndIndex; TableIndex++) - { - LC_SampleSingleAP(TableIndex); - } + LC_SampleSingleAP(TableIndex); } - else - { - /* - ** Actionpoint isn't currently operational - */ - CFE_EVS_SendEvent(LC_APSAMPLE_CURR_ERR_EID, - CFE_EVS_EventType_ERROR, - "Sample AP error, invalid current AP state: AP = %d, State = %d", - StartIndex, - CurrentAPState); - } - - return; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */