From 13a60fad3a560452eb97db63272ec09998ebf007 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 30 Sep 2021 14:19:39 -0400 Subject: [PATCH] Fix #106, Use CFE_MSG_PTR conversion macro Updates conversions to CFE_Message_t to use the MSG macro This also uses consistent naming - TelemetryHeader rather than TlmHeader --- fsw/src/to_lab_app.c | 12 ++++++------ fsw/src/to_lab_msg.h | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fsw/src/to_lab_app.c b/fsw/src/to_lab_app.c index 39ffd85..9f9bd6c 100644 --- a/fsw/src/to_lab_app.c +++ b/fsw/src/to_lab_app.c @@ -165,7 +165,7 @@ int32 TO_LAB_init(void) /* ** Initialize housekeeping packet (clear user data area)... */ - CFE_MSG_Init(&TO_LAB_Global.HkTlm.TlmHeader.Msg, CFE_SB_ValueToMsgId(TO_LAB_HK_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(TO_LAB_Global.HkTlm.TelemetryHeader), CFE_SB_ValueToMsgId(TO_LAB_HK_TLM_MID), sizeof(TO_LAB_Global.HkTlm)); status = CFE_TBL_Register(&TO_SubTblHandle, "TO_LAB_Subs", sizeof(*TO_LAB_Subs), CFE_TBL_OPT_DEFAULT, NULL); @@ -396,10 +396,10 @@ int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypesCmd_t *data) char string_variable[10] = "ABCDEFGHIJ"; /* initialize data types packet */ - CFE_MSG_Init(&TO_LAB_Global.DataTypesTlm.TlmHeader.Msg, CFE_SB_ValueToMsgId(TO_LAB_DATA_TYPES_MID), + CFE_MSG_Init(CFE_MSG_PTR(TO_LAB_Global.DataTypesTlm.TelemetryHeader), CFE_SB_ValueToMsgId(TO_LAB_DATA_TYPES_MID), sizeof(TO_LAB_Global.DataTypesTlm)); - CFE_SB_TimeStampMsg(&TO_LAB_Global.DataTypesTlm.TlmHeader.Msg); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(TO_LAB_Global.DataTypesTlm.TelemetryHeader)); /* initialize the packet data */ TO_LAB_Global.DataTypesTlm.Payload.synch = 0x6969; @@ -430,7 +430,7 @@ int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypesCmd_t *data) for (i = 0; i < 10; i++) TO_LAB_Global.DataTypesTlm.Payload.str[i] = string_variable[i]; - CFE_SB_TransmitMsg(&TO_LAB_Global.DataTypesTlm.TlmHeader.Msg, true); + CFE_SB_TransmitMsg(CFE_MSG_PTR(TO_LAB_Global.DataTypesTlm.TelemetryHeader), true); ++TO_LAB_Global.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; @@ -443,8 +443,8 @@ int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypesCmd_t *data) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ int32 TO_LAB_SendHousekeeping(const CFE_MSG_CommandHeader_t *data) { - CFE_SB_TimeStampMsg(&TO_LAB_Global.HkTlm.TlmHeader.Msg); - CFE_SB_TransmitMsg(&TO_LAB_Global.HkTlm.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(TO_LAB_Global.HkTlm.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(TO_LAB_Global.HkTlm.TelemetryHeader), true); return CFE_SUCCESS; } diff --git a/fsw/src/to_lab_msg.h b/fsw/src/to_lab_msg.h index e2a72c1..85f5a2f 100644 --- a/fsw/src/to_lab_msg.h +++ b/fsw/src/to_lab_msg.h @@ -48,8 +48,8 @@ typedef struct typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - TO_LAB_HkTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + TO_LAB_HkTlm_Payload_t Payload; /**< \brief Telemetry payload */ } TO_LAB_HkTlm_t; /******************************************************************************/ @@ -78,8 +78,8 @@ typedef struct typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - TO_LAB_DataTypes_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + TO_LAB_DataTypes_Payload_t Payload; /**< \brief Telemetry payload */ } TO_LAB_DataTypesTlm_t; /******************************************************************************/