Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r35de566c96433689821b7a21f731df26b40d67ae -r497dc26e76083742903525aab1490a6900e94969 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 35de566c96433689821b7a21f731df26b40d67ae) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 497dc26e76083742903525aab1490a6900e94969) @@ -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" @@ -1048,6 +1049,33 @@ /*********************************************************************//** * @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. * @details Inputs: none * @details Outputs: DG system record msg constructed and queued @@ -2906,6 +2934,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