From bb4529f7d2a9a8dd3cc6f485bd5583d38de195a1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 28 Nov 2016 00:39:06 -0600 Subject: [PATCH 1/3] PLA / ABS => Material 1 / 2 --- Marlin/ultralcd.cpp | 88 ++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index c4fcf65e62..1f9f3e0a7e 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -120,8 +120,8 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to void lcd_move_menu(); void lcd_control_menu(); void lcd_control_temperature_menu(); - void lcd_control_temperature_preheat_pla_settings_menu(); - void lcd_control_temperature_preheat_abs_settings_menu(); + void lcd_control_temperature_preheat_material1_settings_menu(); + void lcd_control_temperature_preheat_material2_settings_menu(); void lcd_control_motion_menu(); void lcd_control_volumetric_menu(); @@ -908,23 +908,23 @@ void kill_screen(const char* lcd_msg) { } #if TEMP_SENSOR_0 != 0 - void lcd_preheat_pla0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_abs0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } + void lcd_preheat_material1_hotend0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } + void lcd_preheat_material2_hotend0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif #if HOTENDS > 1 - void lcd_preheat_pla1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_abs1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } + void lcd_preheat_material1_hotend1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } + void lcd_preheat_material2_hotend1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #if HOTENDS > 2 - void lcd_preheat_pla2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_abs2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } + void lcd_preheat_material1_hotend2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } + void lcd_preheat_material2_hotend2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #if HOTENDS > 3 - void lcd_preheat_pla3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_abs3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } + void lcd_preheat_material1_hotend3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } + void lcd_preheat_material2_hotend3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif #endif - void lcd_preheat_pla0123() { + void lcd_preheat_material1_hotend0123() { #if HOTENDS > 1 thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 1); #if HOTENDS > 2 @@ -934,9 +934,9 @@ void kill_screen(const char* lcd_msg) { #endif #endif #endif - lcd_preheat_pla0(); + lcd_preheat_material1_hotend0(); } - void lcd_preheat_abs0123() { + void lcd_preheat_material2_hotend0123() { #if HOTENDS > 1 thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 1); #if HOTENDS > 2 @@ -946,58 +946,58 @@ void kill_screen(const char* lcd_msg) { #endif #endif #endif - lcd_preheat_abs0(); + lcd_preheat_material2_hotend0(); } #endif // HOTENDS > 1 #if TEMP_SENSOR_BED != 0 - void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } + void lcd_preheat_material1_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } + void lcd_preheat_material2_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } #endif #if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0) - void lcd_preheat_pla_menu() { + void lcd_preheat_material1_menu() { START_MENU(); MENU_BACK(MSG_PREPARE); #if HOTENDS == 1 - MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_pla0); + MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_material1_hotend0); #else - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_pla0); - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_pla1); + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_material1_hotend0); + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_material1_hotend1); #if HOTENDS > 2 - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_pla2); + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_material1_hotend2); #if HOTENDS > 3 - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_pla3); + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_material1_hotend3); #endif #endif - MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_pla0123); + MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_material1_hotend0123); #endif #if TEMP_SENSOR_BED != 0 - MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_pla_bedonly); + MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_material1_bedonly); #endif END_MENU(); } - void lcd_preheat_abs_menu() { + void lcd_preheat_material2_menu() { START_MENU(); MENU_BACK(MSG_PREPARE); #if HOTENDS == 1 - MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_abs0); + MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_material2_hotend0); #else - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_abs0); - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_abs1); + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_material2_hotend0); + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_material2_hotend1); #if HOTENDS > 2 - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_abs2); + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_material2_hotend2); #if HOTENDS > 3 - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_abs3); + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_material2_hotend3); #endif #endif - MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_abs0123); + MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_material2_hotend0123); #endif #if TEMP_SENSOR_BED != 0 - MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_abs_bedonly); + MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_material2_bedonly); #endif END_MENU(); } @@ -1273,11 +1273,11 @@ void kill_screen(const char* lcd_msg) { // #if TEMP_SENSOR_0 != 0 #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0 - MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_pla_menu); - MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_abs_menu); + MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_material1_menu); + MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_material2_menu); #else - MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_pla0); - MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_abs0); + MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_material1_hotend0); + MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_material2_hotend0); #endif #endif @@ -1776,14 +1776,14 @@ void kill_screen(const char* lcd_msg) { #endif //PIDTEMP // - // Preheat PLA conf + // Preheat Material 1 conf // - MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu); + MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_control_temperature_preheat_material1_settings_menu); // - // Preheat ABS conf + // Preheat Material 2 conf // - MENU_ITEM(submenu, MSG_PREHEAT_2_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu); + MENU_ITEM(submenu, MSG_PREHEAT_2_SETTINGS, lcd_control_temperature_preheat_material2_settings_menu); END_MENU(); } @@ -1805,17 +1805,17 @@ void kill_screen(const char* lcd_msg) { /** * - * "Temperature" > "Preheat PLA conf" submenu + * "Temperature" > "Preheat Material 1 conf" submenu * */ - void lcd_control_temperature_preheat_pla_settings_menu() { _lcd_control_temperature_preheat_settings_menu(0); } + void lcd_control_temperature_preheat_material1_settings_menu() { _lcd_control_temperature_preheat_settings_menu(0); } /** * - * "Temperature" > "Preheat ABS conf" submenu + * "Temperature" > "Preheat Material 2 conf" submenu * */ - void lcd_control_temperature_preheat_abs_settings_menu() { _lcd_control_temperature_preheat_settings_menu(1); } + void lcd_control_temperature_preheat_material2_settings_menu() { _lcd_control_temperature_preheat_settings_menu(1); } void _reset_acceleration_rates() { planner.reset_acceleration_rates(); } void _planner_refresh_positioning() { planner.refresh_positioning(); } From c9193e856d726c5ad90789a2fd1897c9714308bd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 28 Nov 2016 00:51:52 -0600 Subject: [PATCH 2/3] Limit preheat parameters based on all nozzles --- Marlin/macros.h | 4 +++- Marlin/ultralcd.cpp | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Marlin/macros.h b/Marlin/macros.h index a2e767cd62..2859bfeee2 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 1f9f3e0a7e..dbd11c6e0f 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); From 0951d385ce723a54cb42838416056cef94b326bd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 28 Nov 2016 00:57:36 -0600 Subject: [PATCH 3/3] Don't set heater temperature above its maximum --- Marlin/ultralcd.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index dbd11c6e0f..852091cdf9 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -883,13 +883,15 @@ void kill_screen(const char* lcd_msg) { } #endif + constexpr int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP); + /** * * "Prepare" submenu items * */ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) { - if (temph > 0) thermalManager.setTargetHotend(temph, endnum); + if (temph > 0) thermalManager.setTargetHotend(min(heater_maxtemp[endnum], temph), endnum); #if TEMP_SENSOR_BED != 0 thermalManager.setTargetBed(tempb); #else @@ -1583,7 +1585,6 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(PIDTEMP) int autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150); - const int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP); #endif #if ENABLED(PIDTEMPBED)