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 #1546, use cfe time clock state enum t in cmd/tlm and handling #1663

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
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
33 changes: 17 additions & 16 deletions modules/time/fsw/inc/cfe_time_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,11 @@ typedef struct CFE_TIME_SetLeapSecondsCmd
*/
typedef struct CFE_TIME_StateCmd_Payload
{
int16 ClockState; /**< \brief #CFE_TIME_ClockState_INVALID=Spacecraft time has not been accurately set,
#CFE_TIME_ClockState_VALID=Spacecraft clock has been accurately set,
#CFE_TIME_ClockState_FLYWHEEL=Force into FLYWHEEL mode */
/**< Selects the current clock state */
CFE_TIME_ClockState_Enum_t ClockState; /**< \brief #CFE_TIME_ClockState_INVALID=Spacecraft time has
not been accurately set, #CFE_TIME_ClockState_VALID=Spacecraft clock
has been accurately set, #CFE_TIME_ClockState_FLYWHEEL=Force into
FLYWHEEL mode */
/**< Selects the current clock state */
} CFE_TIME_StateCmd_Payload_t;

/**
Expand Down Expand Up @@ -883,10 +884,10 @@ typedef CFE_TIME_OneHzAdjustmentCmd_t CFE_TIME_Sub1HZAdjustmentCmd_t;
*/
typedef struct CFE_TIME_ToneDataCmd_Payload
{
CFE_TIME_SysTime_t AtToneMET; /**< \brief MET at time of tone */
CFE_TIME_SysTime_t AtToneSTCF; /**< \brief STCF at time of tone */
int16 AtToneLeapSeconds; /**< \brief Leap Seconds at time of tone */
int16 AtToneState; /**< \brief Clock state at time of tone */
CFE_TIME_SysTime_t AtToneMET; /**< \brief MET at time of tone */
CFE_TIME_SysTime_t AtToneSTCF; /**< \brief STCF at time of tone */
int16 AtToneLeapSeconds; /**< \brief Leap Seconds at time of tone */
CFE_TIME_ClockState_Enum_t AtToneState; /**< \brief Clock state at time of tone */
} CFE_TIME_ToneDataCmd_Payload_t;

/**
Expand Down Expand Up @@ -916,10 +917,10 @@ typedef struct CFE_TIME_HousekeepingTlm_Payload
/*
** Clock state flags and "as calculated" clock state...
*/
uint16 ClockStateFlags; /**< \cfetlmmnemonic \TIME_STATEFLG
\brief State Flags */
int16 ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE
\brief API State */
uint16 ClockStateFlags; /**< \cfetlmmnemonic \TIME_STATEFLG
\brief State Flags */
CFE_TIME_ClockState_Enum_t ClockStateAPI; /**< \cfetlmmnemonic
\TIME_APISTATE \brief API State */

/*
** Leap Seconds...
Expand Down Expand Up @@ -987,10 +988,10 @@ typedef struct CFE_TIME_DiagnosticTlm_Payload
CFE_TIME_SysTime_t AtToneLatch; /**< \cfetlmmnemonic \TIME_TVALIDS
\brief Local clock latched at time of tone */

int16 AtToneLeapSeconds; /**< \cfetlmmnemonic \TIME_LEAPS
\brief Leap Seconds at time of tone */
int16 ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE
\brief Clock state as per API */
int16 AtToneLeapSeconds; /**< \cfetlmmnemonic \TIME_LEAPS
\brief Leap Seconds at time of tone */
CFE_TIME_ClockState_Enum_t ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE
\brief Clock state as per API */

/*
** Data values that reflect the time (right now)...
Expand Down
8 changes: 4 additions & 4 deletions modules/time/fsw/src/cfe_time_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void CFE_TIME_GetHkData(const CFE_TIME_Reference_t *Reference)
/*
** Current "as calculated" clock state...
*/
CFE_TIME_Global.HkPacket.Payload.ClockStateAPI = (int16)CFE_TIME_CalculateState(Reference);
CFE_TIME_Global.HkPacket.Payload.ClockStateAPI = (CFE_TIME_ClockState_Enum_t)CFE_TIME_CalculateState(Reference);

/*
** Current clock state flags...
Expand Down Expand Up @@ -728,9 +728,9 @@ CFE_TIME_SysTime_t CFE_TIME_CalculateUTC(const CFE_TIME_Reference_t *Reference)
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
int16 CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference)
CFE_TIME_ClockState_Enum_t CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference)
{
int16 ClockState;
CFE_TIME_ClockState_Enum_t ClockState;

/*
** Determine the current clock state...
Expand Down Expand Up @@ -782,7 +782,7 @@ int16 CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference)
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
void CFE_TIME_SetState(int16 NewState)
void CFE_TIME_SetState(CFE_TIME_ClockState_Enum_t NewState)
{
volatile CFE_TIME_ReferenceState_t *RefState;

Expand Down
12 changes: 6 additions & 6 deletions modules/time/fsw/src/cfe_time_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ typedef struct
/*
** Pending data values (from "time at tone" command data)...
*/
CFE_TIME_SysTime_t PendingMET;
CFE_TIME_SysTime_t PendingSTCF;
int16 PendingLeaps;
int16 PendingState;
CFE_TIME_SysTime_t PendingMET;
CFE_TIME_SysTime_t PendingSTCF;
int16 PendingLeaps;
CFE_TIME_ClockState_Enum_t PendingState;

/*
** STCF adjustment values...
Expand Down Expand Up @@ -395,13 +395,13 @@ CFE_TIME_SysTime_t CFE_TIME_CalculateUTC(const CFE_TIME_Reference_t *Reference);
/**
* @brief determine current time state (per API)
*/
int16 CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference);
CFE_TIME_ClockState_Enum_t CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference);

/*---------------------------------------------------------------------------------------*/
/**
* @brief set clock state
*/
void CFE_TIME_SetState(int16 NewState);
void CFE_TIME_SetState(CFE_TIME_ClockState_Enum_t NewState);

#if (CFE_PLATFORM_TIME_CFG_SOURCE == true)

Expand Down