Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #14, Refactor LC_SampleAPs to remove extraneous if statement #47

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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