From 2ebfe90be964e321ee222c25eb4b15a392543f85 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Mon, 10 Sep 2018 01:51:46 -0600 Subject: [PATCH] Add custom preheat temp to filament change (#11475) --- Marlin/src/lcd/language/language_en.h | 3 +++ Marlin/src/lcd/ultralcd.cpp | 26 ++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index c96c659975..7e976a5b4c 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -154,6 +154,9 @@ #ifndef MSG_PREHEAT_2_SETTINGS #define MSG_PREHEAT_2_SETTINGS MSG_PREHEAT_2 _UxGT(" conf") #endif +#ifndef MSG_PREHEAT_CUSTOM + #define MSG_PREHEAT_CUSTOM _UxGT("Preheat Custom") +#endif #ifndef MSG_COOLDOWN #define MSG_COOLDOWN _UxGT("Cooldown") #endif diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index b02b9a932f..20d642962d 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -4330,14 +4330,15 @@ void lcd_quick_feedback(const bool clear_buttons) { return PSTR(MSG_FILAMENTCHANGE); } - void _change_filament_temp(const uint8_t index) { + void _change_filament_temp(const uint16_t temperature) { char cmd[11]; sprintf_P(cmd, _change_filament_temp_command(), _change_filament_temp_extruder); - thermalManager.setTargetHotend(index == 1 ? PREHEAT_1_TEMP_HOTEND : PREHEAT_2_TEMP_HOTEND, _change_filament_temp_extruder); + thermalManager.setTargetHotend(temperature, _change_filament_temp_extruder); lcd_enqueue_command(cmd); } - void _lcd_change_filament_temp_1_menu() { _change_filament_temp(1); } - void _lcd_change_filament_temp_2_menu() { _change_filament_temp(2); } + void _lcd_change_filament_temp_1_menu() { _change_filament_temp(PREHEAT_1_TEMP_HOTEND); } + void _lcd_change_filament_temp_2_menu() { _change_filament_temp(PREHEAT_2_TEMP_HOTEND); } + void _lcd_change_filament_temp_custom_menu() { _change_filament_temp(thermalManager.target_temperature[_change_filament_temp_extruder]); } static const char* change_filament_header(const AdvancedPauseMode mode) { switch (mode) { @@ -4358,6 +4359,23 @@ void lcd_quick_feedback(const bool clear_buttons) { MENU_BACK(MSG_FILAMENTCHANGE); MENU_ITEM(submenu, MSG_PREHEAT_1, _lcd_change_filament_temp_1_menu); MENU_ITEM(submenu, MSG_PREHEAT_2, _lcd_change_filament_temp_2_menu); + uint16_t max_temp; + switch (extruder) { + default: max_temp = HEATER_0_MAXTEMP; + #if HOTENDS > 1 + case 1: max_temp = HEATER_1_MAXTEMP; break; + #if HOTENDS > 2 + case 2: max_temp = HEATER_2_MAXTEMP; break; + #if HOTENDS > 3 + case 3: max_temp = HEATER_3_MAXTEMP; break; + #if HOTENDS > 4 + case 4: max_temp = HEATER_4_MAXTEMP; break; + #endif + #endif + #endif + #endif + } + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PREHEAT_CUSTOM, &thermalManager.target_temperature[_change_filament_temp_extruder], EXTRUDE_MINTEMP, max_temp - 15, _lcd_change_filament_temp_custom_menu); END_MENU(); } void lcd_temp_menu_e0_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 0); }