Skip to content

Commit

Permalink
🚸 Move solo Case Light menu up
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 21, 2024
1 parent deb076b commit 21a6044
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
39 changes: 20 additions & 19 deletions Marlin/src/lcd/menu/menu_led.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,24 @@
#if ENABLED(CASE_LIGHT_MENU)
#include "../../feature/caselight.h"

#define CASELIGHT_TOGGLE_ITEM() EDIT_ITEM(bool, MSG_CASE_LIGHT, (bool*)&caselight.on, caselight.update_enabled)

#if CASELIGHT_USES_BRIGHTNESS
void menu_case_light() {
START_MENU();
BACK_ITEM(MSG_CONFIGURATION);
EDIT_ITEM(percent, MSG_CASE_LIGHT_BRIGHTNESS, &caselight.brightness, 0, 255, caselight.update_brightness, true);
CASELIGHT_TOGGLE_ITEM();
EDIT_ITEM(bool, MSG_CASE_LIGHT, &caselight.on, caselight.update_enabled);
END_MENU();
}
#endif
#endif

void menu_led() {
START_MENU();
BACK_ITEM(MSG_MAIN_MENU);
#if ENABLED(LED_CONTROL_MENU)

void menu_led() {
START_MENU();
BACK_ITEM(MSG_MAIN_MENU);

#if ENABLED(LED_CONTROL_MENU)
if (TERN1(PSU_CONTROL, powerManager.psu_on)) {
editable.state = leds.lights_on;
EDIT_ITEM(bool, MSG_LEDS, &editable.state, leds.toggle);
Expand All @@ -152,21 +152,22 @@ void menu_led() {
SUBMENU(MSG_NEO2_PRESETS, menu_leds2_presets);
#endif
SUBMENU(MSG_CUSTOM_LEDS, menu_led_custom);
#endif

//
// Set Case light on/off/brightness
//
#if ENABLED(CASE_LIGHT_MENU)
#if CASELIGHT_USES_BRIGHTNESS
if (caselight.has_brightness())
SUBMENU(MSG_CASE_LIGHT, menu_case_light);
else
//
// Set Case light on/off/brightness
//
#if ENABLED(CASE_LIGHT_MENU)
#if CASELIGHT_USES_BRIGHTNESS
if (caselight.has_brightness())
SUBMENU(MSG_CASE_LIGHT, menu_case_light);
else
#endif
EDIT_ITEM(bool, MSG_CASE_LIGHT, &caselight.on, caselight.update_enabled);
#endif
CASELIGHT_TOGGLE_ITEM();
#endif

END_MENU();
}
END_MENU();
}

#endif // LED_CONTROL_MENU

#endif // HAS_MARLINUI_MENU && LED_CONTROL_MENU
12 changes: 10 additions & 2 deletions Marlin/src/lcd/menu/menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ void menu_configuration();
void menu_info();
#endif

#if ANY(LED_CONTROL_MENU, CASE_LIGHT_MENU)
#if ENABLED(LED_CONTROL_MENU)
void menu_led();
#elif ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS)
void menu_case_light();
#elif ENABLED(CASE_LIGHT_MENU)
#include "../../feature/caselight.h"
#endif

#if HAS_CUTTER
Expand Down Expand Up @@ -371,8 +375,12 @@ void menu_main() {
SUBMENU(MSG_INFO_MENU, menu_info);
#endif

#if ANY(LED_CONTROL_MENU, CASE_LIGHT_MENU)
#if ENABLED(LED_CONTROL_MENU)
SUBMENU(MSG_LEDS, menu_led);
#elif ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS)
SUBMENU(MSG_CASE_LIGHT, menu_case_light);
#elif ENABLED(CASE_LIGHT_MENU)
EDIT_ITEM(bool, MSG_CASE_LIGHT, &caselight.on, caselight.update_enabled);
#endif

//
Expand Down

0 comments on commit 21a6044

Please sign in to comment.