Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -rb0a5452ec4b9be9be937095b1249079a2fce5ce5 -r0803f828b81e046166457564650acf6a9bbd3cc6 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision b0a5452ec4b9be9be937095b1249079a2fce5ce5) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 0803f828b81e046166457564650acf6a9bbd3cc6) @@ -95,10 +95,7 @@ BOOL startHeaterSignal; ///< Heater start indication flag. BOOL isHeaterOn; ///< Heater on/off status flag. F32 dutycycle; ///< Heater duty cycle. - F32 dutyCyle4NonZeroFlow; ///< Heater duty cycle for the non-zero flow. F32 targetROFlow; ///< Heater target flow. - U32 heaterOnWithNoFlowTimer; ///< Heater on with no flow timer. - BOOL isFlowBelowMin; ///< Heater flow below minimum flag indicator. BOOL hasTargetTempChanged; ///< Heater target temperature change flag indicator. F32 heaterEfficiency; ///< Heater efficiency during the run. BOOL hasTargetBeenReached; ///< Heater flag to indicate whether the target temperature has been reached. @@ -141,14 +138,14 @@ void initHeaters( void ) { DG_HEATERS_T heater; - dataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; for ( heater = DG_PRIMARY_HEATER; heater < NUM_OF_DG_HEATERS; heater++ ) { - heatersStatus[ heater ].startHeaterSignal = FALSE; - heatersStatus[ heater ].state = HEATER_EXEC_STATE_OFF; heatersStatus[ heater ].targetTemp = 0.0; + heatersStatus[ heater ].state = HEATER_EXEC_STATE_OFF; + heatersStatus[ heater ].startHeaterSignal = FALSE; + heatersStatus[ heater ].isHeaterOn = FALSE; heatersStatus[ heater ].dutycycle = 0.0; heatersStatus[ heater ].targetROFlow = 0.0; heatersStatus[ heater ].hasTargetTempChanged = FALSE; @@ -383,35 +380,6 @@ BOOL isFlowLow = ( measFlow < minFlow ? TRUE : FALSE ); checkPersistentAlarm( ALARM_ID_DG_FLOW_TOO_LOW_WHILE_HEATER_ON, isFlowLow, measFlow, minFlow ); - - /* TODO remove this code once the heaters fault is finalized - if ( TRUE == isFlowLow ) - { - // Check if the flow of the heater is below minimum for the first time - if ( FALSE == heatersStatus[ heater ].isFlowBelowMin ) - { - // Set the variables for the flow below minimum situation. - // Remember the current duty cycle of the heater - heatersStatus[ heater ].isFlowBelowMin = TRUE; - heatersStatus[ heater ].heaterOnWithNoFlowTimer = getMSTimerCount(); - heatersStatus[ heater ].dutyCyle4NonZeroFlow = heatersStatus[ heater ].dutycycle; - } - else if ( TRUE == didTimeout( heatersStatus[ heater ].heaterOnWithNoFlowTimer, HEATERS_ON_NO_FLOW_TIMEOUT_MS ) ) - { - // The flow is below minimum for a certain period of time so set the heater's duty cycle to 0. The heaters is not - // set to off and its duty cycle is set to 0 - setHeaterDutyCycle( heater, HEATERS_MIN_DUTY_CYCLE ); - - } - } - else - { - heatersStatus[ heater ].isFlowBelowMin = FALSE; - heatersStatus[ heater ].heaterOnWithNoFlowTimer = getMSTimerCount(); - - // Flow is back on, set the heater to the duty cycle that was saved before zeroing the heater - setHeaterDutyCycle( heater, heatersStatus[ heater ].dutyCyle4NonZeroFlow ); - }*/ } else { @@ -655,37 +623,24 @@ *************************************************************************/ static void setHeaterDutyCycle( DG_HEATERS_T heater, F32 pwm ) { - // Only if there is a minimum flow, or if 0 duty cycle has been requested, the duty cycle can be changed - // This is to make sure while heaters are temporarily turned off due to a flow drop are not set to another - // duty cycle that might cause an over heat since there is no water flowing through - if ( ( FALSE == heatersStatus[ heater ].isFlowBelowMin ) || ( pwm < NEARLY_ZERO ) ) + // Check if the requested duty cycle is different from what the heater's duty cycle is. + // If the same duty cycle is requested, then it is not needed to send it again. This is to make sure + // the same duty cycle is not sent to the hardware all the time. + if ( fabs( heatersStatus[ heater ].dutycycle - pwm ) > NEARLY_ZERO ) { - // Check if the requested duty cycle is different from what the heater's duty cycle is. - // If the same duty cycle is requested, then it is not needed to send it again. This is to make sure - // the same duty cycle is not sent to the hardware all the time. - if ( fabs( heatersStatus[ heater ].dutycycle - pwm ) > NEARLY_ZERO ) + if ( DG_PRIMARY_HEATER == heater ) { - if ( DG_PRIMARY_HEATER == heater ) - { - setMainPrimaryHeaterPWM( pwm ); - setSmallPrimaryHeaterPWM( pwm ); - } - else if ( DG_TRIMMER_HEATER == heater ) - { - setTrimmerHeaterPWM( pwm ); - } - - // Updated the heater's information - heatersStatus[ heater ].dutycycle = pwm; + setMainPrimaryHeaterPWM( pwm ); + setSmallPrimaryHeaterPWM( pwm ); } + else if ( DG_TRIMMER_HEATER == heater ) + { + setTrimmerHeaterPWM( pwm ); + } + + // Updated the heater's information + heatersStatus[ heater ].dutycycle = pwm; } - else - { - // The flow is below minimum and the heater is temporarily powered down - // Update the other duty cycle with the requested duty cycle so as soon as the - // flow is back on, the new duty cycle is set - heatersStatus[ heater ].dutyCyle4NonZeroFlow = pwm; - } } /*********************************************************************//**