From 67fb261b41e2f098abbd8bb0aa2f9ffd66695237 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 ab132216c888..d22b11f9bd80 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 9933841f0284..c2b26b6f4723 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -373,7 +373,7 @@ class MarlinUI { 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 6e66188c02ce..f7e974a8649b 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"));