Skip to content

Commit 271f658

Browse files
thinkyheadLCh-77
authored andcommitted
🐛 Fix min/max temp evaluation
Fixes MarlinFirmware#24257
1 parent a1d34c0 commit 271f658

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Marlin/src/module/temperature.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -2709,13 +2709,15 @@ void Temperature::init() {
27092709

27102710
#if HAS_HOTEND
27112711
#define _TEMP_MIN_E(NR) do{ \
2712-
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))); \
2712+
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))), \
2713+
tmin = _MAX(HEATER_##NR##_MINTEMP, tmin_tmp); \
27132714
temp_range[NR].mintemp = tmin; \
27142715
while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < tmin) \
27152716
temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \
27162717
}while(0)
27172718
#define _TEMP_MAX_E(NR) do{ \
2718-
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)); \
2719+
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), \
2720+
tmax = _MIN(HEATER_##NR##_MAXTEMP, tmax_tmp); \
27192721
temp_range[NR].maxtemp = tmax; \
27202722
while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > tmax) \
27212723
temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \

0 commit comments

Comments
 (0)