Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r2468e56fbecd26da713bc78535bd727f4b105fe1 -r30d2d3b2e9a4c45e1268aee02132da6d3d6d53d4 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 2468e56fbecd26da713bc78535bd727f4b105fe1) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 30d2d3b2e9a4c45e1268aee02132da6d3d6d53d4) @@ -227,17 +227,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 );