✨ Power-off confirm / beep options (#22191)
This commit is contained in:
		@@ -1498,6 +1498,13 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
    TERN_(HAS_LCD_MENU, return_to_status());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  #if BOTH(PSU_CONTROL, PS_OFF_CONFIRM)
 | 
			
		||||
    void MarlinUI::poweroff() {
 | 
			
		||||
      queue.inject_P(PSTR("M81"));
 | 
			
		||||
      goto_previous_screen();
 | 
			
		||||
    }
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  void MarlinUI::flow_fault() {
 | 
			
		||||
    LCD_ALERTMESSAGEPGM(MSG_FLOWMETER_FAULT);
 | 
			
		||||
    TERN_(HAS_BUZZER, buzz(1000, 440));
 | 
			
		||||
 
 | 
			
		||||
@@ -359,6 +359,10 @@ public:
 | 
			
		||||
    static void resume_print();
 | 
			
		||||
    static void flow_fault();
 | 
			
		||||
 | 
			
		||||
    #if BOTH(PSU_CONTROL, PS_OFF_CONFIRM)
 | 
			
		||||
      static void poweroff();
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    #if HAS_WIRED_LCD
 | 
			
		||||
 | 
			
		||||
      static millis_t next_button_update_ms;
 | 
			
		||||
 
 | 
			
		||||
@@ -386,7 +386,15 @@ void menu_main() {
 | 
			
		||||
  //
 | 
			
		||||
  #if ENABLED(PSU_CONTROL)
 | 
			
		||||
    if (powersupply_on)
 | 
			
		||||
      GCODES_ITEM(MSG_SWITCH_PS_OFF, PSTR("M81"));
 | 
			
		||||
      #if ENABLED(PS_OFF_CONFIRM)
 | 
			
		||||
        CONFIRM_ITEM(MSG_SWITCH_PS_OFF,
 | 
			
		||||
          MSG_YES, MSG_NO,
 | 
			
		||||
          ui.poweroff, ui.goto_previous_screen,
 | 
			
		||||
          GET_TEXT(MSG_SWITCH_PS_OFF), (const char *)nullptr, PSTR("?")
 | 
			
		||||
        );
 | 
			
		||||
      #else
 | 
			
		||||
        GCODES_ITEM(MSG_SWITCH_PS_OFF, PSTR("M81"));
 | 
			
		||||
      #endif
 | 
			
		||||
    else
 | 
			
		||||
      GCODES_ITEM(MSG_SWITCH_PS_ON, PSTR("M80"));
 | 
			
		||||
  #endif
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user