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

This commit is contained in:
AnHardt 2018-09-05 08:39:49 +02:00 committed by Scott Lahteine
parent ce092ed0b7
commit b34134ed3d

View File

@ -1786,14 +1786,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)
@ -1812,20 +1810,18 @@ 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
}
/**
* Timer 0 is shared with millies so don't change the prescaler.
* Timer 0 is shared with millis so don't change the prescaler.
*
* This ISR uses the compare method so it runs at the base
* frequency (16 MHz / 64 / 256 = 976.5625 Hz), but at the TCNT0 set