Skip to content

Commit

Permalink
Merge pull request #157 from jphickey/fix-156-messagetype-conv
Browse files Browse the repository at this point in the history
Fix #156, Use CFE_MSG_PTR conversion macro
  • Loading branch information
astrogeco committed Nov 17, 2021
2 parents d009197 + 70a25ea commit 87d426c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int32 SAMPLE_APP_Init(void)
/*
** Initialize housekeeping packet (clear user data area).
*/
CFE_MSG_Init(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, CFE_SB_ValueToMsgId(SAMPLE_APP_HK_TLM_MID),
CFE_MSG_Init(CFE_MSG_PTR(SAMPLE_APP_Data.HkTlm.TelemetryHeader), CFE_SB_ValueToMsgId(SAMPLE_APP_HK_TLM_MID),
sizeof(SAMPLE_APP_Data.HkTlm));

/*
Expand Down Expand Up @@ -327,8 +327,8 @@ int32 SAMPLE_APP_ReportHousekeeping(const CFE_MSG_CommandHeader_t *Msg)
/*
** Send housekeeping telemetry packet...
*/
CFE_SB_TimeStampMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg);
CFE_SB_TransmitMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, true);
CFE_SB_TimeStampMsg(CFE_MSG_PTR(SAMPLE_APP_Data.HkTlm.TelemetryHeader));
CFE_SB_TransmitMsg(CFE_MSG_PTR(SAMPLE_APP_Data.HkTlm.TelemetryHeader), true);

/*
** Manage any pending table loads, validations, etc.
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/sample_app_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ typedef struct

typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */
SAMPLE_APP_HkTlm_Payload_t Payload; /**< \brief Telemetry payload */
CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */
SAMPLE_APP_HkTlm_Payload_t Payload; /**< \brief Telemetry payload */
} SAMPLE_APP_HkTlm_t;

#endif /* SAMPLE_APP_MSG_H */
5 changes: 2 additions & 3 deletions unit-test/coveragetest/coveragetest_sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,11 @@ void Test_SAMPLE_APP_ReportHousekeeping(void)

/* Confirm message sent*/
UtAssert_True(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)) == 1, "CFE_SB_TransmitMsg() called once");
UtAssert_True(MsgSend == &SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, "CFE_SB_TransmitMsg() address matches expected");
UtAssert_ADDRESS_EQ(MsgSend, &SAMPLE_APP_Data.HkTlm);

/* Confirm timestamp msg address */
UtAssert_True(UT_GetStubCount(UT_KEY(CFE_SB_TimeStampMsg)) == 1, "CFE_SB_TimeStampMsg() called once");
UtAssert_True(MsgTimestamp == &SAMPLE_APP_Data.HkTlm.TlmHeader.Msg,
"CFE_SB_TimeStampMsg() address matches expected");
UtAssert_ADDRESS_EQ(MsgTimestamp, &SAMPLE_APP_Data.HkTlm);

/*
* Confirm that the CFE_TBL_Manage() call was done
Expand Down

0 comments on commit 87d426c

Please sign in to comment.