|
|
@ -1444,7 +1444,7 @@ void Temperature::manage_heater() { |
|
|
|
|
|
|
|
TERN_(HEATER_IDLE_HANDLER, heater_idle[IDLE_INDEX_BED].update(ms)); |
|
|
|
|
|
|
|
#if HAS_THERMALLY_PROTECTED_BED |
|
|
|
#if ENABLED(THERMAL_PROTECTION_BED) |
|
|
|
tr_state_machine[RUNAWAY_IND_BED].run(temp_bed.celsius, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS); |
|
|
|
#endif |
|
|
|
|
|
|
@ -2570,21 +2570,15 @@ void Temperature::init() { |
|
|
|
); |
|
|
|
*/ |
|
|
|
|
|
|
|
#if HEATER_IDLE_HANDLER |
|
|
|
// If the heater idle timeout expires, restart
|
|
|
|
if (heater_idle[idle_index].timed_out) { |
|
|
|
if (TERN0(HEATER_IDLE_HANDLER, heater_idle[idle_index].timed_out)) { |
|
|
|
state = TRInactive; |
|
|
|
running_temp = 0; |
|
|
|
} |
|
|
|
else |
|
|
|
#endif |
|
|
|
{ |
|
|
|
// If the target temperature changes, restart
|
|
|
|
if (running_temp != target) { |
|
|
|
else if (running_temp != target) { // If the target temperature changes, restart
|
|
|
|
running_temp = target; |
|
|
|
state = target > 0 ? TRFirstHeating : TRInactive; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
switch (state) { |
|
|
|
// Inactive state waits for a target temperature to be set
|
|
|
@ -2596,7 +2590,7 @@ void Temperature::init() { |
|
|
|
state = TRStable; |
|
|
|
|
|
|
|
// While the temperature is stable watch for a bad temperature
|
|
|
|
case TRStable: |
|
|
|
case TRStable: { |
|
|
|
|
|
|
|
#if ENABLED(ADAPTIVE_FAN_SLOWING) |
|
|
|
if (adaptive_fan_slowing && heater_id >= 0) { |
|
|
@ -2614,13 +2608,17 @@ void Temperature::init() { |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
const millis_t now = millis(); |
|
|
|
|
|
|
|
if (current >= running_temp - hysteresis_degc) { |
|
|
|
timer = millis() + SEC_TO_MS(period_seconds); |
|
|
|
timer = now + SEC_TO_MS(period_seconds); |
|
|
|
break; |
|
|
|
} |
|
|
|
else if (PENDING(millis(), timer)) break; |
|
|
|
else if (PENDING(now, timer)) break; |
|
|
|
state = TRRunaway; |
|
|
|
|
|
|
|
} // fall through
|
|
|
|
|
|
|
|
case TRRunaway: |
|
|
|
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_Popup_Temperature(0)); |
|
|
|
_temp_error(heater_id, FPSTR(str_t_thermal_runaway), GET_TEXT_F(MSG_THERMAL_RUNAWAY)); |
|
|
|