Browse Source

Fallthru in thermal runaway test when TRState changes

pull/1/head
Scott Lahteine 9 years ago
parent
commit
c2522ce1f5
  1. 17
      Marlin/temperature.cpp

17
Marlin/temperature.cpp

@ -1056,24 +1056,21 @@ void Temperature::init() {
*state = TRInactive; *state = TRInactive;
// Inactive state waits for a target temperature to be set // Inactive state waits for a target temperature to be set
case TRInactive: case TRInactive:
if (target_temperature > 0) { if (target_temperature <= 0) break;
tr_target_temperature[heater_index] = target_temperature; tr_target_temperature[heater_index] = target_temperature;
*state = TRFirstHeating; *state = TRFirstHeating;
}
break;
// When first heating, wait for the temperature to be reached then go to Stable state // When first heating, wait for the temperature to be reached then go to Stable state
case TRFirstHeating: case TRFirstHeating:
if (temperature >= tr_target_temperature[heater_index]) *state = TRStable; if (temperature < tr_target_temperature[heater_index]) break;
break; *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 the temperature is over the target (-hysteresis) restart the timer if (temperature < tr_target_temperature[heater_index] - hysteresis_degc && ELAPSED(millis(), *timer))
if (temperature >= tr_target_temperature[heater_index] - hysteresis_degc)
*timer = millis();
// If the timer goes too long without a reset, trigger shutdown
else if (ELAPSED(millis(), *timer + period_seconds * 1000UL))
*state = TRRunaway; *state = TRRunaway;
else {
*timer = millis() + period_seconds * 1000UL;
break; break;
}
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));
} }

Loading…
Cancel
Save