Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r844f98879b7425c207b58562e623ab960adbc357 -ra31707ccbf01a1b40f8500bc491dc9c616e7a163 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 844f98879b7425c207b58562e623ab960adbc357) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a31707ccbf01a1b40f8500bc491dc9c616e7a163) @@ -321,6 +321,41 @@ return result; } + +/*********************************************************************//** + * @brief + * The sendEvent function constructs an HD 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. + * @param event Enumeration of event type that occurred + * @param dat1 First data associated with event + * @param dat2 Second data associated with event + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendEvent( EVENT_ID_T event, EVENT_DATA_T dat1, EVENT_DATA_T dat2 ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + U32 e = (U32)event; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_EVENT; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( EVENT_DATA_T ) * 2; + + 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 ) ); + + // 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_REQUIRED ); + + return result; +} /*********************************************************************//** * @brief @@ -1025,7 +1060,7 @@ * @param newValue parameter change event new data value * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendTreatmentLogEventData( EVENT_ID_T event, F32 oldValue, F32 newValue ) +BOOL sendTreatmentLogEventData( TX_EVENT_ID_T event, F32 oldValue, F32 newValue ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload;