Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r2fff37fa585181917705645494549b5fd4a4d522 -r8b0c842f94e3c94cecf62f0f913e429def8e5efa --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 2fff37fa585181917705645494549b5fd4a4d522) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 8b0c842f94e3c94cecf62f0f913e429def8e5efa) @@ -24,7 +24,6 @@ #include "DGDefs.h" #include "Heaters.h" #include "OperationModes.h" -#include "PersistentAlarm.h" #include "PIControllers.h" #include "ROPump.h" #include "SafetyShutdown.h" @@ -177,10 +176,6 @@ // Initialize the PI controller for the trimmer heater initializePIController( PI_CONTROLLER_ID_TRIMMER_HEATER, HEATERS_MIN_DUTY_CYCLE, TRIMMER_HEATER_P_COEFFICIENT, TRIMMER_HEATER_I_COEFFICIENT, HEATERS_MIN_DUTY_CYCLE, TRIMMER_HEATER_MAX_DUTY_CYCLE ); - - // Initialize the persistent alarm for heaters' internal temperature out of range - initPersistentAlarm( ALARM_ID_DG_PRIMARY_HEATERS_INTERNAL_TEMP_OUT_OF_RANGE, 0, HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_TIMEOUT_MS ); - initPersistentAlarm( ALARM_ID_DG_TRIMMER_HEATER_INTERNAL_TEMP_OUT_OF_RANGE, 0, HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_TIMEOUT_MS ); } /*********************************************************************//** @@ -336,20 +331,43 @@ F32 trimmerHeaterInternalTemp = getTemperatureValue( TEMPSENSORS_TRIMMER_HEATER_INTERNAL ); // Check if the primary heaters' internal temperature is above the limit - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DG_PRIMARY_HEATERS_INTERNAL_TEMP_OUT_OF_RANGE, - primaryHeatersInternalTemp > HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C ) ) + if ( primaryHeatersInternalTemp > HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C ) { - activateSafetyShutdown(); SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_PRIMARY_HEATERS_INTERNAL_TEMP_OUT_OF_RANGE, primaryHeatersInternalTemp ); + + // If it is above the range for the first time, stop the primary heaters + // and set the variables + if ( FALSE == isPrimaryHeatersTempOutOfRange ) + { + stopPrimaryHeater(); + isPrimaryHeatersTempOutOfRange = TRUE; + primaryHeatersInternalTempOutTimer = getMSTimerCount(); + } + // If the primary heaters internal temperature was out for more than the define period, activate the safety shutdown + else if ( TRUE == didTimeout( primaryHeatersInternalTempOutTimer, HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_TIMEOUT_MS ) ) + { + activateSafetyShutdown(); + } } // Check if the trimmer heater internal temperature is above the limit - - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DG_PRIMARY_HEATERS_INTERNAL_TEMP_OUT_OF_RANGE, - primaryHeatersInternalTemp > HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C ) ) + if ( trimmerHeaterInternalTemp > HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C ) { - activateSafetyShutdown(); SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_TRIMMER_HEATER_INTERNAL_TEMP_OUT_OF_RANGE, trimmerHeaterInternalTemp ); + + // If it is above the range for the first time, stop the trimmer heater + // and set the variables + if ( FALSE == isTrimmerHeaterTempOutOfRange ) + { + stopTrimmerHeater(); + isTrimmerHeaterTempOutOfRange = TRUE; + trimmerHeaterInternalTempOutTimer = getMSTimerCount(); + } + // If the trimmer heater internal temperature was out for more than the define period, activate the safety shutdown + else if ( TRUE == didTimeout( trimmerHeaterInternalTempOutTimer, HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_TIMEOUT_MS ) ) + { + activateSafetyShutdown(); + } } #endif