From ce2e60539eabd72da7af554ad65d273b1ede73f8 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Mon, 6 Aug 2018 10:46:46 -0600 Subject: [PATCH] Add custom preheat temp to filament change - Adds a "Preheat Custom" option under "Preheat ABS" and "Preheat PLA" in the "Change Filament" screen for custom temperature selection. --- 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 c96c65997534..7e976a5b4cec 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 b02b9a932fd8..20d642962d7d 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); }