🎨 Standard 'cooldown' method

This commit is contained in:
Scott Lahteine 2021-10-27 21:36:06 -05:00 committed by Scott Lahteine
parent 205d867e4b
commit d29a9014f2
8 changed files with 31 additions and 41 deletions

View File

@ -74,13 +74,12 @@
* This code should ALWAYS be available for FULL SHUTDOWN! * This code should ALWAYS be available for FULL SHUTDOWN!
*/ */
void GcodeSuite::M81() { void GcodeSuite::M81() {
thermalManager.disable_all_heaters();
planner.finish_and_disable(); planner.finish_and_disable();
thermalManager.cooldown();
print_job_timer.stop(); print_job_timer.stop();
#if HAS_FAN #if HAS_FAN
thermalManager.zero_fan_speeds();
#if ENABLED(PROBING_FANS_OFF) #if ENABLED(PROBING_FANS_OFF)
thermalManager.fans_paused = false; thermalManager.fans_paused = false;
ZERO(thermalManager.saved_fan_speed); ZERO(thermalManager.saved_fan_speed);

View File

@ -2735,6 +2735,7 @@ void HMI_Prepare() {
queue.inject_P(G28_STR); // G28 will set home_flag queue.inject_P(G28_STR); // G28 will set home_flag
Popup_Window_Home(); Popup_Window_Home();
break; break;
#if HAS_ZOFFSET_ITEM #if HAS_ZOFFSET_ITEM
case PREPARE_CASE_ZOFF: case PREPARE_CASE_ZOFF:
#if EITHER(HAS_BED_PROBE, BABYSTEPPING) #if EITHER(HAS_BED_PROBE, BABYSTEPPING)
@ -2750,6 +2751,7 @@ void HMI_Prepare() {
#endif #endif
break; break;
#endif #endif
#if HAS_PREHEAT #if HAS_PREHEAT
case PREPARE_CASE_PLA: ui.preheat_all(0); break; case PREPARE_CASE_PLA: ui.preheat_all(0); break;
#if PREHEAT_COUNT > 1 #if PREHEAT_COUNT > 1
@ -2758,18 +2760,14 @@ void HMI_Prepare() {
#endif #endif
#if HAS_HOTEND || HAS_HEATED_BED #if HAS_HOTEND || HAS_HEATED_BED
case PREPARE_CASE_COOL: case PREPARE_CASE_COOL: thermalManager.cooldown(); break;
TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
#if HAS_HOTEND || HAS_HEATED_BED
thermalManager.disable_all_heaters();
#endif
break;
#endif #endif
case PREPARE_CASE_LANG: case PREPARE_CASE_LANG:
HMI_ToggleLanguage(); HMI_ToggleLanguage();
Draw_Prepare_Menu(); Draw_Prepare_Menu();
break; break;
default: break; default: break;
} }
} }

View File

@ -1787,8 +1787,7 @@ void DWIN_Print_Started(const bool sd) {
// Ended print job // Ended print job
void DWIN_Print_Finished() { void DWIN_Print_Finished() {
if (checkkey == PrintProcess || printingIsActive()) { if (checkkey == PrintProcess || printingIsActive()) {
thermalManager.disable_all_heaters(); thermalManager.cooldown();
thermalManager.zero_fan_speeds();
HMI_flag.print_finish = true; HMI_flag.print_finish = true;
} }
} }
@ -2116,17 +2115,13 @@ void SetHome() {
#endif #endif
#if HAS_PREHEAT #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 DoPreheat0() { ui.preheat_all(0); }
void DoPreheat1() { ui.preheat_all(1); } void DoPreheat1() { ui.preheat_all(1); }
void DoPreheat2() { ui.preheat_all(2); } void DoPreheat2() { ui.preheat_all(2); }
#endif #endif
void DoCoolDown() { thermalManager.cooldown(); }
void SetLanguage() { void SetLanguage() {
HMI_ToggleLanguage(); HMI_ToggleLanguage();
CurrentMenu = nullptr; // Invalidate menu to full redraw CurrentMenu = nullptr; // Invalidate menu to full redraw
@ -3126,8 +3121,8 @@ void Draw_Prepare_Menu() {
#if PREHEAT_COUNT > 2 #if PREHEAT_COUNT > 2
ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, DoPreheat2); ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, DoPreheat2);
#endif #endif
ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown);
#endif #endif
ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, DoCoolDown);
ADDMENUITEM(ICON_Language, PSTR("UI Language"), onDrawLanguage, SetLanguage); ADDMENUITEM(ICON_Language, PSTR("UI Language"), onDrawLanguage, SetLanguage);
} }
CurrentMenu->draw(); CurrentMenu->draw();

View File

@ -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_MANUALLEVEL (PREPARE_HOME + 1)
#define PREPARE_ZOFFSET (PREPARE_MANUALLEVEL + ENABLED(HAS_ZOFFSET_ITEM)) #define PREPARE_ZOFFSET (PREPARE_MANUALLEVEL + ENABLED(HAS_ZOFFSET_ITEM))
#define PREPARE_PREHEAT (PREPARE_ZOFFSET + ENABLED(HAS_PREHEAT)) #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_CHANGEFIL (PREPARE_COOLDOWN + ENABLED(ADVANCED_PAUSE_FEATURE))
#define PREPARE_TOTAL PREPARE_CHANGEFIL #define PREPARE_TOTAL PREPARE_CHANGEFIL
@ -1096,13 +1096,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
else else
Draw_Menu(Preheat); Draw_Menu(Preheat);
break; break;
#endif
#if HAS_HOTEND || HAS_HEATED_BED
case PREPARE_COOLDOWN: case PREPARE_COOLDOWN:
if (draw) if (draw)
Draw_Menu_Item(row, ICON_Cool, F("Cooldown")); Draw_Menu_Item(row, ICON_Cool, F("Cooldown"));
else { else
TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); thermalManager.cooldown();
thermalManager.disable_all_heaters();
}
break; break;
#endif #endif
@ -1597,8 +1598,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
#define PREHEAT_TOTAL PREHEAT_5 #define PREHEAT_TOTAL PREHEAT_5
auto do_preheat = [](const uint8_t m) { auto do_preheat = [](const uint8_t m) {
thermalManager.disable_all_heaters(); thermalManager.cooldown();
TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
if (preheatmode == 0 || preheatmode == 1) { ui.preheat_hotend_and_fan(m); } if (preheatmode == 0 || preheatmode == 1) { ui.preheat_hotend_and_fan(m); }
if (preheatmode == 0 || preheatmode == 2) ui.preheat_bed(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_HOTEND, pausetemp = thermalManager.temp_hotend[0].target);
TERN_(HAS_HEATED_BED, pausebed = thermalManager.temp_bed.target); TERN_(HAS_HEATED_BED, pausebed = thermalManager.temp_bed.target);
TERN_(HAS_FAN, pausefan = thermalManager.fan_speed[0]); TERN_(HAS_FAN, pausefan = thermalManager.fan_speed[0]);
thermalManager.disable_all_heaters(); thermalManager.cooldown();
TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
#endif #endif
} }
else { else {
@ -4510,8 +4509,7 @@ void CrealityDWINClass::Popup_Control() {
if (selection == 0) { if (selection == 0) {
if (sdprint) { if (sdprint) {
ui.abort_print(); ui.abort_print();
TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); thermalManager.cooldown();
thermalManager.disable_all_heaters();
} }
else { else {
TERN_(HOST_ACTION_COMMANDS, hostui.cancel()); TERN_(HOST_ACTION_COMMANDS, hostui.cancel());
@ -4741,8 +4739,7 @@ void CrealityDWINClass::Start_Print(bool sd) {
void CrealityDWINClass::Stop_Print() { void CrealityDWINClass::Stop_Print() {
printing = false; printing = false;
sdprint = false; sdprint = false;
TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); thermalManager.cooldown();
thermalManager.disable_all_heaters();
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(100 * (PROGRESS_SCALE))); TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(100 * (PROGRESS_SCALE)));
TERN_(USE_M73_REMAINING_TIME, ui.set_remaining_time(0)); TERN_(USE_M73_REMAINING_TIME, ui.set_remaining_time(0));
Draw_Print_confirm(); Draw_Print_confirm();

View File

@ -630,10 +630,7 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
case VP_E1_BED_PREHEAT: TERN_(HAS_MULTI_HOTEND, ui.preheat_all(1)); break; case VP_E1_BED_PREHEAT: TERN_(HAS_MULTI_HOTEND, ui.preheat_all(1)); break;
} }
case 7: break; // Custom preheat case 7: break; // Custom preheat
case 9: // Cool down case 9: thermalManager.cooldown(); break; // Cool down
thermalManager.zero_fan_speeds();
thermalManager.disable_all_heaters();
break;
} }
// Go to the preheat screen to show the heating progress // Go to the preheat screen to show the heating progress

View File

@ -1034,10 +1034,7 @@ namespace ExtUI {
void setFeedrate_percent(const_float_t value) { feedrate_percentage = constrain(value, 10, 500); } void setFeedrate_percent(const_float_t value) { feedrate_percentage = constrain(value, 10, 500); }
void coolDown() { void coolDown() { thermalManager.cooldown(); }
thermalManager.disable_all_heaters();
TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
}
bool awaitingUserConfirm() { bool awaitingUserConfirm() {
return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || getHostKeepaliveIsPaused(); return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || getHostKeepaliveIsPaused();

View File

@ -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 #if HAS_TEMP_HOTEND || HAS_HEATED_BED
void lcd_cooldown() { void lcd_cooldown() {
thermalManager.zero_fan_speeds(); thermalManager.cooldown();
thermalManager.disable_all_heaters();
ui.return_to_status(); ui.return_to_status();
} }

View File

@ -848,6 +848,14 @@ class Temperature {
*/ */
static void disable_all_heaters(); 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) #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
/** /**
* Methods to check if heaters are enabled, indicating an active job * Methods to check if heaters are enabled, indicating an active job