Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -rd74b98a3b101ec827cc7da59dd617df9435d79e3 -raf83481e7313ed6b624e1a8ed8996a906177ad6d --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision d74b98a3b101ec827cc7da59dd617df9435d79e3) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision af83481e7313ed6b624e1a8ed8996a906177ad6d) @@ -56,7 +56,7 @@ #define MAXIMUM_TARGET_TEMPERATURE 90.0 ///< Maximum allowed target temperature for the heaters. #define MAXIMUM_IDLE_DRAIN_TARGET_TEMPERATURE 58.0 ///< Maximum allowed target temperature for the idle and drain modes. -#define HEATERS_RAMP_STATE_CHECK_INTERVAL_COUNT 20U ///< Heaters ramp check interval count. +#define HEATERS_RAMP_STATE_CHECK_INTERVAL_COUNT 20U // TODO remove ///< Heaters ramp check interval count. #define HEATERS_CONTROL_STATE_CHECK_INTERVAL_COUNT ( ( 10 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ) ///< Temperature sensors interval count. #define HEATERS_ON_WITH_NO_FLOW_TIMEOUT_COUNT ( ( 3 * MS_PER_SECOND ) / TASK_PRIORITY_INTERVAL ) ///< Heaters are on but there is no sufficient flow timeout in counts. #define HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C 170.0 ///< Heaters max allowed internal temperature in C. @@ -89,21 +89,16 @@ { F32 targetTemp; ///< Heater target temperature. F32 originalTargetTemp; ///< Heater original target temperature set by user. - F32 previousTemps[ TEMPERATURES_MOVING_AVG_SIZE ]; ///< Heater Previous temperatures array. - U32 previousTempsIndex; ///< Heater previous temperatures arrays current index. HEATERS_STATE_T state; ///< Heater state. TEMPERATURE_SENSORS_T feedbackSensor; ///< Heater feedback sensor for controlling. - U32 controlTimerCounter; ///< Heater control timer counter. + U32 controlTimerCounter; // TODO remove? Maybe use in heat disinfect ///< Heater control timer counter. BOOL startHeaterSignal; ///< Heater start indication flag. BOOL isHeaterOn; ///< Heater on/off status flag. F32 dutycycle; ///< Heater duty cycle. F32 targetROFlow; ///< Heater target flow. - U32 rampStateStartTime; ///< Heater ramp state start time. - U32 heaterOnWithNoFlowTimer; ///< Heater on with no flow timer. + U32 heaterOnWithNoFlowTimer; // TODO remove ///< Heater on with no flow timer. BOOL isFlowBelowMin; ///< Heater flow below minimum flag indicator. - F32 initialDutyCycle; // TODO do we need this? ///< Heater initial duty cycle before a hand off. BOOL hasTargetTempChanged; ///< Heater target temperature change flag indicator. - BOOL isThisFirstRamp; PI_CONTROLLER_ID_T controllerID; ///< Heater PI controller ID TODO remove this? @@ -165,13 +160,8 @@ heatersStatus[ heater ].originalTargetTemp = 0.0; heatersStatus[ heater ].dutycycle = 0.0; heatersStatus[ heater ].targetROFlow = 0.0; - heatersStatus[ heater ].previousTempsIndex = 0; heatersStatus[ heater ].controllerID = ( DG_PRIMARY_HEATER == heater ? 4 : PI_CONTROLLER_ID_TRIMMER_HEATER ); // TODO remove or refactor? - heatersStatus[ heater ].initialDutyCycle = 0.0; heatersStatus[ heater ].hasTargetTempChanged = FALSE; - - // Set the array of the previous temperatures to 0.0 - memset( &heatersStatus[ heater ].previousTemps, 0.0, sizeof( TEMPERATURES_MOVING_AVG_SIZE ) ); } // Initialize the PI controller for the trimmer heater @@ -438,8 +428,7 @@ setHeaterDutyCycle( heater, dutyCycle ); // TODo for testing remove - // TODO uncomment - /* if ( ( DG_MODE_DRAI == getCurrentOperationMode() ) || ( DG_MODE_GENE == getCurrentOperationMode() ) ) + /*f ( ( DG_MODE_DRAI == getCurrentOperationMode() ) || ( DG_MODE_GENE == getCurrentOperationMode() ) ) { heatersStatus[ heater ].targetTemp = MAXIMUM_IDLE_DRAIN_TARGET_TEMPERATURE; } @@ -452,7 +441,7 @@ // If the operation mode is heat disinfect and the heater is primary heater, change the feedback sensor to THd if ( ( DG_MODE_HEAT == getCurrentOperationMode() ) && ( DG_PRIMARY_HEATER == heater ) ) { - heatersStatus[ heater ].feedbackSensor = TEMPSENSORS_HEAT_DISINFECT; + heatersStatus[ heater ].feedbackSensor = TEMPSENSORS_HEAT_DISINFECT; // TODO do we need this? } TEMPERATURE_SENSORS_T sensor = heatersStatus[ heater ].feedbackSensor; @@ -461,11 +450,8 @@ // If the target temperature is greater than the feedback temperature the duty cycle is 100% otherwise, 0% F32 duty = ( targetTemperature > feedbackTemperature ? HEATERS_MAX_DUTY_CYCLE : HEATERS_MIN_DUTY_CYCLE ); - setHeaterDutyCycle( heater, duty ); + setHeaterDutyCycle( heater, duty );*/ - // Once the heater is staring for the first time so no minimum ramp time is needed - heatersStatus[ heater ].rampStateStartTime = getMSTimerCount(); */ - // Turn on the heater state = HEATER_EXEC_STATE_RAMP_TO_TARGET; } @@ -750,7 +736,6 @@ status = TRUE; // Moving back from control to target to ramp. - heatersStatus[ heater ].rampStateStartTime = getMSTimerCount(); heatersStatus[ heater ].targetROFlow = targetFlow; heatersStatus[ heater ].hasTargetTempChanged = FALSE;