From b435487da7656e8fecf7add9f88f6be779389b04 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sat, 8 Jan 2022 10:51:21 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Wait=20for=20cooldown=20in=20Mar?= =?UTF-8?q?linUI=20power-off=20(#23476)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/marlinui.cpp | 8 +++++--- Marlin/src/lcd/marlinui.h | 2 +- Marlin/src/lcd/menu/menu_main.cpp | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index ab132216c8..d22b11f9bd 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1553,11 +1553,13 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; TERN_(HAS_LCD_MENU, return_to_status()); } - #if BOTH(PSU_CONTROL, PS_OFF_CONFIRM) + #if BOTH(HAS_LCD_MENU, PSU_CONTROL) + void MarlinUI::poweroff() { - queue.inject(F("M81")); - goto_previous_screen(); + queue.inject(F("M81" TERN_(POWER_OFF_WAIT_FOR_COOLDOWN, "S"))); + return_to_status(); } + #endif void MarlinUI::flow_fault() { diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 9933841f02..c2b26b6f47 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -373,7 +373,7 @@ public: static void resume_print(); static void flow_fault(); - #if BOTH(PSU_CONTROL, PS_OFF_CONFIRM) + #if BOTH(HAS_LCD_MENU, PSU_CONTROL) static void poweroff(); #endif diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 6e66188c02..f7e974a864 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -380,7 +380,7 @@ void menu_main() { GET_TEXT(MSG_SWITCH_PS_OFF), (const char *)nullptr, PSTR("?") ); #else - GCODES_ITEM(MSG_SWITCH_PS_OFF, PSTR("M81")); + ACTION_ITEM(MSG_SWITCH_PS_OFF, ui.poweroff); #endif else GCODES_ITEM(MSG_SWITCH_PS_ON, PSTR("M80"));