Skip to content

Commit

Permalink
Touch-ups after feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Nov 3, 2022
1 parent 440e5e1 commit 0a658cd
Show file tree
Hide file tree
Showing 16 changed files with 396 additions and 395 deletions.
36 changes: 18 additions & 18 deletions docs/dox_src/cfs_lc.dox
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@
commands as a response to this condition.

Actionpoints can be individually enabled/disabled with the #LC_SET_AP_STATE_CC ground
command. The state of an actionpoint may be set to #LC_APSTATE_ACTIVE, #LC_APSTATE_PASSIVE,
or #LC_APSTATE_DISABLED. These states operate in the same way as the application operating
modes described above. #LC_APSTATE_PASSIVE will just disable RTS requests, while
#LC_APSTATE_DISABLED will stop evaluation of the actionpoint all together. An additional
state #LC_APSTATE_PERMOFF which functions the same as #LC_APSTATE_DISABLED but can only
command. The state of an actionpoint may be set to #LC_ActionPointState_ACTIVE, #LC_ActionPointState_PASSIVE,
or #LC_ActionPointState_DISABLED. These states operate in the same way as the application operating
modes described above. #LC_ActionPointState_PASSIVE will just disable RTS requests, while
#LC_ActionPointState_DISABLED will stop evaluation of the actionpoint all together. An additional
state #LC_ActionPointState_PERMOFF which functions the same as #LC_ActionPointState_DISABLED but can only
be changed via table load, can be set using the #LC_SET_AP_PERMOFF_CC ground command
(see \ref cfslcfaqs).

Expand Down Expand Up @@ -259,7 +259,7 @@
In the lc_platform_cfg.h file, there are configuration parameters that control use
of the Critical Data Store (CDS) and the LC operation mode on application
initialization. The default case is not to use the CDS and to set the application
state to #LC_STATE_DISABLED.
state to #LC_AppState_DISABLED.
**/

/**
Expand Down Expand Up @@ -302,7 +302,7 @@
The entire ADT is processed anytime a sample request is received that specifies an
actionpoint equal to #LC_ALL_ACTIONPOINTS. For this reason, it is important that unused
entries are properly marked by setting the ADT parameter DefaultState to
#LC_ACTION_NOT_USED.
#LC_ActionPoint_NOT_USED.

When either the WDT or ADT are updated, the corresponding results table (WRT or ART) is
reset to initialization values. For each entry in the WRT, WatchResult is set to
Expand Down Expand Up @@ -523,7 +523,7 @@
three possible conditions are true:

1) The actionpoint is unused (the DefaultState in the ADT is set to
#LC_ACTION_NOT_USED).
#LC_ActionPoint_NOT_USED).

2) An actionpoint sample request (#LC_SAMPLE_AP_MID) targeting the AP has not
yet been received by LC so the AP has not yet been evaluated.
Expand Down Expand Up @@ -551,27 +551,27 @@
</I>

<B> (Q)
How does the Actionpoint state #LC_APSTATE_PERMOFF differ from
#LC_APSTATE_DISABLED?
How does the Actionpoint state #LC_ActionPointState_PERMOFF differ from
#LC_ActionPointState_DISABLED?
</B> <BR> <BR> <I>
The AP state #LC_APSTATE_PERMOFF is intended to provide a way to disable
The AP state #LC_ActionPointState_PERMOFF is intended to provide a way to disable
an AP so it can not easily be turned back on by mistake. Such actionpoints
may not be needed after a seperation sequence or only apply to certain
mission phases.

While the two states are treated the same way during actionpoint processing
(the AP isn't evaluated), there are a few differences.

An AP can't be set to #LC_APSTATE_PERMOFF with the #LC_SET_AP_STATE_CC command,
An AP can't be set to #LC_ActionPointState_PERMOFF with the #LC_SET_AP_STATE_CC command,
it must be done with the #LC_SET_AP_PERMOFF_CC command.

To set an AP to #LC_APSTATE_PERMOFF with the #LC_SET_AP_PERMOFF_CC command, the
current AP state must be #LC_APSTATE_DISABLED.
To set an AP to #LC_ActionPointState_PERMOFF with the #LC_SET_AP_PERMOFF_CC command, the
current AP state must be #LC_ActionPointState_DISABLED.

The #LC_SET_AP_PERMOFF_CC command can only be issued for a single actionpoint,
#LC_ALL_ACTIONPOINTS is not valid as an argument for this command.

Once an AP is set to #LC_APSTATE_PERMOFF, it can only be changed with a new ADT
Once an AP is set to #LC_ActionPointState_PERMOFF, it can only be changed with a new ADT
table load.
</I>

Expand All @@ -592,7 +592,7 @@
#LC_HKAR_STATE_NOT_USED, #LC_HKAR_STATE_ACTIVE, #LC_HKAR_STATE_PASSIVE,
#LC_HKAR_STATE_DISABLED

An actionpoint whose current state is #LC_APSTATE_PERMOFF will have it's
An actionpoint whose current state is #LC_ActionPointState_PERMOFF will have it's
state reported in the APResults as #LC_HKAR_STATE_NOT_USED.

The numerical 2 bit values for evaluation results are defined using the
Expand All @@ -614,9 +614,9 @@
Will an RTS get requested more than once if an AP stays in the #LC_ACTION_FAIL
state?
</B> <BR> <BR> <I>
No. Assuming the current state of an actionpoint is #LC_APSTATE_ACTIVE, then
No. Assuming the current state of an actionpoint is #LC_ActionPointState_ACTIVE, then
when the actionpoint fails enough times to trigger an RTS, the state is set
to #LC_APSTATE_PASSIVE.
to #LC_ActionPointState_PASSIVE.

In the passive state, the AP will continue to be sampled and statistics
updated, but no RTS requests will be initiated.
Expand Down
22 changes: 11 additions & 11 deletions fsw/platform_inc/lc_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@
*
* \par Limits:
* This parameter must be one of the following:
* #LC_STATE_ACTIVE
* #LC_STATE_PASSIVE
* #LC_STATE_DISABLED
* #LC_AppState_ACTIVE
* #LC_AppState_PASSIVE
* #LC_AppState_DISABLED
*/
#define LC_STATE_POWER_ON_RESET LC_STATE_DISABLED
#define LC_STATE_POWER_ON_RESET LC_AppState_DISABLED

/**
* \brief Save data to CDS compiler switch
Expand Down Expand Up @@ -152,19 +152,19 @@
* is set to true, and provides a way to override any state LC
* may have been operating in prior to the reset occurring.
*
* If this is set to LC_STATE_FROM_CDS and LC_SAVE_TO_CDS is set
* If this is set to LC_AppState_FROM_CDS and LC_SAVE_TO_CDS is set
* to true, then the LC state will be preserved across resets and
* restored. If this is not set to LC_STATE_FROM_CDS, the state
* restored. If this is not set to LC_AppState_FROM_CDS, the state
* saved in the CDS is overwritten by the state assigned here.
*
* \par Limits:
* This parameter must be one of the following:
* #LC_STATE_ACTIVE
* #LC_STATE_PASSIVE
* #LC_STATE_DISABLED
* #LC_STATE_FROM_CDS
* #LC_AppState_ACTIVE
* #LC_AppState_PASSIVE
* #LC_AppState_DISABLED
* #LC_AppState_FROM_CDS
*/
#define LC_STATE_WHEN_CDS_RESTORED LC_STATE_FROM_CDS
#define LC_STATE_WHEN_CDS_RESTORED LC_AppState_FROM_CDS

/**
* \brief Watchpoint Definition Table (WDT) filename
Expand Down
16 changes: 8 additions & 8 deletions fsw/src/lc_action.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void LC_SampleAPs(uint16 StartIndex, uint16 EndIndex)
{
CurrentAPState = LC_OperData.ARTPtr[StartIndex].CurrentState;

if ((CurrentAPState != LC_ACTION_NOT_USED) && (CurrentAPState != LC_APSTATE_PERMOFF))
if ((CurrentAPState != LC_ActionPoint_NOT_USED) && (CurrentAPState != LC_ActionPointState_PERMOFF))
{
/*
** Sample the specified actionpoint
Expand Down Expand Up @@ -101,7 +101,7 @@ void LC_SampleSingleAP(uint16 APNumber)
*/
CurrentAPState = LC_OperData.ARTPtr[APNumber].CurrentState;

if ((CurrentAPState == LC_APSTATE_ACTIVE) || (CurrentAPState == LC_APSTATE_PASSIVE))
if ((CurrentAPState == LC_ActionPointState_ACTIVE) || (CurrentAPState == LC_ActionPointState_PASSIVE))
{
/*
** Evaluate the actionpoint and update the results
Expand Down Expand Up @@ -146,14 +146,14 @@ void LC_SampleSingleAP(uint16 APNumber)
/*
** We have failed enough times to request the RTS
*/
if (CurrentAPState == LC_APSTATE_ACTIVE)
if (CurrentAPState == LC_ActionPointState_ACTIVE)
{
/*
** Actions go to passive after they've failed
*/
LC_OperData.ARTPtr[APNumber].CurrentState = LC_APSTATE_PASSIVE;
LC_OperData.ARTPtr[APNumber].CurrentState = LC_ActionPointState_PASSIVE;

if (LC_AppData.CurrentLCState == LC_STATE_ACTIVE)
if (LC_AppData.CurrentLCState == LC_AppState_ACTIVE)
{
/*
** If the LC application state is active, request the
Expand Down Expand Up @@ -511,15 +511,15 @@ int32 LC_ValidateADT(void *TableData)
RPNPtr = TableArray[TableIndex].RPNEquation;
EventType = TableArray[TableIndex].EventType;

if (DefaultState == LC_ACTION_NOT_USED)
if (DefaultState == LC_ActionPoint_NOT_USED)
{
/*
** Unused table entry
*/
UnusedCount++;
}
else if ((DefaultState != LC_APSTATE_ACTIVE) && (DefaultState != LC_APSTATE_PASSIVE) &&
(DefaultState != LC_APSTATE_DISABLED) && (DefaultState != LC_APSTATE_PERMOFF))
else if ((DefaultState != LC_ActionPointState_ACTIVE) && (DefaultState != LC_ActionPointState_PASSIVE) &&
(DefaultState != LC_ActionPointState_DISABLED) && (DefaultState != LC_ActionPointState_PERMOFF))
{
/*
** Invalid default state
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/lc_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ int32 LC_CreateTaskCDS(void)
** May need to override the restored application state
*/

#if LC_STATE_WHEN_CDS_RESTORED != LC_STATE_FROM_CDS
#if LC_STATE_WHEN_CDS_RESTORED != LC_AppState_FROM_CDS
LC_AppData.CurrentLCState = LC_STATE_WHEN_CDS_RESTORED;
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/lc_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ typedef struct
uint32 RTSExecCount; /**< \brief Total count of RTS sequences initiated */
uint16 PassiveRTSExecCount; /**< \brief Total count of RTS sequences not
initiated because the LC state is
set to #LC_STATE_PASSIVE or the state
set to #LC_AppState_PASSIVE or the state
of the actionpoint that failed is set to
#LC_APSTATE_PASSIVE */
#LC_ActionPointState_PASSIVE */

uint16 CDSSavedOnExit; /**< \brief Variable that tells us if we exited clean or not */
uint8 CurrentLCState; /**< \brief Current LC application operating state */
Expand Down
42 changes: 21 additions & 21 deletions fsw/src/lc_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void LC_SampleAPReq(const CFE_SB_Buffer_t *BufPtr)
/*
** Ignore AP sample requests if disabled at the application level
*/
if (LC_AppData.CurrentLCState != LC_STATE_DISABLED)
if (LC_AppData.CurrentLCState != LC_AppState_DISABLED)
{
/*
** Range check the actionpoint array index arguments
Expand Down Expand Up @@ -361,20 +361,20 @@ int32 LC_HousekeepingReq(const CFE_MSG_CommandHeader_t *MsgPtr)
*/
switch (LC_OperData.ARTPtr[TableIndex + 1].CurrentState)
{
case LC_ACTION_NOT_USED:
case LC_ActionPoint_NOT_USED:
ByteData = LC_HKAR_STATE_NOT_USED << 6;
break;

case LC_APSTATE_ACTIVE:
case LC_ActionPointState_ACTIVE:
ByteData = LC_HKAR_STATE_ACTIVE << 6;
LC_OperData.HkPacket.ActiveAPs++;
break;

case LC_APSTATE_PASSIVE:
case LC_ActionPointState_PASSIVE:
ByteData = LC_HKAR_STATE_PASSIVE << 6;
break;

case LC_APSTATE_DISABLED:
case LC_ActionPointState_DISABLED:
ByteData = LC_HKAR_STATE_DISABLED << 6;
break;

Expand All @@ -383,7 +383,7 @@ int32 LC_HousekeepingReq(const CFE_MSG_CommandHeader_t *MsgPtr)
** as unused. We should never get an undefined
** action state, but we'll set to not used if we do.
*/
case LC_APSTATE_PERMOFF:
case LC_ActionPointState_PERMOFF:
default:
ByteData = LC_HKAR_STATE_NOT_USED << 6;
break;
Expand Down Expand Up @@ -421,24 +421,24 @@ int32 LC_HousekeepingReq(const CFE_MSG_CommandHeader_t *MsgPtr)
*/
switch (LC_OperData.ARTPtr[TableIndex].CurrentState)
{
case LC_ACTION_NOT_USED:
case LC_ActionPoint_NOT_USED:
ByteData = (ByteData | (LC_HKAR_STATE_NOT_USED << 2));
break;

case LC_APSTATE_ACTIVE:
case LC_ActionPointState_ACTIVE:
ByteData = (ByteData | (LC_HKAR_STATE_ACTIVE << 2));
LC_OperData.HkPacket.ActiveAPs++;
break;

case LC_APSTATE_PASSIVE:
case LC_ActionPointState_PASSIVE:
ByteData = (ByteData | (LC_HKAR_STATE_PASSIVE << 2));
break;

case LC_APSTATE_DISABLED:
case LC_ActionPointState_DISABLED:
ByteData = (ByteData | (LC_HKAR_STATE_DISABLED << 2));
break;

case LC_APSTATE_PERMOFF:
case LC_ActionPointState_PERMOFF:
default:
ByteData = (ByteData | (LC_HKAR_STATE_NOT_USED << 2));
break;
Expand Down Expand Up @@ -569,9 +569,9 @@ void LC_SetLCStateCmd(const CFE_SB_Buffer_t *BufPtr)

switch (CmdPtr->NewLCState)
{
case LC_STATE_ACTIVE:
case LC_STATE_PASSIVE:
case LC_STATE_DISABLED:
case LC_AppState_ACTIVE:
case LC_AppState_PASSIVE:
case LC_AppState_DISABLED:
LC_AppData.CurrentLCState = CmdPtr->NewLCState;
LC_AppData.CmdCount++;

Expand Down Expand Up @@ -618,9 +618,9 @@ void LC_SetAPStateCmd(const CFE_SB_Buffer_t *BufPtr)
*/
switch (CmdPtr->NewAPState)
{
case LC_APSTATE_ACTIVE:
case LC_APSTATE_PASSIVE:
case LC_APSTATE_DISABLED:
case LC_ActionPointState_ACTIVE:
case LC_ActionPointState_PASSIVE:
case LC_ActionPointState_DISABLED:
break;

default:
Expand Down Expand Up @@ -648,7 +648,7 @@ void LC_SetAPStateCmd(const CFE_SB_Buffer_t *BufPtr)
{
CurrentAPState = LC_OperData.ARTPtr[TableIndex].CurrentState;

if ((CurrentAPState != LC_ACTION_NOT_USED) && (CurrentAPState != LC_APSTATE_PERMOFF))
if ((CurrentAPState != LC_ActionPoint_NOT_USED) && (CurrentAPState != LC_ActionPointState_PERMOFF))
{
LC_OperData.ARTPtr[TableIndex].CurrentState = CmdPtr->NewAPState;
}
Expand All @@ -666,7 +666,7 @@ void LC_SetAPStateCmd(const CFE_SB_Buffer_t *BufPtr)
TableIndex = CmdPtr->APNumber;
CurrentAPState = LC_OperData.ARTPtr[TableIndex].CurrentState;

if ((CurrentAPState != LC_ACTION_NOT_USED) && (CurrentAPState != LC_APSTATE_PERMOFF))
if ((CurrentAPState != LC_ActionPoint_NOT_USED) && (CurrentAPState != LC_ActionPointState_PERMOFF))
{
/*
** Update state for single actionpoint specified
Expand Down Expand Up @@ -756,7 +756,7 @@ void LC_SetAPPermOffCmd(const CFE_SB_Buffer_t *BufPtr)
TableIndex = CmdPtr->APNumber;
CurrentAPState = LC_OperData.ARTPtr[TableIndex].CurrentState;

if (CurrentAPState != LC_APSTATE_DISABLED)
if (CurrentAPState != LC_ActionPointState_DISABLED)
{
/*
** Actionpoints can only be turned permanently off if
Expand All @@ -773,7 +773,7 @@ void LC_SetAPPermOffCmd(const CFE_SB_Buffer_t *BufPtr)
/*
** Update state for actionpoint specified
*/
LC_OperData.ARTPtr[TableIndex].CurrentState = LC_APSTATE_PERMOFF;
LC_OperData.ARTPtr[TableIndex].CurrentState = LC_ActionPointState_PERMOFF;

LC_AppData.CmdCount++;

Expand Down
10 changes: 5 additions & 5 deletions fsw/src/lc_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
*
* This event message is issued when the #LC_SET_AP_STATE_CC command
* has been received and the current actionpoint state is either
* #LC_ACTION_NOT_USED or #LC_APSTATE_PERMOFF which can only be changed
* #LC_ActionPoint_NOT_USED or #LC_ActionPointState_PERMOFF which can only be changed
* with a table load.
*/
#define LC_APSTATE_CURR_ERR_EID 31
Expand Down Expand Up @@ -498,7 +498,7 @@
*
* This event message is issued when the #LC_SET_AP_PERMOFF_CC command
* has been received and the current actionpoint state is not
* #LC_APSTATE_DISABLED
* #LC_ActionPointState_DISABLED
*/
#define LC_APOFF_CURR_ERR_EID 35

Expand Down Expand Up @@ -772,7 +772,7 @@
*
* This event message is issued when the #LC_SAMPLE_AP_MID message
* has been received and the current state for the specified
* actionpoint state is either #LC_ACTION_NOT_USED or #LC_APSTATE_PERMOFF.
* actionpoint state is either #LC_ActionPoint_NOT_USED or #LC_ActionPointState_PERMOFF.
*/
#define LC_APSAMPLE_CURR_ERR_EID 57

Expand All @@ -796,7 +796,7 @@
* \par Cause:
*
* This event message is issued when an actionpoint fails evaluation while
* the LC task operating state is #LC_STATE_PASSIVE
* the LC task operating state is #LC_AppState_PASSIVE
*/
#define LC_PASSIVE_FAIL_DBG_EID 59

Expand All @@ -808,7 +808,7 @@
* \par Cause:
*
* This event message is issued when an actionpoint fails evaluation while
* the actionpoint state is #LC_APSTATE_PASSIVE
* the actionpoint state is #LC_ActionPointState_PASSIVE
*/
#define LC_AP_PASSIVE_FAIL_INF_EID 60

Expand Down
Loading

0 comments on commit 0a658cd

Please sign in to comment.