Fix thermal runaway timeout

This commit is contained in:
Scott Lahteine 2016-10-05 08:42:39 -05:00 committed by GitHub
parent 9dd56e61bd
commit c63cb45268

View file

@ -1241,12 +1241,12 @@ void Temperature::init() {
*state = TRStable; *state = TRStable;
// While the temperature is stable watch for a bad temperature // While the temperature is stable watch for a bad temperature
case TRStable: case TRStable:
if (temperature < tr_target_temperature[heater_index] - hysteresis_degc && ELAPSED(millis(), *timer)) if (temperature >= tr_target_temperature[heater_index] - hysteresis_degc) {
*state = TRRunaway;
else {
*timer = millis() + period_seconds * 1000UL; *timer = millis() + period_seconds * 1000UL;
break; break;
} }
else if (PENDING(millis(), *timer)) break;
*state = TRRunaway;
case TRRunaway: case TRRunaway:
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), PSTR(MSG_THERMAL_RUNAWAY)); _temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), PSTR(MSG_THERMAL_RUNAWAY));
} }