Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r5bfaf341319b9fd763d07ad0a68a986028c37587 -rf7cdfd3256f195cd8aa06e28009cd5f26b50f08c --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5bfaf341319b9fd763d07ad0a68a986028c37587) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision f7cdfd3256f195cd8aa06e28009cd5f26b50f08c) @@ -8,7 +8,7 @@ * @file SystemCommMessages.c * * @author (last) Dara Navaei -* @date (last) 09-Nov-2021 +* @date (last) 12-Nov-2021 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -355,10 +355,10 @@ /*********************************************************************//** * @brief - * The sendEvent function constructs an HD event message to the UI and + * The sendEvent function constructs an DG event message to the UI and * queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none - * @details Outputs: HD event msg constructed and queued. + * @details Outputs: DG event msg constructed and queued. * @param event Enumeration of event type that occurred * @param dat1 First data associated with event * @param dat2 Second data associated with event @@ -370,17 +370,25 @@ MESSAGE_T msg; U08 *payloadPtr = msg.payload; U32 e = (U32)event; + // Convert the two data types enums to U32. The enums are interpreted as a U08 by the compiler + U32 dataType1 = (U32)dat1.dataType; + U32 dataType2 = (U32)dat2.dataType; // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_EVENT; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( EVENT_DATA_T ) * 2; + // The payload length is the event ID, 2 event datas and the events data types for each of the event data + msg.hdr.payloadLen = sizeof( U32 ) + 2 * sizeof( EVENT_DATAS_T ) + 2 * sizeof( U32 ); memcpy( payloadPtr, &e, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &dat1, sizeof( EVENT_DATA_T ) ); - payloadPtr += sizeof( EVENT_DATA_T ); - memcpy( payloadPtr, &dat2, sizeof( EVENT_DATA_T ) ); + memcpy( payloadPtr, &dataType1, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &dat1.data, sizeof( EVENT_DATAS_T ) ); + payloadPtr += sizeof( EVENT_DATAS_T ); + memcpy( payloadPtr, &dataType2, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &dat2.data, sizeof( EVENT_DATAS_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED );