Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for cooldown when power-off from menu #23476

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1553,10 +1553,14 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
TERN_(HAS_LCD_MENU, return_to_status());
}

#if BOTH(PSU_CONTROL, PS_OFF_CONFIRM)
#if ENABLED(PSU_CONTROL)
void MarlinUI::poweroff() {
queue.inject(F("M81"));
goto_previous_screen();
#if ENABLED(POWER_OFF_WAIT_FOR_COOLDOWN)
queue.inject(F("M81 S"));
#else
queue.inject(F("M81"));
#endif
TERN_(HAS_LCD_MENU, return_to_status());
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class MarlinUI {
static void resume_print();
static void flow_fault();

#if BOTH(PSU_CONTROL, PS_OFF_CONFIRM)
#if ENABLED(PSU_CONTROL)
static void poweroff();
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down