Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r24fd1893101af40cc6736aacaa20382875c80bf1 -r86eec09ab556fbd970ddcae9dc622727928ee757 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 24fd1893101af40cc6736aacaa20382875c80bf1) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 86eec09ab556fbd970ddcae9dc622727928ee757) @@ -26,6 +26,7 @@ #include "FPGA.h" #include "Heaters.h" #include "LoadCell.h" +#include "ModeChemicalDisinfect.h" #include "ModeFlush.h" #include "ModeStandby.h" #include "ModeRecirculate.h" @@ -1048,6 +1049,34 @@ /*********************************************************************//** * @brief + * The broadcastChemicalDisinfectData function sends out the chemical + * disinfect mode data. + * @details Inputs: none + * @details Outputs: chemical disinfect data msg constructed and queued + * @param chemDisinfectData which is flush msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastChemicalDisinfectData( MODE_CHEMICAL_DISINFECT_DATA_T *chemDisinfectData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_CHEM_DISINFECT_DATA; + msg.hdr.payloadLen = sizeof( MODE_CHEMICAL_DISINFECT_DATA_T ); + + memcpy( payloadPtr, chemDisinfectData, sizeof( MODE_CHEMICAL_DISINFECT_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 @@ -2346,7 +2375,7 @@ memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); if ( FALSE == payload.reset ) { - result = testSetUVReactorHealthOverride( payload.index, (BOOL)payload.state.u32 ); + result = testSetUVReactorHealthOverride( payload.index, payload.state.u32 ); } else { @@ -2777,7 +2806,7 @@ /************************************************************************* * @brief * The handleStartStopDGHeatDisinfect function handles a request start or - * stop DG heat disifect cycle. + * stop DG heat disifect mode. * @details Inputs: none * @details Outputs: message handled * @param message: a pointer to the message to handle @@ -2842,8 +2871,8 @@ /*********************************************************************//** * @brief -* The handleStartStopDGFlush function handles a request to override start -* or stop DG flush mode. +* The handleStartStopDGFlush function handles a request to start or stop +* DG flush mode. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle @@ -3079,4 +3108,39 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +/*********************************************************************//** +* @brief +* The handleStartStopDGChemicalDisinfect function handles a request to start +* or stop DG chemical disinfect mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +BOOL handleStartStopDGChemicalDisinfect( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + BOOL startingDGChemicalDisinfect; + + memcpy( &startingDGChemicalDisinfect, message->payload, sizeof(U32) ); + + if ( TRUE == startingDGChemicalDisinfect ) + { + result = startDGChemicalDisinfect(); + } + else + { + result = stopChemicalDisinfect(); + } + } + + // Respond to request + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); + + return result; +} + /**@}*/