Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r54f45c387430e440ab4607451fc84dea61f273f1 -r28672c1c97532a025a2ca23148760904bde814e5 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 54f45c387430e440ab4607451fc84dea61f273f1) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 28672c1c97532a025a2ca23148760904bde814e5) @@ -40,6 +40,8 @@ #include "Utilities.h" #include "Valves.h" #include "WatchdogMgmt.h" +#include "ModeHeatDisinfect.h" +#include "UVReactors.h" /** * @addtogroup SystemCommMessages @@ -453,33 +455,25 @@ /*********************************************************************//** * @brief - * The broadcastHeatersData function sends out DG heaters data - * @details - * Inputs : heaters data - * Outputs : heatears data msg constructed and queued - * @param mainPrimaryDC main primary heater duty cycle - * @param smallPrimaryDC small primary heater duty cycle - * @param trimmerDC trimmer heater duty cycle + * The broadcastHeatersData function sends out DG heaters data. + * @details Inputs: none + * @details Outputs: heaters data msg constructed and queued + * @param heaters msg constructed and queued * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastHeatersData ( U32 mainPrimaryDC, U32 smallPrimaryDC, U32 trimmerDC ) +BOOL broadcastHeatersData ( HEATERS_DATA_T *heatersData ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - HEATERS_DATA_T payload; // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_HEATERS_DATA; msg.hdr.payloadLen = sizeof( HEATERS_DATA_T ); - payload.mainPrimayHeaterDC = mainPrimaryDC; - payload.smallPrimaryHeaterDC = smallPrimaryDC; - payload.trimmerHeaterDC = trimmerDC; + memcpy( payloadPtr, heatersData, sizeof( HEATERS_DATA_T ) ); - memcpy( payloadPtr, &payload, sizeof( HEATERS_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 ); @@ -492,29 +486,22 @@ * @details * Inputs : none * Outputs : RO pump data msg constructed and queued - * @param tgtPressure target pressure for RO pump in PSI - * @param measFlow measure RO flow rate in LPM - * @param setPWM set PWM duty cycle in % + * @param RO Pump msg constructed and queued * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastROPumpData( U32 tgtPressure, F32 measFlow, F32 setPWM ) +BOOL broadcastROPumpData( RO_PUMP_DATA_T *pumpData ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - RO_PUMP_DATA_T payload; // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_RO_PUMP_DATA; msg.hdr.payloadLen = sizeof( RO_PUMP_DATA_T ); + + memcpy( payloadPtr, pumpData, sizeof( RO_PUMP_DATA_T ) ); - payload.setROPumpPressure = tgtPressure; - payload.measROFlowRate = measFlow; - payload.roPumpPWM = setPWM; - - memcpy( payloadPtr, &payload, sizeof( RO_PUMP_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 ); @@ -523,31 +510,25 @@ /*********************************************************************//** * @brief - * The broadcastDrainPumpData function sends out RO pump data. - * @details - * Inputs : none - * Outputs : Drain pump data msg constructed and queued - * @param tgtSpeed target speed for drain pump in RPM - * @param dac set DAC value + * The broadcastDrainPumpData function sends out the drain pump data. + * @details Inputs : none + * @details Outputs : Drain pump data msg constructed and queued + * @param drain pump data structure pointer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastDrainPumpData( U32 tgtSpeed, U32 dac ) +BOOL broadcastDrainPumpData( DRAIN_PUMP_DATA_T *drainPumpData ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - DRAIN_PUMP_DATA_T payload; // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DRAIN_PUMP_DATA; msg.hdr.payloadLen = sizeof( DRAIN_PUMP_DATA_T ); - payload.setDrainPumpSpeed = tgtSpeed; - payload.dacValue = dac; + memcpy( payloadPtr, drainPumpData, sizeof( DRAIN_PUMP_DATA_T ) ); - memcpy( payloadPtr, &payload, sizeof( DRAIN_PUMP_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 ); @@ -653,6 +634,36 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); return result; +} + +/************************************************************************* + * @brief + * The broadcastHeatDisinfectData function sends out DG heat disinfection + * data + * Inputs : DG heat disinfect data + * Outputs : DG heat disinfect data msg constructed and queued + * @param internalState : The state of the internal state machine of the mode + * @param minutesElapsed: Minutes elapsed since the start of heat disinfection + * @param currentCycle: Current cycle count of DG heat disinfection + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastHeatDisinfectData( DG_HEAT_DISINFECT_DATA_T *data ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_HEAT_DISINFECT_DATA; + msg.hdr.payloadLen = sizeof( DG_HEAT_DISINFECT_DATA_T ); + + memcpy( payloadPtr, data, sizeof( DG_HEAT_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; } /*********************************************************************//** @@ -690,6 +701,87 @@ return result; } +/*********************************************************************//** + * @brief + * The broadcastUVReactorsData function sends out the UV reactors data. + * @details Inputs: none + * @details Outputs: UV reactors data msg constructed and queued + * @param UV reactors msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastUVReactorsData( UV_REACTORS_DATA_T *uvReactorsData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_UV_REACTORS_DATA; + msg.hdr.payloadLen = sizeof( UV_REACTORS_DATA_T ); + + memcpy( payloadPtr, uvReactorsData, sizeof( UV_REACTORS_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 broadcastThermistorsData function sends out the thermistors data. + * @details + * @details Inputs: none + * @details Outputs: thermistors data msg constructed and queued + * @param thermistors msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastThermistorsData( THERMISTORS_DATA_T *thermistorsData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_THERMISTORS_DATA; + msg.hdr.payloadLen = sizeof( THERMISTORS_DATA_T ); + + memcpy( payloadPtr, thermistorsData, sizeof( THERMISTORS_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 broadcastFansData function sends out the fans data. + * @details Inputs: none + * @details Outputs: fans data msg constructed and queued + * @param fans msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastFansData( FANS_DATA_T *fansData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_FANS_DATA; + msg.hdr.payloadLen = sizeof( FANS_DATA_T ); + + memcpy( payloadPtr, fansData, sizeof( FANS_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; +} // *********************************************************************** // **************** Message Handling Helper Functions ******************** @@ -1007,6 +1099,42 @@ /************************************************************************* + * @brief + * The handleStartStopDGHeatDisinfect function handles a request start or + * stop DG heat disifect + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return result + *************************************************************************/ +BOOL handleStartStopDGHeatDisinfect( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + BOOL startingDGHeatDisinfect; + + memcpy( &startingDGHeatDisinfect, message->payload, sizeof(U32) ); + + if ( TRUE == startingDGHeatDisinfect ) + { + startDGHeatDisinfect(); + result = TRUE; + } + else + { + stopDGHeatDisinfect(); + result = TRUE; + } + } + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); + + return result; +} + +/************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -1427,44 +1555,10 @@ /*********************************************************************//** * @brief - * The handleTestROPumpSetPointOverrideRequest function handles a request to - * override the RO pump pressure set point (in PSI). - * @details - * Inputs : none - * Outputs : message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleTestROPumpSetPointOverrideRequest( MESSAGE_T *message ) -{ - TEST_OVERRIDE_PAYLOAD_T payload; - BOOL result = FALSE; - - // verify payload length - if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) - { - memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); - if ( FALSE == payload.reset ) - { - result = testSetTargetROPumpPressureOverride( payload.state.u32 ); - } - else - { - result = testResetTargetROPumpPressureOverride(); - } - } - - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief * The handleTestROMeasuredFlowOverrideRequest function handles a request to - * override the RO flow rate. - * @details - * Inputs : none - * Outputs : message handled + * override the RO measured flow rate. + * @details Inputs: none + * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -1534,7 +1628,7 @@ * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleTestDrainPumpSetPointOverrideRequest( MESSAGE_T *message ) +void handleTestDrainPumpRPMOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; @@ -1543,14 +1637,8 @@ if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); - if ( FALSE == payload.reset ) - { - result = testSetTargetDrainPumpSpeedOverride( payload.state.u32 ); - } - else - { - result = testResetTargetDrainPumpSpeedOverride(); - } + + result = testSetTargetDrainPumpRPM( payload.state.u32 ); } // respond to request @@ -1656,16 +1744,110 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/*********************************************************************//** - * @brief - * The handleTestDGSafetyShutdownOverrideRequest function handles a - * request to override the safety shutdown signal. - * @details - * Inputs : none - * Outputs : message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ +/************************************************************************* + * @brief + * The handleSetDrainPumpDeltaPressureOverrideRequest function handles a + * request to override the delta pressure for the drain pump. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetDrainPumpDeltaPressureOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = 0; + /* verify payload length */ + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + + result = testSetTargetDrainPumpDeltaPressure( (U32)(payload.state.u32) ); + } + /* respond to request */ + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/************************************************************************* + * @brief + * The handleSetHeatDisinfectRecircStateDurationOverrideRequest function handles a \n + * request to override the heat disinfection recirculation state duration in minutes + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( F32, handleSetHeatDisinfectRecircStateDurationOverrideRequest, \ + testSetHeatDisinfectRecircDurationOverride, testResetHeatDisinfectRecircDurationOverride ) + +/************************************************************************* + * @brief + * The handleSetHeatDisinfectRSVR1ToRSVR2StateDurationOverrideRequest \n + * function handles a request to override the heat disinfection reservoir 1 \n + * to reservoir 2 state duration in minutes + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( F32, handleSetHeatDisinfectRSVR1ToRSVR2StateDurationOverrideRequest, \ + testSetHeatDisinfectR1ToR2DurationOverride, testResetHeatDisinfectR1ToR2DurationOverride ) + +/************************************************************************* + * @brief + * The handleSetHeatDisinfectRSVR2ToRSVR1StateDurationOverrideRequest \n + * function handles a request to override the heat disinfection reservoir 2 \n + * to reservoir 1 state duration in minutes + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( F32, handleSetHeatDisinfectRSVR2ToRSVR1StateDurationOverrideRequest, \ + testSetHeatDisinfectionR2ToR1DurationOverride, testResetHeatDisinfectionR2ToR1DurationOverride ) + +/************************************************************************* + * @brief + * The handleSetHeatDisinfectNoOfCyclesStateDurationOverrideRequest \n + * function handles a request to override the heat disinfection no of \n + * cycles to run request + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleSetHeatDisinfectNoOfCyclesStateDurationOverrideRequest, \ + testSetHeatDisinfectNoOfCyclesOverride, testResetHeatDisinfectNoOfCyclesOverride ) + + +/************************************************************************* + * @brief + * The handleSetHeatDisinfectionPublishDataIntervalOverrideRequest \n + * function handles a request to override the heat disinfection data \n + * publish interval + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleSetHeatDisinfectionPublishDataIntervalOverrideRequest, \ + testSetHeatDisinfectDataPublishIntervalOverride, testResetHeatDisinfectDataPublishIntervalOverride ) + +/*********************************************************************//** + * @brief + * The handleTestDGSafetyShutdownOverrideRequest function handles a + * request to override the safety shutdown signal. + * @details + * Inputs : none + * Outputs : message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ void handleTestDGSafetyShutdownOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_PAYLOAD_T payload; @@ -1880,4 +2062,342 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** +* @brief +* The handleStartStopInletUVReactor function handles a request to turn on/off +* the inlet UV reactor. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +BOOL handleStartStopInletUVReactor( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + BOOL startingReactor; + + memcpy( &startingReactor, message->payload, sizeof(U32) ); + + if ( TRUE == startingReactor ) + { + result = turnOnUVReactor( INLET_UV_REACTOR ); + } + else + { + result = turnOffUVReactor( INLET_UV_REACTOR ); + } + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); + + return result; +} + +/*********************************************************************//** +* @brief +* The handleUVReactorsDataPunlishIntervalOverride function handles a request +* to override the publish interval of the UV reactors data +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleUVReactorsDataPublishIntervalOverride( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetReactorsDataPublishInterval( payload.state.u32 ); + } + else + { + result = testResetReactorsDataPublishInterval(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleFansDataPublishIntervalOverride function handles a request +* to override the publish interval of the fans data +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleFansDataPublishIntervalOverride( MESSAGE_T * message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetFanPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetFanPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleStartStopOutletUVReactor function handles a request to turn +* on/off the outlet UV reactor. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +BOOL handleStartStopOutletUVReactor( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + BOOL startingReactor; + + memcpy( &startingReactor, message->payload, sizeof(U32) ); + + if ( TRUE == startingReactor ) + { + result = turnOnUVReactor( OUTLET_UV_REACTOR ); + } + else + { + result = turnOffUVReactor( OUTLET_UV_REACTOR ); + } + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); + + return result; +} + +/*********************************************************************//** +* @brief +* The handleUVReactorsHealthOverride function handles UV reactors health +* status override. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleUVReactorsHealthOverride( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetUVReactorHealthOverride( payload.index, (BOOL)payload.state.u32 ); + } + else + { + result = testResetUVReactorHealthOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleThermistorsDataPublishIntervalOverride function handles a request +* to override the publish interval of the thermistors data. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleThermistorsDataPublishIntervalOverride( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetThermistorPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetThermistorPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleThermisotrsValueOverride function handles a request to override +* a thermistor's value. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleThermisotrsValueOverride( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetMeasuredThermistorOverride( payload.index, payload.state.f32 ); + } + else + { + result = testResetMeasuredThermistorOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleROPumpDutyCycleOverride function handles a request to override +* the RO pumps duty cycle. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleROPumpDutyCycleOverride( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + + result = testSetTargetDutyCycle( payload.state.f32 ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleROFlowRateOverride function handles a request to override +* the RO flow rate. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*******************************************************************/ +void handleROFlowRateOverride( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetMeasuredROFlowRateOverride( payload.state.f32 ); + } + else + { + result = testResetMeasuredROFlowRateOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleROPumpTargetFlowOverride function handles a request to override +* the RO pump target flow rate. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*******************************************************************/ +void handleROPumpTargetFlowOverride( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + + result = setROPumpTargetFlowRate( payload.state.f32, payload.state.f32 ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleROPumpTargetPressureOverride function handles a request to +* override the RO pump target pressure. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*******************************************************************/ +void handleROPumpTargetPressureOverride( MESSAGE_T *message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + + result = testSetTargetROPumpPressure( payload.state.f32 ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/