Skip to content

Commit

Permalink
Fix #16, Convert LC state macros to enums
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Nov 2, 2022
1 parent 543cf6b commit 440e5e1
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 45 deletions.
4 changes: 2 additions & 2 deletions fsw/src/lc_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command Header */

uint16 APNumber; /**< \brief Which actionpoint(s) to change */
uint16 NewAPState; /**< \brief New actionpoint state */
uint16 APNumber; /**< \brief Which actionpoint(s) to change */
LC_APState_t NewAPState; /**< \brief New actionpoint state */
} LC_SetAPState_t;

/**
Expand Down
32 changes: 20 additions & 12 deletions fsw/src/lc_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,37 @@
#include "lc_platform_cfg.h"

/************************************************************************
* Macro Definitions
* Type Definitions
************************************************************************/

/**
* \name LC Application States
* \{
*/
#define LC_STATE_ACTIVE 1 /**< \brief LC Application State Active */
#define LC_STATE_PASSIVE 2 /**< \brief LC Application State Pasive */
#define LC_STATE_DISABLED 3 /**< \brief LC Application State Disabled */
#define LC_STATE_FROM_CDS 4 /**< \brief Used for reset processing, not valid state */
/**\}*/
typedef enum LC_AppState
{
LC_STATE_ACTIVE = 1, /**< \brief LC Application State Active */
LC_STATE_PASSIVE, /**< \brief LC Application State Pasive */
LC_STATE_DISABLED, /**< \brief LC Application State Disabled */
LC_STATE_FROM_CDS /**< \brief Used for reset processing, not valid state */
} LC_AppState_t;

/**
* \name Actionpoint States
* \{
*/
#define LC_ACTION_NOT_USED 0xFF /**< \brief Actionpoint unused, not valid command argument */
#define LC_APSTATE_ACTIVE 1 /**< \brief Actionpoint state active */
#define LC_APSTATE_PASSIVE 2 /**< \brief Actionpoint state passive */
#define LC_APSTATE_DISABLED 3 /**< \brief Actionpoint state disabled */
#define LC_APSTATE_PERMOFF 4 /**< \brief Actionpoint state permanently off, see #LC_SET_AP_PERMOFF_CC */
/**\}*/
typedef enum LC_APState
{
LC_APSTATE_ACTIVE = 1, /**< \brief Actionpoint state active */
LC_APSTATE_PASSIVE, /**< \brief Actionpoint state passive */
LC_APSTATE_DISABLED, /**< \brief Actionpoint state disabled */
LC_APSTATE_PERMOFF, /**< \brief Actionpoint state permanently off, see #LC_SET_AP_PERMOFF_CC */
LC_ACTION_NOT_USED = 255 /**< \brief Actionpoint unused, not valid command argument */
} LC_APState_t;

/************************************************************************
* Macro Definitions
************************************************************************/

/**
* \name Special Values for Commands
Expand Down
62 changes: 31 additions & 31 deletions fsw/src/lc_tbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,30 @@ typedef struct
*/
typedef struct
{
uint8 DefaultState; /**< \brief Default state for this AP (enumerated)
States are defined in lc_msgdefs.h */
uint8 MaxPassiveEvents; /**< \brief Max number of events before filter
- RTS not started because AP is passive */
uint8 MaxPassFailEvents; /**< \brief Max number of events before filter
- AP result transition from pass to fail */
uint8 MaxFailPassEvents; /**< \brief Max number of events before filter
- AP result transition from fail to pass */
uint16 RTSId; /**< \brief RTS to request if this AP fails */
uint16 MaxFailsBeforeRTS; /**< \brief How may consecutive failures before
an RTS request is issued */

uint16 RPNEquation[LC_MAX_RPN_EQU_SIZE]; /**< \brief Reverse Polish Equation that
specifies when this actionpoint
should fail */
LC_APState_t DefaultState; /**< \brief Default state for this AP (enumerated)
States are defined in lc_msgdefs.h */
uint8 MaxPassiveEvents; /**< \brief Max number of events before filter
- RTS not started because AP is passive */
uint8 MaxPassFailEvents; /**< \brief Max number of events before filter
- AP result transition from pass to fail */
uint8 MaxFailPassEvents; /**< \brief Max number of events before filter
- AP result transition from fail to pass */
uint16 RTSId; /**< \brief RTS to request if this AP fails */
uint16 MaxFailsBeforeRTS; /**< \brief How may consecutive failures before
an RTS request is issued */

uint16 RPNEquation[LC_MAX_RPN_EQU_SIZE]; /**< \brief Reverse Polish Equation
that specifies when this
actionpoint should fail */

uint16 EventType; /**< \brief Event type used for event msg if AP fails:
#CFE_EVS_EventType_INFORMATION,
#CFE_EVS_EventType_DEBUG,
#CFE_EVS_EventType_ERROR,
or #CFE_EVS_EventType_CRITICAL */
or #CFE_EVS_EventType_CRITICAL */

uint16 EventID; /**< \brief Event ID used for event msg if AP fails
See lc_events.h for those already in use */
See lc_events.h for those already in use */

char EventText[LC_MAX_ACTION_TEXT]; /**< \brief Text used for the event msg when
this AP fails */
Expand All @@ -125,12 +125,12 @@ typedef struct
typedef struct
{
uint32 Value; /**< \brief Watchpoint value at comparison that caused
the transition */
uint8 DataType; /**< \brief Same as Watchpoint Data Type (enumerated) */
the transition */
uint8 DataType; /**< \brief Same as Watchpoint Data Type (enumerated) */

uint8 Padding[3]; /**< \brief Structure padding */

CFE_TIME_SysTime_t Timestamp; /**< \brief Timstamp when the transition was detected */
CFE_TIME_SysTime_t Timestamp; /**< \brief Timstamp when the transition was detected */
} LC_WRTTransition_t;

/**
Expand All @@ -139,33 +139,33 @@ typedef struct
typedef struct
{
uint8 WatchResult; /**< \brief Result for the last evaluation of this
watchpoint (enumerated) */
watchpoint (enumerated) */

uint8 Padding[3]; /**< \brief Structure padding */

uint32 CountdownToStale; /**< \brief Number of LC Sample Actionpoint
commands still to be processed
before WatchResult becomes stale */
before WatchResult becomes stale */
uint32 EvaluationCount; /**< \brief How many times this watchpoint has
been evaluated */
been evaluated */
uint32 FalseToTrueCount; /**< \brief How many times this watchpoint has
transitioned from FALSE to TRUE */
transitioned from FALSE to TRUE */
uint32 ConsecutiveTrueCount; /**< \brief Number of consecutive times this
watchpoint has evaluated to TRUE */
watchpoint has evaluated to TRUE */
uint32 CumulativeTrueCount; /**< \brief Total number of times this watchpoint
has evaluated to TRUE */
LC_WRTTransition_t LastFalseToTrue; /**< \brief Last transition from FALSE to TRUE */
LC_WRTTransition_t LastTrueToFalse; /**< \brief Last transition from TRUE to FALSE */
has evaluated to TRUE */
LC_WRTTransition_t LastFalseToTrue; /**< \brief Last transition from FALSE to TRUE */
LC_WRTTransition_t LastTrueToFalse; /**< \brief Last transition from TRUE to FALSE */
} LC_WRTEntry_t;

/**
* \brief Actionpoint Results Table (ART) Entry
*/
typedef struct
{
uint8 ActionResult; /**< \brief Result for the last sample of this
actionpoint */
uint8 CurrentState; /**< \brief Current state of this actionpoint */
uint8 ActionResult; /**< \brief Result for the last sample of this actionpoint */

LC_APState_t CurrentState; /**< \brief Current state of this actionpoint */

uint16 Padding; /**< \brief Structure padding */

Expand Down

0 comments on commit 440e5e1

Please sign in to comment.