Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r5a36a768d11cc597a36b894c1fb3a5e5590130f1 -re44aad7a9d5fa48aeaa55c65bd28ad9acde6ce05 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5a36a768d11cc597a36b894c1fb3a5e5590130f1) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e44aad7a9d5fa48aeaa55c65bd28ad9acde6ce05) @@ -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" @@ -1051,8 +1052,8 @@ return result; } - /*********************************************************************//** - * @brief +/*********************************************************************//** + * @brief * The broadcastFlushData function sends out the flush mode data. * @details Inputs: none * @details Outputs: flush data msg constructed and queued @@ -1080,6 +1081,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 @@ -2503,7 +2532,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 { @@ -2558,13 +2587,13 @@ *************************************************************************/ void handleSetFluidLeakStateDetectorOverrideRequest( MESSAGE_T *message ) { - TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; // Verify payload length - if ( sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) == message->hdr.payloadLen ) + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) { - memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) ); + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); if ( FALSE == payload.reset ) { result = testSetFluidLeakStateOverride( ( FLUID_LEAK_STATES_T)( payload.state.u32 ) ); @@ -2934,7 +2963,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 @@ -3044,8 +3073,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 @@ -3282,6 +3311,41 @@ } /*********************************************************************//** +* @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; +} + +/*********************************************************************//** * @brief * The handleFilterFlushTimePeriodOverride function handles a request * to override the filter flush time period value.