Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r5f86e35ac3c021b68708457d17d4ef51b20aef9c -r7df1fae66b80c946ff1bcdee4b43afb5ab7a1d4c --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5f86e35ac3c021b68708457d17d4ef51b20aef9c) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 7df1fae66b80c946ff1bcdee4b43afb5ab7a1d4c) @@ -26,6 +26,8 @@ #include "FPGA.h" #include "Heaters.h" #include "LoadCell.h" +#include "ModeChemicalDisinfect.h" +#include "ModeFlush.h" #include "ModeStandby.h" #include "ModeRecirculate.h" #include "MsgQueues.h" @@ -1048,6 +1050,61 @@ /*********************************************************************//** * @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 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 @@ -2471,7 +2528,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 { @@ -2526,13 +2583,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 ) ); @@ -2902,7 +2959,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 @@ -3012,6 +3069,41 @@ /*********************************************************************//** * @brief +* 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 +* @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 @@ -3214,4 +3306,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; +} + /**@}*/