Browse Source

🐛 Fix min/max temp evaluation

Fixes #24257
FB4S_WIFI
Scott Lahteine 2 years ago
parent
commit
9ab654adcb
  1. 6
      Marlin/src/module/temperature.cpp

6
Marlin/src/module/temperature.cpp

@ -2388,13 +2388,15 @@ void Temperature::init() {
#if HAS_HOTEND #if HAS_HOTEND
#define _TEMP_MIN_E(NR) do{ \ #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; \ temp_range[NR].mintemp = tmin; \
while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < tmin) \ while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < tmin) \
temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \ temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \
}while(0) }while(0)
#define _TEMP_MAX_E(NR) do{ \ #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; \ temp_range[NR].maxtemp = tmax; \
while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > tmax) \ while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > tmax) \
temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \ temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \

Loading…
Cancel
Save