Skip to content

Commit

Permalink
Fix nasa#106, Consolidate HK variables that are duplicated in the global
Browse files Browse the repository at this point in the history
struct
  • Loading branch information
thnkslprpt committed Jun 29, 2023
1 parent 98283b6 commit c05eee0
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 221 deletions.
19 changes: 1 addition & 18 deletions fsw/src/fm_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ CFE_Status_t FM_AppInit(void)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr)
{
FM_HousekeepingPkt_Payload_t *PayloadPtr;
FM_HousekeepingPkt_Payload_t *PayloadPtr = &FM_GlobalData.HousekeepingPkt.Payload;

FM_ReleaseTablePointers();

Expand All @@ -258,25 +258,8 @@ void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr)
CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_HK_TLM_MID),
sizeof(FM_HousekeepingPkt_t));

PayloadPtr = &FM_GlobalData.HousekeepingPkt.Payload;

/* Report application command counters */
PayloadPtr->CommandCounter = FM_GlobalData.CommandCounter;
PayloadPtr->CommandErrCounter = FM_GlobalData.CommandErrCounter;

PayloadPtr->NumOpenFiles = FM_GetOpenFilesData(NULL);

/* Report child task command counters */
PayloadPtr->ChildCmdCounter = FM_GlobalData.ChildCmdCounter;
PayloadPtr->ChildCmdErrCounter = FM_GlobalData.ChildCmdErrCounter;
PayloadPtr->ChildCmdWarnCounter = FM_GlobalData.ChildCmdWarnCounter;

PayloadPtr->ChildQueueCount = FM_GlobalData.ChildQueueCount;

/* Report current and previous commands executed by the child task */
PayloadPtr->ChildCurrentCC = FM_GlobalData.ChildCurrentCC;
PayloadPtr->ChildPreviousCC = FM_GlobalData.ChildPreviousCC;

CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader));
CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader), true);
}
18 changes: 3 additions & 15 deletions fsw/src/fm_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,9 @@ typedef struct
osal_id_t ChildSemaphore; /**< \brief Child task wakeup counting semaphore */
osal_id_t ChildQueueCountSem; /**< \brief Child queue counter mutex semaphore */

uint8 ChildCmdCounter; /**< \brief Child task command success counter */
uint8 ChildCmdErrCounter; /**< \brief Child task command error counter */
uint8 ChildCmdWarnCounter; /**< \brief Child task command warning counter */

uint8 ChildWriteIndex; /**< \brief Array index for next write to command args */
uint8 ChildReadIndex; /**< \brief Array index for next read from command args */
uint8 ChildQueueCount; /**< \brief Number of pending commands in queue */

uint8 CommandCounter; /**< \brief Application command success counter */
uint8 CommandErrCounter; /**< \brief Application command error counter */
uint8 Spare8a; /**< \brief Placeholder for unused command warning counter */

uint8 ChildCurrentCC; /**< \brief Command code currently executing */
uint8 ChildPreviousCC; /**< \brief Command code previously executed */
uint8 Spare8b; /**< \brief Structure alignment spare */
uint8 ChildWriteIndex; /**< \brief Array index for next write to command args */
uint8 ChildReadIndex; /**< \brief Array index for next read from command args */
uint16 Padding; /**< \brief Structure padding to align to 32-bit boundaries */

uint32 FileStatTime; /**< \brief Modify time from most recent OS_stat */
uint32 FileStatSize; /**< \brief File size from most recent OS_stat */
Expand Down
Loading

0 comments on commit c05eee0

Please sign in to comment.