Browse Source

🐛 Fix min/max temp evaluation

Fixes #24257
Scott Lahteine 2 years ago
parent
commit
9c872b214c
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      Marlin/src/module/temperature.cpp

+ 4
- 2
Marlin/src/module/temperature.cpp View File

2709
 
2709
 
2710
   #if HAS_HOTEND
2710
   #if HAS_HOTEND
2711
     #define _TEMP_MIN_E(NR) do{ \
2711
     #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); \
2713
       temp_range[NR].mintemp = tmin; \
2714
       temp_range[NR].mintemp = tmin; \
2714
       while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < tmin) \
2715
       while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < tmin) \
2715
         temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \
2716
         temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \
2716
     }while(0)
2717
     }while(0)
2717
     #define _TEMP_MAX_E(NR) do{ \
2718
     #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); \
2719
       temp_range[NR].maxtemp = tmax; \
2721
       temp_range[NR].maxtemp = tmax; \
2720
       while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > tmax) \
2722
       while (analog_to_celsius_hotend(temp_range[NR].raw_max, NR) > tmax) \
2721
         temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \
2723
         temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \

Loading…
Cancel
Save