♻️ Consolidate PSU_CONTROL (#22304)

This commit is contained in:
Katelyn Schiesser
2021-07-11 22:13:58 -07:00
committed by Scott Lahteine
parent 9741be5966
commit 9ddb4de70a
10 changed files with 215 additions and 176 deletions

View File

@ -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);
}

View File

@ -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,