Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -rd3819286869611f9c02add72a0f8e321598fdf42 -rde2ef5ff6293f23a43414c5e2e40630468a68ddf --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision d3819286869611f9c02add72a0f8e321598fdf42) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision de2ef5ff6293f23a43414c5e2e40630468a68ddf) @@ -511,22 +511,12 @@ // If the flow is within range, run the PI controller to control the heaters normally if ( FALSE == isFlowBelowMin ) { - // If the primary heater is running and another start primary heater request - // is set, reset the primary heater again - if ( TRUE == hasStartPrimaryHeaterRequested ) - { - resetHeaterState( PRIMARY_HEATER ); - hasStartPrimaryHeaterRequested = FALSE; - } - else - { - F32 outletTemp = getTemperatureValue( primaryHeatersFeedbackTempSensor ); - mainPrimaryHeaterDutyCycle = runPIController( PI_CONTROLLER_ID_PRIMARY_HEATER, primaryHeaterTargetTemperature, outletTemp ); + F32 outletTemp = getTemperatureValue( primaryHeatersFeedbackTempSensor ); + mainPrimaryHeaterDutyCycle = runPIController( PI_CONTROLLER_ID_PRIMARY_HEATER, primaryHeaterTargetTemperature, outletTemp ); - // Once the primary heaters duty cycle is set, it is divided into 2 so both heaters will start and both elements are heated up - smallPrimaryHeaterDutyCycle = mainPrimaryHeaterDutyCycle / MAIN_AND_SMALL_PRIMARY_HEATER_DUTY_CYCLE_DIVISOR; - mainPrimaryHeaterDutyCycle = mainPrimaryHeaterDutyCycle / MAIN_AND_SMALL_PRIMARY_HEATER_DUTY_CYCLE_DIVISOR; - } + // Once the primary heaters duty cycle is set, it is divided into 2 so both heaters will start and both elements are heated up + smallPrimaryHeaterDutyCycle = mainPrimaryHeaterDutyCycle / MAIN_AND_SMALL_PRIMARY_HEATER_DUTY_CYCLE_DIVISOR; + mainPrimaryHeaterDutyCycle = mainPrimaryHeaterDutyCycle / MAIN_AND_SMALL_PRIMARY_HEATER_DUTY_CYCLE_DIVISOR; setMainPrimaryHeaterPWM( mainPrimaryHeaterDutyCycle ); setSmallPrimaryHeaterPWM( smallPrimaryHeaterDutyCycle ); @@ -541,6 +531,14 @@ primaryHeaterTimerCounter = 0; } + // If the primary heater is running and another start primary heater request + // is set, reset the primary heater again + if ( TRUE == hasStartPrimaryHeaterRequested ) + { + resetHeaterState( PRIMARY_HEATER ); + hasStartPrimaryHeaterRequested = FALSE; + } + if ( FALSE == isPrimaryHeaterOn ) { // Switch to off state. Set the duty cycles to 0 @@ -610,6 +608,11 @@ trimmerHeaterTimerCounter = 0; } + if ( TRUE == hasStartTrimmerHeaterRequested ) + { + hasStartTrimmerHeaterRequested = FALSE; + } + if ( FALSE == isTrimmerHeaterOn ) { // Set the duty cycle to 0 and switch to off state