♻️ Consolidate PSU_CONTROL (#22304)
This commit is contained in:
		
				
					committed by
					
						
						Scott Lahteine
					
				
			
			
				
	
			
			
			
						parent
						
							9741be5966
						
					
				
				
					commit
					9ddb4de70a
				
			@@ -170,6 +170,10 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
    #include "../feature/power_monitor.h"
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(PSU_CONTROL) && defined(LED_BACKLIGHT_TIMEOUT)
 | 
			
		||||
    #include "../feature/power.h"
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #if HAS_ENCODER_ACTION
 | 
			
		||||
    volatile uint8_t MarlinUI::buttons;
 | 
			
		||||
    #if HAS_SLOW_BUTTONS
 | 
			
		||||
@@ -838,8 +842,8 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
    static uint16_t max_display_update_time = 0;
 | 
			
		||||
    millis_t ms = millis();
 | 
			
		||||
 | 
			
		||||
    #ifdef LED_BACKLIGHT_TIMEOUT
 | 
			
		||||
      leds.update_timeout(powersupply_on);
 | 
			
		||||
    #if ENABLED(PSU_CONTROL) && defined(LED_BACKLIGHT_TIMEOUT)
 | 
			
		||||
      leds.update_timeout(powerManager.psu_on);
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    #if HAS_LCD_MENU
 | 
			
		||||
@@ -988,8 +992,8 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
 | 
			
		||||
          refresh(LCDVIEW_REDRAW_NOW);
 | 
			
		||||
 | 
			
		||||
          #ifdef LED_BACKLIGHT_TIMEOUT
 | 
			
		||||
            if (!powersupply_on) leds.reset_timeout(ms);
 | 
			
		||||
          #if ENABLED(PSU_CONTROL) && defined(LED_BACKLIGHT_TIMEOUT)
 | 
			
		||||
            if (!powerManager.psu_on) leds.reset_timeout(ms);
 | 
			
		||||
          #endif
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,10 @@
 | 
			
		||||
 | 
			
		||||
#include "menu_item.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(PSU_CONTROL)
 | 
			
		||||
  #include "../../feature/power.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if ENABLED(LED_CONTROL_MENU)
 | 
			
		||||
  #include "../../feature/leds/leds.h"
 | 
			
		||||
 | 
			
		||||
@@ -125,12 +129,7 @@ void menu_led() {
 | 
			
		||||
  BACK_ITEM(MSG_MAIN);
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(LED_CONTROL_MENU)
 | 
			
		||||
    #if ENABLED(PSU_CONTROL)
 | 
			
		||||
      extern bool powersupply_on;
 | 
			
		||||
    #else
 | 
			
		||||
      constexpr bool powersupply_on = true;
 | 
			
		||||
    #endif
 | 
			
		||||
    if (powersupply_on) {
 | 
			
		||||
    if (TERN1(PSU_CONTROL, powerManager.psu_on)) {
 | 
			
		||||
      editable.state = leds.lights_on;
 | 
			
		||||
      EDIT_ITEM(bool, MSG_LEDS, &editable.state, leds.toggle);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,10 @@
 | 
			
		||||
#include "../../module/stepper.h"
 | 
			
		||||
#include "../../sd/cardreader.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLED(PSU_CONTROL)
 | 
			
		||||
  #include "../../feature/power.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if HAS_GAMES && DISABLED(LCD_INFO_MENU)
 | 
			
		||||
  #include "game/game.h"
 | 
			
		||||
#endif
 | 
			
		||||
@@ -385,7 +389,7 @@ void menu_main() {
 | 
			
		||||
  // Switch power on/off
 | 
			
		||||
  //
 | 
			
		||||
  #if ENABLED(PSU_CONTROL)
 | 
			
		||||
    if (powersupply_on)
 | 
			
		||||
    if (powerManager.psu_on)
 | 
			
		||||
      #if ENABLED(PS_OFF_CONFIRM)
 | 
			
		||||
        CONFIRM_ITEM(MSG_SWITCH_PS_OFF,
 | 
			
		||||
          MSG_YES, MSG_NO,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user