Fix: Thermal runaway if nonexistent bed's temp is set

This commit is contained in:
Scott Lahteine
2017-04-02 11:48:10 -05:00
parent deaad78df9
commit 699310d1d2
4 changed files with 21 additions and 24 deletions

View File

@ -104,12 +104,12 @@ uint8_t Temperature::soft_pwm_bed;
volatile int Temperature::babystepsTodo[XYZ] = { 0 };
#endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
#if WATCH_HOTENDS
int Temperature::watch_target_temp[HOTENDS] = { 0 };
millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
#endif
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
#if WATCH_THE_BED
int Temperature::watch_target_bed_temp = 0;
millis_t Temperature::watch_bed_next_ms = 0;
#endif
@ -690,7 +690,7 @@ void Temperature::manage_heater() {
if (current_temperature[0] < max(HEATER_0_MINTEMP, MAX6675_TMIN + 0.01)) min_temp_error(0);
#endif
#if (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) || (ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0) || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
#if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
millis_t ms = millis();
#endif
@ -707,7 +707,7 @@ void Temperature::manage_heater() {
soft_pwm[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
// Check if the temperature is failing to increase
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
#if WATCH_HOTENDS
// Is it time to check this extruder's heater?
if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) {
@ -725,7 +725,7 @@ void Temperature::manage_heater() {
#endif // THERMAL_PROTECTION_HOTENDS
// Check if the temperature is failing to increase
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
#if WATCH_THE_BED
// Is it time to check the bed?
if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {
@ -1157,7 +1157,7 @@ void Temperature::init() {
#endif //BED_MAXTEMP
}
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
#if WATCH_HOTENDS
/**
* Start Heating Sanity Check for hotends that are below
* their target temperature by a configurable margin.
@ -1176,7 +1176,7 @@ void Temperature::init() {
}
#endif
#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
#if WATCH_THE_BED
/**
* Start Heating Sanity Check for hotends that are below
* their target temperature by a configurable margin.