Browse Source

[2.0.x] SECURITYFIX missing max temp error when PID is used (#11717)

pull/1/head
AnHardt 6 years ago
committed by Scott Lahteine
parent
commit
530a13ab6c
  1. 16
      Marlin/src/module/temperature.cpp

16
Marlin/src/module/temperature.cpp

@ -1722,14 +1722,12 @@ void Temperature::readings_ready() {
for (uint8_t e = 0; e < COUNT(temp_dir); e++) {
const int16_t tdir = temp_dir[e], rawtemp = current_temperature_raw[e] * tdir;
const bool heater_on = 0 <
const bool heater_on = (target_temperature[e] > 0)
#if ENABLED(PIDTEMP)
soft_pwm_amount[e]
#else
target_temperature[e]
|| (soft_pwm_amount[e] > 0)
#endif
;
if (rawtemp > maxttemp_raw[e] * tdir && heater_on) max_temp_error(e);
if (rawtemp > maxttemp_raw[e] * tdir) max_temp_error(e);
if (rawtemp < minttemp_raw[e] * tdir && !is_preheating(e) && heater_on) {
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
if (++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)
@ -1748,14 +1746,12 @@ void Temperature::readings_ready() {
#else
#define GEBED >=
#endif
const bool bed_on = 0 <
const bool bed_on = (target_temperature_bed > 0)
#if ENABLED(PIDTEMPBED)
soft_pwm_amount_bed
#else
target_temperature_bed
|| (soft_pwm_amount_bed > 0)
#endif
;
if (current_temperature_bed_raw GEBED bed_maxttemp_raw && bed_on) max_temp_error(-1);
if (current_temperature_bed_raw GEBED bed_maxttemp_raw) max_temp_error(-1);
if (bed_minttemp_raw GEBED current_temperature_bed_raw && bed_on) min_temp_error(-1);
#endif
}

Loading…
Cancel
Save