Skip to content

Commit

Permalink
Fix #14, Refactor LC_SampleAPs to remove extraneous if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Mar 12, 2023
1 parent 2f177ae commit 2cf28c8
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions fsw/src/lc_action.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,39 +44,28 @@ void LC_SampleAPs(uint16 StartIndex, uint16 EndIndex)
uint8 CurrentAPState;

/*
** If we're specifying a single actionpoint, make sure it's
** current state is valid for a sample request
** Make sure the current state of the starting actionpoint
** in the sample is valid for a sample request
*/
if (StartIndex == EndIndex)
{
CurrentAPState = LC_OperData.ARTPtr[StartIndex].CurrentState;
CurrentAPState = LC_OperData.ARTPtr[StartIndex].CurrentState;

if ((CurrentAPState != LC_APSTATE_NOT_USED) && (CurrentAPState != LC_APSTATE_PERMOFF))
{
/*
** Sample the specified actionpoint
*/
LC_SampleSingleAP(StartIndex);
}
else
if ((CurrentAPState != LC_ACTION_NOT_USED) && (CurrentAPState != LC_APSTATE_PERMOFF))
{
/*
** Sample selected actionpoints
*/
for (TableIndex = StartIndex; TableIndex <= EndIndex; TableIndex++)
{
/*
** 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);
LC_SampleSingleAP(TableIndex);
}
}
else
{
/*
** Sample selected actionpoints
** Actionpoint isn't currently operational
*/
for (TableIndex = StartIndex; TableIndex <= EndIndex; TableIndex++)
{
LC_SampleSingleAP(TableIndex);
}
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;
Expand Down

0 comments on commit 2cf28c8

Please sign in to comment.