🎨 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!
*/
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);

View File

@ -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;
}
}

View File

@ -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();

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_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();

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 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

View File

@ -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();

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

View File

@ -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