Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r87acb1655edbf974497e4300f2c18eea62f8acba -ra8d919375cdb830f52e82e2d1c72c8153f5f58ca --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 87acb1655edbf974497e4300f2c18eea62f8acba) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision a8d919375cdb830f52e82e2d1c72c8153f5f58ca) @@ -105,6 +105,9 @@ static PRIMARY_HEATERS_EXEC_STATES_T primaryHeatersExecState; ///< Primary heaters exec state. static TRIMMER_HEATER_EXEC_STATES_T trimmerHeaterExecState; ///< Trimmer heater exec state. +static PRIMARY_HEATERS_EXEC_STATES_T primaryHeatersExecPrevState; ///< Primary heaters exec previous state. +static TRIMMER_HEATER_EXEC_STATES_T trimmerHeaterExecPrevState; ///< Trimmer heater exec previous state. + static F32 primaryHeaterTargetTemperature; ///< Primary heaters target temperature. static F32 trimmerHeaterTargetTemperature; ///< Trimmer heater target temperature. @@ -332,23 +335,37 @@ *************************************************************************/ void execHeatersMonitor( void ) { - if ( isPrimaryHeaterOn || isTrimmerHeaterOn ) + /*if ( isPrimaryHeaterOn || isTrimmerHeaterOn ) { // If the RO pump is not on, turn off the heaters - /*if ( !isReverseOsmosisPumpOn() || getMeasuredROFlowRate() < MIN_RO_FLOWRATE_LPM ) + if ( ( getMeasuredROFlowRate() < MIN_RO_FLOWRATE_LPM ) && ( ++heatersOnWithNoFlowTimeOut > HEATERS_ON_WITH_NO_FLOW_TIMEOUT_COUNT ) ) { - if ( ++heatersOnWithNoFlowTimeOut > HEATERS_ON_WITH_NO_FLOW_TIMEOUT_COUNT ) - { - stopPrimaryHeater(); // TODO - this is so immediate - if other module requests RO pump on and start heater, this monitor may stop the heater request before RO pump has a chance to start - stopTrimmerHeater(); + stopPrimaryHeater(); // TODO - this is so immediate - if other module requests RO pump on and start heater, this monitor may stop the heater request before RO pump has a chance to start + stopTrimmerHeater(); - heatersOnWithNoFlowTimeOut = 0; - } - }*/ + primaryHeatersExecPrevState = primaryHeatersExecState; + trimmerHeaterExecPrevState = trimmerHeaterExecState; + + heatersOnWithNoFlowTimeOut = 0; + } } + else + { + if ( getMeasuredROFlowRate() > MIN_RO_FLOWRATE_LPM ) + { + if ( primaryHeatersExecPrevState != PRIMARY_HEATERS_EXEC_STATE_OFF ) + { + setPrimaryHeaterTargetTemperature( primaryHeaterTargetTemperature ); + startPrimaryHeater(); + } + if ( trimmerHeaterExecPrevState != TRIMMER_HEATER_EXEC_STATE_OFF ) + { + setTrimmerHeaterTargetTemperature( trimmerHeaterTargetTemperature ); + startTrimmerHeater(); + } + } + }*/ - //TODO add code to remember the former state of the heaters and if they were on, turn them on again - // Check for data publication publishHeatersData(); } @@ -646,7 +663,7 @@ if ( DG_MODE_HEAT == getCurrentOperationMode() ) { // Set the feedback temperature sensor - trimmerHeaterFeedbackTempSensor = TEMPSENSORS_INLET_DIALYSATE; //TODO change this to Thd sensors once it is installed + trimmerHeaterFeedbackTempSensor = TEMPSENSORS_OUTLET_REDUNDANT; //TODO change this to Thd sensors once it is installed } state = TRIMMER_HEATER_EXEC_STATE_CONTROL_TO_TARGET;