diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index 2a1b3b34b9..b8be9daa40 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -74,13 +74,12 @@ * This code should ALWAYS be available for FULL SHUTDOWN! */ void GcodeSuite::M81() { - thermalManager.disable_all_heaters(); planner.finish_and_disable(); + thermalManager.cooldown(); print_job_timer.stop(); #if HAS_FAN - thermalManager.zero_fan_speeds(); #if ENABLED(PROBING_FANS_OFF) thermalManager.fans_paused = false; ZERO(thermalManager.saved_fan_speed); diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 82623d7c7d..adf8f3771f 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -2735,6 +2735,7 @@ void HMI_Prepare() { queue.inject_P(G28_STR); // G28 will set home_flag Popup_Window_Home(); break; + #if HAS_ZOFFSET_ITEM case PREPARE_CASE_ZOFF: #if EITHER(HAS_BED_PROBE, BABYSTEPPING) @@ -2750,6 +2751,7 @@ void HMI_Prepare() { #endif break; #endif + #if HAS_PREHEAT case PREPARE_CASE_PLA: ui.preheat_all(0); break; #if PREHEAT_COUNT > 1 @@ -2758,18 +2760,14 @@ void HMI_Prepare() { #endif #if HAS_HOTEND || HAS_HEATED_BED - case PREPARE_CASE_COOL: - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - #if HAS_HOTEND || HAS_HEATED_BED - thermalManager.disable_all_heaters(); - #endif - break; + case PREPARE_CASE_COOL: thermalManager.cooldown(); break; #endif case PREPARE_CASE_LANG: HMI_ToggleLanguage(); Draw_Prepare_Menu(); break; + default: break; } } diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 3d5a56c869..787cf717eb 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -1787,8 +1787,7 @@ void DWIN_Print_Started(const bool sd) { // Ended print job void DWIN_Print_Finished() { if (checkkey == PrintProcess || printingIsActive()) { - thermalManager.disable_all_heaters(); - thermalManager.zero_fan_speeds(); + thermalManager.cooldown(); HMI_flag.print_finish = true; } } @@ -2116,17 +2115,13 @@ void SetHome() { #endif #if HAS_PREHEAT - void SetCoolDown() { - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - #if HAS_HOTEND || HAS_HEATED_BED - thermalManager.disable_all_heaters(); - #endif - } void DoPreheat0() { ui.preheat_all(0); } void DoPreheat1() { ui.preheat_all(1); } void DoPreheat2() { ui.preheat_all(2); } #endif +void DoCoolDown() { thermalManager.cooldown(); } + void SetLanguage() { HMI_ToggleLanguage(); CurrentMenu = nullptr; // Invalidate menu to full redraw @@ -3126,8 +3121,8 @@ void Draw_Prepare_Menu() { #if PREHEAT_COUNT > 2 ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, DoPreheat2); #endif - ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown); #endif + ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, DoCoolDown); ADDMENUITEM(ICON_Language, PSTR("UI Language"), onDrawLanguage, SetLanguage); } CurrentMenu->draw(); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 54266e717b..80ef88d0b2 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -1030,7 +1030,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define PREPARE_MANUALLEVEL (PREPARE_HOME + 1) #define PREPARE_ZOFFSET (PREPARE_MANUALLEVEL + ENABLED(HAS_ZOFFSET_ITEM)) #define PREPARE_PREHEAT (PREPARE_ZOFFSET + ENABLED(HAS_PREHEAT)) - #define PREPARE_COOLDOWN (PREPARE_PREHEAT + ENABLED(HAS_PREHEAT)) + #define PREPARE_COOLDOWN (PREPARE_PREHEAT + EITHER(HAS_HOTEND, HAS_HEATED_BED)) #define PREPARE_CHANGEFIL (PREPARE_COOLDOWN + ENABLED(ADVANCED_PAUSE_FEATURE)) #define PREPARE_TOTAL PREPARE_CHANGEFIL @@ -1096,13 +1096,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ else Draw_Menu(Preheat); break; + #endif + + #if HAS_HOTEND || HAS_HEATED_BED case PREPARE_COOLDOWN: if (draw) Draw_Menu_Item(row, ICON_Cool, F("Cooldown")); - else { - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - thermalManager.disable_all_heaters(); - } + else + thermalManager.cooldown(); break; #endif @@ -1597,8 +1598,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define PREHEAT_TOTAL PREHEAT_5 auto do_preheat = [](const uint8_t m) { - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); + thermalManager.cooldown(); if (preheatmode == 0 || preheatmode == 1) { ui.preheat_hotend_and_fan(m); } if (preheatmode == 0 || preheatmode == 2) ui.preheat_bed(m); }; @@ -4496,8 +4496,7 @@ void CrealityDWINClass::Popup_Control() { TERN_(HAS_HOTEND, pausetemp = thermalManager.temp_hotend[0].target); TERN_(HAS_HEATED_BED, pausebed = thermalManager.temp_bed.target); TERN_(HAS_FAN, pausefan = thermalManager.fan_speed[0]); - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); + thermalManager.cooldown(); #endif } else { @@ -4510,8 +4509,7 @@ void CrealityDWINClass::Popup_Control() { if (selection == 0) { if (sdprint) { ui.abort_print(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - thermalManager.disable_all_heaters(); + thermalManager.cooldown(); } else { TERN_(HOST_ACTION_COMMANDS, hostui.cancel()); @@ -4741,8 +4739,7 @@ void CrealityDWINClass::Start_Print(bool sd) { void CrealityDWINClass::Stop_Print() { printing = false; sdprint = false; - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - thermalManager.disable_all_heaters(); + thermalManager.cooldown(); TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(100 * (PROGRESS_SCALE))); TERN_(USE_M73_REMAINING_TIME, ui.set_remaining_time(0)); Draw_Print_confirm(); diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index be00b9c73a..2b00fd16f8 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -626,14 +626,11 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr default: switch (var.VP) { default: return; - case VP_E0_BED_PREHEAT: TERN_(HAS_HOTEND, ui.preheat_all(0)); break; + case VP_E0_BED_PREHEAT: TERN_(HAS_HOTEND, ui.preheat_all(0)); break; case VP_E1_BED_PREHEAT: TERN_(HAS_MULTI_HOTEND, ui.preheat_all(1)); break; } case 7: break; // Custom preheat - case 9: // Cool down - thermalManager.zero_fan_speeds(); - thermalManager.disable_all_heaters(); - break; + case 9: thermalManager.cooldown(); break; // Cool down } // Go to the preheat screen to show the heating progress diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 7ce89c922a..54e7db55c2 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -1034,10 +1034,7 @@ namespace ExtUI { void setFeedrate_percent(const_float_t value) { feedrate_percentage = constrain(value, 10, 500); } - void coolDown() { - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - } + void coolDown() { thermalManager.cooldown(); } bool awaitingUserConfirm() { return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || getHostKeepaliveIsPaused(); diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 5524793b19..0e36884858 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -143,8 +143,7 @@ void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t i #if HAS_TEMP_HOTEND || HAS_HEATED_BED void lcd_cooldown() { - thermalManager.zero_fan_speeds(); - thermalManager.disable_all_heaters(); + thermalManager.cooldown(); ui.return_to_status(); } diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 5579f71172..0e66f23110 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -848,6 +848,14 @@ class Temperature { */ static void disable_all_heaters(); + /** + * Cooldown, as from the LCD. Disables all heaters and fans. + */ + static inline void cooldown() { + zero_fan_speeds(); + disable_all_heaters(); + } + #if ENABLED(PRINTJOB_TIMER_AUTOSTART) /** * Methods to check if heaters are enabled, indicating an active job