Index: firmware/App/Modes/ModeRecirculate.c =================================================================== diff -u -r6f1f269cd7d91f41c51797d17a85a7ea249e21f3 -rdf0a0b9ce1414b00b381e516714f9089d8e4ae21 --- firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision 6f1f269cd7d91f41c51797d17a85a7ea249e21f3) +++ firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision df0a0b9ce1414b00b381e516714f9089d8e4ae21) @@ -45,7 +45,7 @@ #define TARGET_RO_FLOW_RATE_L 0.3 ///< Target flow rate for RO pump. #define TARGET_FLUSH_LINES_RO_FLOW_RATE_L 0.6 ///< Target flow rate for RO pump. -#define FLUSH_LINES_VOLUME_L 0.01 ///< Water volume (in Liters) to flush when starting re-circulate mode. +#define FLUSH_LINES_VOLUME_L 0.01 ///< Water volume (in Liters) to flush when starting re-circulate mode. TODO remove this and add it NVDataMgmt // ********** private data ********** @@ -59,8 +59,6 @@ static DG_RECIRCULATE_MODE_STATE_T handleRecircWaterState( void ); static DG_RECIRCULATE_MODE_STATE_T handleRecircPauseState( void ); -static BOOL processCalibrationData( void ); - /*********************************************************************//** * @brief * The initRecirculateMode function initializes the re-circulate mode module. @@ -70,12 +68,8 @@ *************************************************************************/ void initRecirculateMode( void ) { - recircState = DG_RECIRCULATE_MODE_STATE_START; - flushLinesVolumeL = 0.0; - - // TODO temporary code remove - flushLinesTargetVolumeL = FLUSH_LINES_VOLUME_L; - // TODO temporary code remove + recircState = DG_RECIRCULATE_MODE_STATE_START; + flushLinesVolumeL = 0.0; } /*********************************************************************//** @@ -125,20 +119,15 @@ /*********************************************************************//** * @brief - * The execRecirculateMode function executes the re-circulate mode state machine. + * The execRecirculateMode function executes the re-circulate mode state + * machine. * @details Inputs: recircState - * @details Outputs: Check water quality, re-circulate mode state machine executed + * @details Outputs: Check water quality, re-circulate mode state machine + * executed * @return current state *************************************************************************/ U32 execRecirculateMode( void ) { - // Check if a new calibration is available - if ( TRUE == isNewCalibrationRecordAvailable() ) - { - // Get the new calibration data and check its validity - processCalibrationData(); - } - // check inlet water conductivity, temperature, pressure, and RO rejection ratio checkInletWaterConductivity(); checkInletWaterTemperature(); @@ -216,11 +205,11 @@ F32 waterFlowRate = getMeasuredROFlowRate(); F32 waterVolume = ( ( waterFlowRate / SEC_PER_MIN ) / ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ); - // integrate volume of water moved through line + // Integrate volume of water moved through line flushLinesVolumeL += waterVolume; - // when enough water volume has flowed to flush the lines, transition to re-circ state - if ( flushLinesVolumeL >= flushLinesTargetVolumeL ) + // When enough water volume has flowed to flush the lines, transition to re-circ state + if ( flushLinesVolumeL >= getRecirculationDrainVol() ) { setValveState( VDR, VALVE_STATE_RECIRC_C_TO_NC ); setROPumpTargetFlowRate( TARGET_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); @@ -260,41 +249,4 @@ return result; } -/*********************************************************************//** - * @brief - * The processCalibrationData function gets the calibration data and makes - * sure it is valid by checking the calibration date. The calibration date - * should not be 0. - * @details Inputs: none - * @details Outputs: flushLinesVolumeL - * @return TRUE if the calibration record is valid, otherwise FALSE - *************************************************************************/ -static BOOL processCalibrationData( void ) -{ - BOOL status = TRUE; - - // Get the calibration record from NVDataMgmt - DG_DRAIN_LINE_VOLUME_T calData = getDGDrainLineVolumeRecord(); - - // Check if the calibration data that was received from NVDataMgmt is legitimate - // The calibration date item should not be zero. If the calibration date is 0, - // then the data is not stored in the NV memory or it was corrupted. - if ( 0 == calData.calibrationTime ) - { -#ifndef DISABLE_CAL_CHECK - activateAlarmNoData( ALARM_ID_DG_DRAIN_LINE_VOLUME_INVALID_CALIBRATION ); -#endif - // In case calibration time was 0 set the flush target volume to default - flushLinesTargetVolumeL = FLUSH_LINES_VOLUME_L; - status = FALSE; - } - else - { - // The calibration data was valid, update the local copy - flushLinesVolumeL = calData.volume; - } - - return status; -} - /**@}*/