From e25567a5dde80b8c9b69bc77e4a3019a266b19fe Mon Sep 17 00:00:00 2001 From: Tannoo Date: Sat, 18 Nov 2017 12:52:06 -0700 Subject: [PATCH] New feature: LED_CONTROL_MENU --- Marlin/Configuration_adv.h | 15 ++ Marlin/Marlin_main.cpp | 52 +++++++ .../AlephObjects/TAZ4/Configuration_adv.h | 15 ++ .../Anet/A6/Configuration_adv.h | 15 ++ .../Anet/A8/Configuration_adv.h | 15 ++ .../BQ/Hephestos/Configuration_adv.h | 15 ++ .../BQ/Hephestos_2/Configuration_adv.h | 15 ++ .../BQ/WITBOX/Configuration_adv.h | 15 ++ .../Cartesio/Configuration_adv.h | 15 ++ .../Creality/CR-10/Configuration_adv.h | 15 ++ .../Felix/Configuration_adv.h | 15 ++ .../FolgerTech/i3-2020/Configuration_adv.h | 15 ++ .../Infitary/i3-M508/Configuration_adv.h | 15 ++ .../Malyan/M150/Configuration_adv.h | 15 ++ .../Micromake/C1/enhanced/Configuration_adv.h | 15 ++ .../RigidBot/Configuration_adv.h | 15 ++ .../SCARA/Configuration_adv.h | 15 ++ .../Sanguinololu/Configuration_adv.h | 15 ++ .../TinyBoy2/Configuration_adv.h | 15 ++ .../Velleman/K8200/Configuration_adv.h | 15 ++ .../Velleman/K8400/Configuration_adv.h | 15 ++ .../FLSUN/auto_calibrate/Configuration_adv.h | 15 ++ .../FLSUN/kossel_mini/Configuration_adv.h | 15 ++ .../delta/generic/Configuration_adv.h | 15 ++ .../delta/kossel_mini/Configuration_adv.h | 15 ++ .../delta/kossel_pro/Configuration_adv.h | 15 ++ .../delta/kossel_xl/Configuration_adv.h | 15 ++ .../gCreate/gMax1.5+/Configuration_adv.h | 15 ++ .../makibox/Configuration_adv.h | 15 ++ .../tvrrug/Round2/Configuration_adv.h | 15 ++ .../wt150/Configuration_adv.h | 15 ++ Marlin/language_en.h | 58 ++++++- Marlin/ultralcd.cpp | 147 ++++++++++++++++++ 33 files changed, 706 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index a241265c38..bf30570c67 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 96ab284932..089917c14b 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -331,6 +331,32 @@ void gcode_G26(); #endif +#if ENABLED(LED_CONTROL_MENU) + #if ENABLED(LED_COLOR_PRESETS) + uint8_t led_intensity_red = LED_USER_PRESET_RED, + led_intensity_green = LED_USER_PRESET_GREEN, + led_intensity_blue = LED_USER_PRESET_BLUE + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + , led_intensity_white = LED_USER_PRESET_WHITE + #endif + #if ENABLED(NEOPIXEL_LED) + , led_intensity = NEOPIXEL_BRIGHTNESS + #endif + ; + #else + uint8_t led_intensity_red = 255, + led_intensity_green = 255, + led_intensity_blue = 255 + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + , led_intensity_white = 0 + #endif + #if ENABLED(NEOPIXEL_LED) + , led_intensity = NEOPIXEL_BRIGHTNESS + #endif + ; + #endif +#endif + #if ENABLED(SDSUPPORT) CardReader card; #endif @@ -1101,6 +1127,32 @@ void servo_init() { // Update I2C LED driver PCA9632_SetColor(r, g, b); #endif + + #if ENABLED(LED_CONTROL_MENU) + if ((r + g + b + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + + w + #endif + ) >= 3) { + led_intensity_red = r; + led_intensity_green = g; + led_intensity_blue = b; + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + led_intensity_white = w; + #endif + #if ENABLED(NEOPIXEL_LED) + led_intensity = p; + #endif + } + #endif + } + + void set_led_white() { + #if ENABLED(NEOPIXEL_LED) + set_neopixel_color(pixels.Color(NEO_WHITE)); + #else + set_led_color(LED_WHITE); + #endif } #endif // HAS_COLOR_LEDS diff --git a/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h index 8db7d3515e..8b59e94a64 100644 --- a/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Anet/A6/Configuration_adv.h b/Marlin/example_configurations/Anet/A6/Configuration_adv.h index fce1386dd5..52513b255c 100644 --- a/Marlin/example_configurations/Anet/A6/Configuration_adv.h +++ b/Marlin/example_configurations/Anet/A6/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Anet/A8/Configuration_adv.h b/Marlin/example_configurations/Anet/A8/Configuration_adv.h index 9e81dd2d6c..1c79c297b3 100644 --- a/Marlin/example_configurations/Anet/A8/Configuration_adv.h +++ b/Marlin/example_configurations/Anet/A8/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h b/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h index 8681aca122..f82173845b 100644 --- a/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h index 23beb7fa64..b4f24e3702 100644 --- a/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h b/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h index 8681aca122..f82173845b 100644 --- a/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 44bffa75f0..ac3f1fbe6d 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h b/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h index a64a46b68f..d4a6575717 100755 --- a/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h +++ b/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 3a8e8b6ef8..c8342c4f01 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h index 8828b9e577..194c13aa5d 100644 --- a/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/example_configurations/FolgerTech/i3-2020/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h b/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h index 12cd0dbf84..b5a7d952b0 100644 --- a/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Malyan/M150/Configuration_adv.h b/Marlin/example_configurations/Malyan/M150/Configuration_adv.h index 7d5b733893..627e2c9555 100644 --- a/Marlin/example_configurations/Malyan/M150/Configuration_adv.h +++ b/Marlin/example_configurations/Malyan/M150/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/example_configurations/Micromake/C1/enhanced/Configuration_adv.h index 7fbc77c8eb..db02de4561 100644 --- a/Marlin/example_configurations/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/example_configurations/Micromake/C1/enhanced/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index d1413213d9..e8f7bddae0 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 7c79955e2f..7f7deb689d 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Sanguinololu/Configuration_adv.h b/Marlin/example_configurations/Sanguinololu/Configuration_adv.h index 37df22e6c2..cf3aeab061 100644 --- a/Marlin/example_configurations/Sanguinololu/Configuration_adv.h +++ b/Marlin/example_configurations/Sanguinololu/Configuration_adv.h @@ -471,6 +471,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h index a0ae3dead0..16e97e41fb 100644 --- a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h +++ b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h b/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h index 10512609e8..e7e0969c9f 100644 --- a/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h @@ -495,6 +495,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h b/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h index 728c554fe2..0985886ae2 100644 --- a/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h index b3c9d71b36..4fd8ff5112 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -484,6 +484,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h index 3d1c072361..bf4155454e 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -484,6 +484,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 3d1c072361..bf4155454e 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -484,6 +484,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 3d1c072361..bf4155454e 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -484,6 +484,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index c8dc04f9b5..336feb6ad9 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -489,6 +489,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 172458902b..302d0b1d12 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -484,6 +484,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h index e7566d583f..978310b6eb 100644 --- a/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 3ad0babf81..238fbd6d9f 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 1acaef4e8b..17e1c8be42 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -482,6 +482,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/example_configurations/wt150/Configuration_adv.h b/Marlin/example_configurations/wt150/Configuration_adv.h index 891a85cf9f..0438f68013 100644 --- a/Marlin/example_configurations/wt150/Configuration_adv.h +++ b/Marlin/example_configurations/wt150/Configuration_adv.h @@ -472,6 +472,21 @@ // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 +//#define LED_CONTROL_MENU // Uncomment to enable the LED control menu option. +#if ENABLED(LED_CONTROL_MENU) + + #define LED_COLOR_PRESETS // Uncomment to enable the preset color menu option. + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_INTENSITY 255 // User defined intensity + + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work diff --git a/Marlin/language_en.h b/Marlin/language_en.h index 3b4027ba3f..d2d93dc59c 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -361,7 +361,63 @@ #ifndef MSG_UBL_STEP_BY_STEP_MENU #define MSG_UBL_STEP_BY_STEP_MENU _UxGT("Step-By-Step UBL") #endif - +#ifndef MSG_LED_CONTROL + #define MSG_LED_CONTROL _UxGT("LED Control") +#endif +#ifndef MSG_LEDS_OFF + #define MSG_LEDS_OFF _UxGT("Turn Off Lights") +#endif +#ifndef MSG_LED_ON + #define MSG_LED_ON _UxGT("Turn on ") +#endif +#ifndef MSG_RED + #define MSG_RED _UxGT("Red ") +#endif +#ifndef MSG_ORANGE + #define MSG_ORANGE _UxGT("Orange ") +#endif +#ifndef MSG_YELLOW + #define MSG_YELLOW _UxGT("Yellow ") +#endif +#ifndef MSG_GREEN + #define MSG_GREEN _UxGT("Green ") +#endif +#ifndef MSG_BLUE + #define MSG_BLUE _UxGT("Blue ") +#endif +#ifndef MSG_PURPLE + #define MSG_PURPLE _UxGT("Purple ") +#endif +#ifndef MSG_WHITE + #define MSG_WHITE _UxGT("White ") +#endif +#ifndef MSG_CUSTOM + #define MSG_CUSTOM _UxGT("Custom ") +#endif +#ifndef MSG_LED_PRESET + #define MSG_LED_PRESET _UxGT("Preset ") +#endif +#ifndef MSG_LED_DEFAULT + #define MSG_LED_DEFAULT _UxGT("Default ") +#endif +#ifndef MSG_LIGHTS + #define MSG_LIGHTS _UxGT("Lights ") +#endif +#ifndef MSG_COLOR + #define MSG_COLOR _UxGT("Color") +#endif +#ifndef MSG_LED_INTENSITY + #define MSG_LED_INTENSITY _UxGT("Intensity ") +#endif +#ifndef MSG_LED_CUSTOM + #define MSG_LED_CUSTOM _UxGT("Custom LED") +#endif +#ifndef MSG_LED_SAVE + #define MSG_LED_SAVE _UxGT("Save ") +#endif +#ifndef MSG_LED_LOAD + #define MSG_LED_LOAD _UxGT("Load ") +#endif #ifndef MSG_MOVING #define MSG_MOVING _UxGT("Moving...") #endif diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index bcf2f47d62..5c41dcdcc0 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -184,6 +184,23 @@ uint16_t max_display_update_time = 0; void lcd_info_menu(); #endif // LCD_INFO_MENU + #if ENABLED(LED_CONTROL_MENU) + extern void set_led_color( + const uint8_t r, const uint8_t g, const uint8_t b + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + , const uint8_t w = 0 + #if ENABLED(NEOPIXEL_LED) + , const uint8_t p = NEOPIXEL_BRIGHTNESS + , bool isSequence = false + #endif + #endif + ); + + extern void set_led_white(); + void lcd_led_menu(); + void lcd_led_custom_menu(); + #endif + #if ENABLED(ADVANCED_PAUSE_FEATURE) void lcd_advanced_pause_toocold_menu(); void lcd_advanced_pause_option_menu(); @@ -1013,6 +1030,10 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM(submenu, MSG_INFO_MENU, lcd_info_menu); #endif + #if ENABLED(LED_CONTROL_MENU) + MENU_ITEM(submenu, "LED Control", lcd_led_menu); + #endif + END_MENU(); } @@ -3942,6 +3963,132 @@ void kill_screen(const char* lcd_msg) { } #endif // LCD_INFO_MENU + /** + * + * LED Menu + * + */ + + #if ENABLED(LED_CONTROL_MENU) + + bool led_restore_color = + #if ENABLED(LED_USER_PRESET_STARTUP) + false; + #else + true; + #endif + + extern uint8_t led_intensity_red, + led_intensity_green, + led_intensity_blue + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + , led_intensity_white + #endif + #if ENABLED(NEOPIXEL_LED) + , led_intensity + #endif + ; + + void update_leds() { + if (led_restore_color) { + #if ENABLED(LED_COLOR_PRESETS) + led_intensity_red = LED_USER_PRESET_RED; + led_intensity_green = LED_USER_PRESET_GREEN; + led_intensity_blue = LED_USER_PRESET_BLUE; + #if ENABLED(RGBW_LED) + led_intensity_white = LED_USER_PRESET_WHITE; + #endif + #if ENABLED(NEOPIXEL_LED) + led_intensity = LED_USER_PRESET_INTENSITY; + #endif + #else + led_intensity_red = 255; + led_intensity_green = 255; + led_intensity_blue = 255; + #if ENABLED(RGBW_LED) + led_intensity_white = 0; + #endif + #if ENABLED(NEOPIXEL_LED) + led_intensity = LED_USER_PRESET_INTENSITY; + #endif + #endif + led_restore_color = false; + } + + set_led_color(led_intensity_red, led_intensity_green, led_intensity_blue + #if ENABLED(RGBW_LED) + , led_intensity_white + #endif + #if ENABLED(NEOPIXEL_LED) + , 0, led_intensity + #endif + ); + led_restore_color = false; + } + + void led_restore_default() { + led_restore_color = true; + update_leds(); + } + + void set_leds_off() { + set_led_color(0, 0, 0 + #if ENABLED(RGBW) || ENABLED(NEOPIXEL_LED) + , 0 + #endif + ); + } + + void lcd_led_red() { set_led_color(255, 0, 0); } + void lcd_led_orange() { set_led_color(150, 60, 0); } + void lcd_led_yellow() { set_led_color(255, 255, 0); } + void lcd_led_green() { set_led_color(0, 255, 0); } + void lcd_led_blue() { set_led_color(0, 0, 255); } + void lcd_led_purple() { set_led_color(255, 0, 255); } + + void lcd_led_presets_menu() { + START_MENU(); + MENU_BACK(MSG_LED_CONTROL); + MENU_ITEM(function, MSG_LED_ON MSG_RED MSG_LIGHTS, lcd_led_red); + MENU_ITEM(function, MSG_LED_ON MSG_ORANGE MSG_LIGHTS, lcd_led_orange); + MENU_ITEM(function, MSG_LED_ON MSG_YELLOW MSG_LIGHTS,lcd_led_yellow); + MENU_ITEM(function, MSG_LED_ON MSG_GREEN MSG_LIGHTS, lcd_led_green); + MENU_ITEM(function, MSG_LED_ON MSG_BLUE MSG_LIGHTS, lcd_led_blue); + MENU_ITEM(function, MSG_LED_ON MSG_PURPLE MSG_LIGHTS, lcd_led_purple); + MENU_ITEM(function, MSG_LED_ON MSG_WHITE MSG_LIGHTS, set_led_white); + END_MENU(); + } + + void lcd_led_custom_menu() { + START_MENU(); + MENU_BACK(MSG_LED_CONTROL); + MENU_ITEM_EDIT_CALLBACK(int8, MSG_RED MSG_LED_INTENSITY, &led_intensity_red, 0, 255, update_leds, true); + MENU_ITEM_EDIT_CALLBACK(int8, MSG_GREEN MSG_LED_INTENSITY, &led_intensity_green, 0, 255, update_leds, true); + MENU_ITEM_EDIT_CALLBACK(int8, MSG_BLUE MSG_LED_INTENSITY, &led_intensity_blue, 0, 255, update_leds, true); + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + MENU_ITEM_EDIT_CALLBACK(int8, MSG_WHITE MSG_LED_INTENSITY, &led_intensity_white, 0, 255, update_leds, true); + #endif + #if ENABLED(NEOPIXEL_LED) + MENU_ITEM_EDIT_CALLBACK(int8, MSG_LED_INTENSITY, &led_intensity, 0, 255, update_leds, true); + #endif + END_MENU(); + } + + void lcd_led_menu() { + START_MENU(); + MENU_BACK(MSG_MAIN); + MENU_ITEM(function, MSG_LIGHTS MSG_OFF, set_leds_off); // works + MENU_ITEM(function, MSG_LIGHTS MSG_ON, update_leds); // works + MENU_ITEM(function, MSG_LED_LOAD MSG_LED_DEFAULT MSG_COLOR, led_restore_default); // works + #if ENABLED(LED_COLOR_PRESETS) + MENU_ITEM(submenu, MSG_LED_PRESET MSG_LIGHTS, lcd_led_presets_menu); + #endif + MENU_ITEM(submenu, MSG_CUSTOM MSG_LIGHTS, lcd_led_custom_menu); + END_MENU(); + } + + #endif // LED_CONTROL_MENU + /** * * Filament Change Feature Screens