Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r5f86e35ac3c021b68708457d17d4ef51b20aef9c -r99b0c8f1ff9f9319f68e5043cd8c007e317a05c0 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5f86e35ac3c021b68708457d17d4ef51b20aef9c) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 99b0c8f1ff9f9319f68e5043cd8c007e317a05c0) @@ -26,6 +26,7 @@ #include "FPGA.h" #include "Heaters.h" #include "LoadCell.h" +#include "ModeFlush.h" #include "ModeStandby.h" #include "ModeRecirculate.h" #include "MsgQueues.h" @@ -1046,6 +1047,33 @@ return result; } + /*********************************************************************//** + * @brief + * The broadcastFlushData function sends out the flush mode data. + * @details Inputs: none + * @details Outputs: flush data msg constructed and queued + * @param flushData which is flush msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastFlushData( MODE_FLUSH_DATA_T *flushData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_FLUSH_DATA; + msg.hdr.payloadLen = sizeof( MODE_FLUSH_DATA_T ); + + memcpy( payloadPtr, flushData, sizeof( MODE_FLUSH_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_DG_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + /*********************************************************************//** * @brief * The sendDGSystemRecord function sends out the DG system record. @@ -3012,6 +3040,41 @@ /*********************************************************************//** * @brief +* The handleStartStopDGFlush function handles a request to override start +* or stop DG flush mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +BOOL handleStartStopDGFlush( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + BOOL startingDGFlush; + + memcpy( &startingDGFlush, message->payload, sizeof(U32) ); + + if ( TRUE == startingDGFlush ) + { + result = startDGFlush(); + } + else + { + result = stopDGFlush(); + } + } + + // Respond to request + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); + + return result; +} + +/*********************************************************************//** +* @brief * The handleGetDGCalibrationRecord function handles a request to get the DG * calibration data record. * @details Inputs: none