|
|
@ -944,13 +944,29 @@ void Temperature::manage_heater() { |
|
|
|
if (temp_hotend[1].current < MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(1); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if WATCH_HOTENDS || WATCH_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER || WATCH_CHAMBER |
|
|
|
#define HAS_THERMAL_PROTECTION (ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER)) |
|
|
|
|
|
|
|
#if HAS_THERMAL_PROTECTION || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER |
|
|
|
millis_t ms = millis(); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_THERMAL_PROTECTION |
|
|
|
#ifndef THERMAL_PROTECTION_GRACE_PERIOD |
|
|
|
#define THERMAL_PROTECTION_GRACE_PERIOD 0 // No grace period needed on well-behaved boards
|
|
|
|
#endif |
|
|
|
#if THERMAL_PROTECTION_GRACE_PERIOD > 0 |
|
|
|
static millis_t grace_period = ms + THERMAL_PROTECTION_GRACE_PERIOD; |
|
|
|
if (ELAPSED(ms, grace_period)) grace_period = 0UL; |
|
|
|
#else |
|
|
|
static constexpr millis_t grace_period = 0UL; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
HOTEND_LOOP() { |
|
|
|
if (degHotend(e) > temp_range[e].maxtemp) |
|
|
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS) |
|
|
|
if (!grace_period && degHotend(e) > temp_range[e].maxtemp) |
|
|
|
_temp_error(e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e)); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HEATER_IDLE_HANDLER |
|
|
|
hotend_idle[e].update(ms); |
|
|
@ -1003,8 +1019,10 @@ void Temperature::manage_heater() { |
|
|
|
|
|
|
|
#if HAS_HEATED_BED |
|
|
|
|
|
|
|
if (degBed() > BED_MAXTEMP) |
|
|
|
#if ENABLED(THERMAL_PROTECTION_BED) |
|
|
|
if (!grace_period && degBed() > BED_MAXTEMP) |
|
|
|
_temp_error(-1, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -1)); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if WATCH_BED |
|
|
|
// Make sure temperature is increasing
|
|
|
@ -1076,8 +1094,10 @@ void Temperature::manage_heater() { |
|
|
|
|
|
|
|
#if HAS_HEATED_CHAMBER |
|
|
|
|
|
|
|
if (degChamber() > CHAMBER_MAXTEMP) |
|
|
|
#if ENABLED(THERMAL_PROTECTION_CHAMBER) |
|
|
|
if (!grace_period && degChamber() > CHAMBER_MAXTEMP) |
|
|
|
_temp_error(-2, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -2)); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if WATCH_CHAMBER |
|
|
|
// Make sure temperature is increasing
|
|
|
@ -1610,7 +1630,7 @@ void Temperature::init() { |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER) |
|
|
|
#if HAS_THERMAL_PROTECTION |
|
|
|
|
|
|
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS) |
|
|
|
Temperature::tr_state_machine_t Temperature::tr_state_machine[HOTENDS]; // = { { TRInactive, 0 } };
|
|
|
@ -1637,7 +1657,7 @@ void Temperature::init() { |
|
|
|
else |
|
|
|
SERIAL_ECHOPAIR(" ; Idle Timeout:", bed_idle.timed_out); |
|
|
|
SERIAL_EOL(); |
|
|
|
*/ |
|
|
|
//*/
|
|
|
|
|
|
|
|
const int heater_index = heater_id >= 0 ? heater_id : HOTENDS; |
|
|
|
|
|
|
|