Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r0516c804fc8c41a097fda9ab8dac1527e1683d29 -r6f2991204047ccbceeb5461f7c35af6d8f5dfd0b --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 0516c804fc8c41a097fda9ab8dac1527e1683d29) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 6f2991204047ccbceeb5461f7c35af6d8f5dfd0b) @@ -38,6 +38,7 @@ #include "TaskPriority.h" #include "TemperatureSensors.h" #include "Timers.h" +#include "Utilities.h" #include "Voltages.h" /** @@ -91,11 +92,11 @@ F32 targetFlow; ///< Heater target flow. BOOL hasTargetTempChanged; ///< Heater target temperature change flag indicator. F32 heaterEstGain; ///< Heater estimation gain during the run. - BOOL hasTargetBeenReached; ///< Heater flag to indicate whether the target temperature has been reached. F32 calculatedTemperature; ///< Heater calculated temperature. DG_RESERVOIR_ID_T inactiveRsrvr; ///< Heater inactive reservoir. U32 controlIntervalCounter; ///< Heater control interval counter. BOOL isThisFirstControl; ///< Heater is this first control interval. + BOOL useLastDutyCycle; ///< Heater has use previous duty cycle been requested flag. } HEATER_STATUS_T; static HEATER_STATUS_T heatersStatus[ NUM_OF_DG_HEATERS ]; ///< Heaters status. @@ -145,9 +146,9 @@ heatersStatus[ heater ].targetFlow = 0.0F; heatersStatus[ heater ].hasTargetTempChanged = FALSE; heatersStatus[ heater ].heaterEstGain = HEATERS_NEUTRAL_EST_GAIN; - heatersStatus[ heater ].hasTargetBeenReached = FALSE; heatersStatus[ heater ].controlIntervalCounter = 0; heatersStatus[ heater ].isThisFirstControl = TRUE; + heatersStatus[ heater ].useLastDutyCycle = FALSE; } // Initialize the persistent alarms @@ -440,6 +441,20 @@ /*********************************************************************//** * @brief + * The setTrimmerHeaterUseLastDutyCycleStatus function sets the flag that + * signals the trimmer heater control to use the last duty cycle or not + * @details Inputs: none + * @details Outputs: heatersStatus + * @param status which is the flag to indicate the status + * @return none + *************************************************************************/ +void setTrimmerHeaterUseLastDutyCycleStatus( BOOL status ) +{ + heatersStatus[ DG_TRIMMER_HEATER ].useLastDutyCycle = status; +} + +/*********************************************************************//** + * @brief * The handleHeaterStateOff function handles the heater not running state. * @details Inputs: heaterStatus * @details Outputs: heaterStatus @@ -608,9 +623,17 @@ if ( ( DG_MODE_FILL == opMode ) || ( DG_MODE_GENE == opMode ) || ( DG_MODE_DRAI == opMode ) ) { - currentTemperature = getReservoirCurrentTemperature(); - dutyCycle = calculateTrimmerHeaterDutyCycle( targetTemperature, currentTemperature, targetFlowLPM, TRUE ); - state = HEATER_EXEC_STATE_TRIMMER_CONTROL_TO_TARGET; + if ( FALSE == heatersStatus[ heater ].useLastDutyCycle ) + { + currentTemperature = getReservoirCurrentTemperature(); + dutyCycle = calculateTrimmerHeaterDutyCycle( targetTemperature, currentTemperature, targetFlowLPM, TRUE ); + } + else + { + dutyCycle = heatersStatus[ heater ].dutyCycle; + } + + state = HEATER_EXEC_STATE_TRIMMER_CONTROL_TO_TARGET; } else if ( DG_MODE_HEAT == opMode ) { @@ -929,7 +952,7 @@ BOOL isTrimmerOut = FALSE; #ifndef _RELEASE_ - if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) ) + if ( HW_CONFIG_BETA == getHardwareConfigStatus() ) { // V3 use CPU based value for Primary, same as Secondary mainPriVoltage = getMonitoredLineLevel( MONITORED_LINE_24V_GND_SMALL_PRIM_HTR_V ); @@ -953,7 +976,7 @@ checkPersistentAlarm( ALARM_ID_DG_TRIMMER_HEATER_VOLTAGE_OUT_OF_RANGE, isTrimmerOut, trimmerDC, HEATERS_VOLTAGE_TOLERANCE_V ); #ifndef _RELEASE_ - if ( SW_CONFIG_ENABLE_VALUE != getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) ) + if ( getHardwareConfigStatus() != HW_CONFIG_BETA ) #endif { // If the system is DVT, check the primary heater's power line voltage