Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r3728ad1f09658c3495a11c6ba8e784bcfdfe3794 -r43aeaa281c1de71abc4342644442417b6970e093 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 3728ad1f09658c3495a11c6ba8e784bcfdfe3794) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 43aeaa281c1de71abc4342644442417b6970e093) @@ -262,17 +262,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_DG_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 datas + 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_DG_2_UI, ACK_NOT_REQUIRED );