diff --git a/Marlin/macros.h b/Marlin/macros.h index a2e767cd6..2859bfeee 100644 --- a/Marlin/macros.h +++ b/Marlin/macros.h @@ -126,8 +126,10 @@ #define CEILING(x,y) (((x) + (y) - 1) / (y)) +#define MIN3(a, b, c) min(min(a, b), c) +#define MIN4(a, b, c, d) min(min(a, b), min(c, d)) #define MAX3(a, b, c) max(max(a, b), c) -#define MAX4(a, b, c, d) max(max(max(a, b), c), d) +#define MAX4(a, b, c, d) max(max(a, b), max(c, d)) #define UNEAR_ZERO(x) ((x) < 0.000001) #define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 1f9f3e0a7..dbd11c6e0 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1788,11 +1788,24 @@ void kill_screen(const char* lcd_msg) { } void _lcd_control_temperature_preheat_settings_menu(uint8_t material) { + #if HOTENDS > 3 + #define MINTEMP_ALL MIN4(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP) + #define MAXTEMP_ALL MAX4(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP) + #elif HOTENDS > 2 + #define MINTEMP_ALL MIN3(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP) + #define MAXTEMP_ALL MAX3(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP) + #elif HOTENDS > 1 + #define MINTEMP_ALL min(HEATER_0_MINTEMP, HEATER_1_MINTEMP) + #define MAXTEMP_ALL max(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP) + #else + #define MINTEMP_ALL HEATER_0_MINTEMP + #define MAXTEMP_ALL HEATER_0_MAXTEMP + #endif START_MENU(); MENU_BACK(MSG_TEMPERATURE); MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &lcd_preheat_fan_speed[material], 0, 255); #if TEMP_SENSOR_0 != 0 - MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], HEATER_0_MINTEMP, HEATER_0_MAXTEMP - 15); + MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15); #endif #if TEMP_SENSOR_BED != 0 MENU_ITEM_EDIT(int3, MSG_BED, &lcd_preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15);