Fix mintemp/maxtemp monitoring for thermocouples
This commit is contained in:
parent
de8fee6aea
commit
c28e08c849
1 changed files with 25 additions and 18 deletions
|
@ -2194,14 +2194,18 @@ void Temperature::readings_ready() {
|
|||
temp_chamber.acc = 0;
|
||||
#endif
|
||||
|
||||
int constexpr temp_dir[] = {
|
||||
static constexpr int8_t temp_dir[] = {
|
||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
||||
0
|
||||
#else
|
||||
TEMPDIR(0)
|
||||
#endif
|
||||
#if HOTENDS > 1
|
||||
#if ENABLED(HEATER_1_USES_MAX6675)
|
||||
, 0
|
||||
#else
|
||||
, TEMPDIR(1)
|
||||
#endif
|
||||
#if HOTENDS > 2
|
||||
, TEMPDIR(2)
|
||||
#if HOTENDS > 3
|
||||
|
@ -2221,12 +2225,14 @@ void Temperature::readings_ready() {
|
|||
if (grace_period) return;
|
||||
|
||||
for (uint8_t e = 0; e < COUNT(temp_dir); e++) {
|
||||
const int16_t tdir = temp_dir[e], rawtemp = temp_hotend[e].raw * tdir;
|
||||
const bool heater_on = (temp_hotend[e].target > 0)
|
||||
const int8_t tdir = temp_dir[e];
|
||||
if (tdir) {
|
||||
const int16_t rawtemp = temp_hotend[e].raw * tdir; // normal direction, +rawtemp, else -rawtemp
|
||||
const bool heater_on = (temp_hotend[e].target > 0
|
||||
#if ENABLED(PIDTEMP)
|
||||
|| (temp_hotend[e].soft_pwm_amount > 0)
|
||||
|| temp_hotend[e].soft_pwm_amount > 0
|
||||
#endif
|
||||
;
|
||||
);
|
||||
if (rawtemp > temp_range[e].raw_max * tdir) max_temp_error(e);
|
||||
if (heater_on && rawtemp < temp_range[e].raw_min * tdir && !is_preheating(e)) {
|
||||
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
||||
|
@ -2239,6 +2245,7 @@ void Temperature::readings_ready() {
|
|||
consecutive_low_temperature_error[e] = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
#if TEMPDIR(BED) < 0
|
||||
|
|
Reference in a new issue