diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index bd974d8d0a..679c43b402 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -153,7 +153,17 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; TERN_(HAS_HOTEND, if (TEST(pmask, PT_HOTEND)) thermalManager.setTargetHotend(pre.hotend_temp, e)); TERN_(HAS_HEATED_BED, if (TEST(pmask, PT_BED)) thermalManager.setTargetBed(pre.bed_temp)); TERN_(HAS_HEATED_CHAMBER, if (TEST(pmask, PT_CHAMBER)) thermalManager.setTargetChamber(pre.chamber_temp)); - TERN_(HAS_FAN, if (TEST(pmask, PT_FAN)) thermalManager.set_fan_speed(0, pre.fan_speed)); + TERN_(HAS_FAN, if (TEST(pmask, PT_FAN)) thermalManager.set_fan_speed(e, pre.fan_speed)); + #if HAS_FAN + if (TEST(pmask, PT_FAN)) { + const uint8_t fan_index = e < (FAN_COUNT) ? e : 0; + if (true + #if REDUNDANT_PART_COOLING_FAN + && fan_index != REDUNDANT_PART_COOLING_FAN + #endif + ) thermalManager.set_fan_speed(fan_index, pre.fan_speed); + } + #endif } #endif @@ -1935,7 +1945,7 @@ uint8_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t ind, settings.reset(); completion_feedback(); #if ENABLED(TOUCH_SCREEN_CALIBRATION) - if (touch_calibration.need_calibration()) ui.goto_screen(touch_screen_calibration); + if (touch_calibration.need_calibration()) goto_screen(touch_screen_calibration); #endif } diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 26b559e6bc..9f2ac5a69a 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -652,7 +652,8 @@ public: static void preheat_hotend(const uint8_t m, const uint8_t e=active_extruder) { TERN_(HAS_HOTEND, apply_preheat(m, _BV(PT_HOTEND))); } static void preheat_hotend_and_fan(const uint8_t m, const uint8_t e=active_extruder) { preheat_hotend(m, e); preheat_set_fan(m); } static void preheat_bed(const uint8_t m) { TERN_(HAS_HEATED_BED, apply_preheat(m, _BV(PT_BED))); } - static void preheat_all(const uint8_t m) { apply_preheat(m, PT_ALL); } + static void preheat_chamber(const uint8_t m) { TERN_(HAS_HEATED_CHAMBER, apply_preheat(m, _BV(PT_CHAMBER))); } + static void preheat_all(const uint8_t m, const uint8_t e=active_extruder) { apply_preheat(m, PT_ALL, e); } #endif static void reset_status_timeout(const millis_t ms) { diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 0a376494e5..b43f906cc7 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -45,66 +45,34 @@ #if HAS_PREHEAT - /** - * @fn Temperature::lcd_preheat - * @brief Apply the "preheat" parameters for a material preset to the - * hotend (or laser), bed, chamber, or all of the above. - * @param m Material index - * @param targets Bit mask of targets to "preheat" (or turn off) - * @param e Extruder index (if needed) - */ - void Temperature::lcd_preheat(const uint8_t m, const uint8_t targets, const uint8_t e/*=0*/) { - UNUSED(e); - #if HAS_HOTEND - if (targets & PreheatTarget::HOTEND) setTargetHotend(ui.material_preset[m].hotend_temp, e); - #endif - #if HAS_HEATED_BED - if (targets & PreheatTarget::BED) setTargetBed(ui.material_preset[m].bed_temp); - #endif - #if HAS_HEATED_CHAMBER - if (targets & PreheatTarget::CHAMBER) setTargetChamber(ui.material_preset[m].chamber_temp); - #endif - #if HAS_FAN - if (targets & PreheatTarget::HOTEND) { - const uint8_t fan_index = active_extruder < (FAN_COUNT) ? active_extruder : 0; - if (true - #if REDUNDANT_PART_COOLING_FAN - && fan_index != REDUNDANT_PART_COOLING_FAN - #endif - ) set_fan_speed(fan_index, ui.material_preset[m].fan_speed); - } - #endif - ui.return_to_status(); - } - #if HAS_TEMP_HOTEND - inline void _preheat_end(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::HOTEND, e); } - void do_preheat_end_m() { _preheat_end(0, editable.int8); } + inline void _preheat_end(const uint8_t m, const uint8_t e) { ui.preheat_hotend(m, e); ui.return_to_status(); } + void do_preheat_end_m() { _preheat_end(editable.int8, 0); } #endif #if HAS_HEATED_BED - inline void _preheat_bed(const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::BED); } + inline void _preheat_bed(const uint8_t m) { ui.preheat_bed(m); ui.return_to_status(); } #endif #if HAS_HEATED_CHAMBER - inline void _preheat_chamber(const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::CHAMBER); } + inline void _preheat_chamber(const uint8_t m) { ui.preheat_chamber(m); ui.return_to_status(); } #endif #if HAS_COOLER - inline void _precool_laser(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::HOTEND, e); } - void do_precool_laser_m() { _precool_laser(thermalManager.temp_cooler.target, editable.int8); } + inline void _precool_laser(const uint8_t m, const uint8_t e) { ui.preheat_hotend(m, e); ui.return_to_status(); } + void do_precool_laser_m() { _precool_laser(editable.int8, thermalManager.temp_cooler.target); } #endif #if HAS_TEMP_HOTEND && (HAS_HEATED_BED || HAS_HEATED_CHAMBER) - inline void _preheat_all(const uint8_t e, const uint8_t m) { thermalManager.lcd_preheat(m, PreheatTarget::ALL, e); } + inline void _preheat_all(const uint8_t m, const uint8_t e) { ui.preheat_all(m, e); ui.return_to_status(); } // Indexed "Preheat ABC" and "Heat Bed" items #define PREHEAT_ITEMS(M,E) do{ \ - ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_all(MenuItemBase::itemIndex, M); }); \ - ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_END_E, []{ _preheat_end(MenuItemBase::itemIndex, M); }); \ + ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_all(M, MenuItemBase::itemIndex); }); \ + ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_END_E, []{ _preheat_end(M, MenuItemBase::itemIndex); }); \ }while(0) #elif HAS_MULTI_HOTEND // No heated bed, so just indexed "Preheat ABC" items - #define PREHEAT_ITEMS(M,E) ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_end(MenuItemBase::itemIndex, M); }) + #define PREHEAT_ITEMS(M,E) ACTION_ITEM_N_f(E, ui.get_preheat_label(M), MSG_PREHEAT_M_H, []{ _preheat_end(M, MenuItemBase::itemIndex); }) #endif @@ -121,7 +89,7 @@ #if HOTENDS == 1 #if HAS_HEATED_BED || HAS_HEATED_CHAMBER - ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, []{ _preheat_all(0, editable.int8); }); + ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, []{ _preheat_all(editable.int8, 0); }); ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M_END, do_preheat_end_m); #else ACTION_ITEM_f(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m); diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 5f7ea8daf4..934b1b1246 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -599,15 +599,6 @@ typedef struct { raw_adc_t raw_min, raw_max; celsius_t mintemp, maxtemp; } temp_ #define HAS_FAN_LOGIC 1 #endif -#if HAS_MARLINUI_MENU && HAS_TEMPERATURE && HAS_PREHEAT - enum PreheatTarget : uint8_t { - HOTEND = (1 << 0), - BED = (1 << 1), - CHAMBER = (1 << 2), - ALL = 0xFF - }; -#endif - class Temperature { public: @@ -1343,11 +1334,6 @@ class Temperature { static void set_heating_message(const uint8_t, const bool=false) {} #endif - #if HAS_MARLINUI_MENU && HAS_TEMPERATURE && HAS_PREHEAT - // Apply the "preheat" parameters for a material preset to the hotend (or laser), bed, chamber, or all of the above - static void lcd_preheat(const uint8_t m, const uint8_t targets, const uint8_t e=0); - #endif - private: // Reading raw temperatures and converting to Celsius when ready