1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-29 23:07:42 +00:00

🐛 Fix min/max temp evaluation

Fixes #24257
This commit is contained in:
Scott Lahteine 2022-06-03 22:06:32 -05:00
parent 3522d5376c
commit 9c872b214c

View File

@ -2709,13 +2709,15 @@ void Temperature::init() {
#if HAS_HOTEND
#define _TEMP_MIN_E(NR) do{ \
const celsius_t tmin = _MAX(HEATER_##NR##_MINTEMP, TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 0, (int)pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MINTEMP_IND].celsius))); \
const celsius_t tmin_tmp = TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 0, int16_t(pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MINTEMP_IND].celsius))), \
tmin = _MAX(HEATER_##NR##_MINTEMP, tmin_tmp); \
temp_range[NR].mintemp = tmin; \
while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < tmin) \
temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \
}while(0)
#define _TEMP_MAX_E(NR) do{ \
const celsius_t tmax = _MIN(HEATER_##NR##_MAXTEMP, TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 2000, (int)pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MAXTEMP_IND].celsius) - 1)); \
const celsius_t tmax_tmp = TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 2000, int16_t(pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MAXTEMP_IND].celsius)) - 1), \
tmax = _MIN(HEATER_##NR##_MAXTEMP, tmax_tmp); \
temp_range[NR].maxtemp = tmax; \
while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > tmax) \
temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \