Skip to content

Commit

Permalink
🚸 Wait for cooldown in MarlinUI power-off (#23476)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 authored and thinkyhead committed Jan 10, 2022
1 parent 224b6e5 commit 2ded50b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
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 BOTH(HAS_LCD_MENU, 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

0 comments on commit 2ded50b

Please sign in to comment.