Apply LEDColor, language fixes
This commit is contained in:
@ -360,60 +360,65 @@
|
||||
#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_ON
|
||||
#define MSG_LEDS_ON _UxGT("Lights On")
|
||||
#endif
|
||||
#ifndef MSG_LEDS_OFF
|
||||
#define MSG_LEDS_OFF _UxGT("Turn Off Lights")
|
||||
#define MSG_LEDS_OFF _UxGT("Lights Off")
|
||||
#endif
|
||||
#ifndef MSG_LED_ON
|
||||
#define MSG_LED_ON _UxGT("Turn on ")
|
||||
#ifndef MSG_LED_PRESETS
|
||||
#define MSG_LED_PRESETS _UxGT("Light Presets")
|
||||
#endif
|
||||
#ifndef MSG_RED
|
||||
#define MSG_RED _UxGT("Red ")
|
||||
#ifndef MSG_SET_LEDS_RED
|
||||
#define MSG_SET_LEDS_RED _UxGT("Red")
|
||||
#endif
|
||||
#ifndef MSG_ORANGE
|
||||
#define MSG_ORANGE _UxGT("Orange ")
|
||||
#ifndef MSG_SET_LEDS_ORANGE
|
||||
#define MSG_SET_LEDS_ORANGE _UxGT("Orange")
|
||||
#endif
|
||||
#ifndef MSG_YELLOW
|
||||
#define MSG_YELLOW _UxGT("Yellow ")
|
||||
#ifndef MSG_SET_LEDS_YELLOW
|
||||
#define MSG_SET_LEDS_YELLOW _UxGT("Yellow")
|
||||
#endif
|
||||
#ifndef MSG_GREEN
|
||||
#define MSG_GREEN _UxGT("Green ")
|
||||
#ifndef MSG_SET_LEDS_GREEN
|
||||
#define MSG_SET_LEDS_GREEN _UxGT("Green")
|
||||
#endif
|
||||
#ifndef MSG_BLUE
|
||||
#define MSG_BLUE _UxGT("Blue ")
|
||||
#ifndef MSG_SET_LEDS_BLUE
|
||||
#define MSG_SET_LEDS_BLUE _UxGT("Blue")
|
||||
#endif
|
||||
#ifndef MSG_PURPLE
|
||||
#define MSG_PURPLE _UxGT("Purple ")
|
||||
#ifndef MSG_SET_LEDS_INDIGO
|
||||
#define MSG_SET_LEDS_INDIGO _UxGT("Indigo")
|
||||
#endif
|
||||
#ifndef MSG_WHITE
|
||||
#define MSG_WHITE _UxGT("White ")
|
||||
#ifndef MSG_SET_LEDS_VIOLET
|
||||
#define MSG_SET_LEDS_VIOLET _UxGT("Violet")
|
||||
#endif
|
||||
#ifndef MSG_CUSTOM
|
||||
#define MSG_CUSTOM _UxGT("Custom ")
|
||||
#ifndef MSG_SET_LEDS_WHITE
|
||||
#define MSG_SET_LEDS_WHITE _UxGT("White")
|
||||
#endif
|
||||
#ifndef MSG_LED_PRESET
|
||||
#define MSG_LED_PRESET _UxGT("Preset ")
|
||||
#ifndef MSG_SET_LEDS_DEFAULT
|
||||
#define MSG_SET_LEDS_DEFAULT _UxGT("Default")
|
||||
#endif
|
||||
#ifndef MSG_LED_DEFAULT
|
||||
#define MSG_LED_DEFAULT _UxGT("Default ")
|
||||
#ifndef MSG_CUSTOM_LEDS
|
||||
#define MSG_CUSTOM_LEDS _UxGT("Custom Lights")
|
||||
#endif
|
||||
#ifndef MSG_LIGHTS
|
||||
#define MSG_LIGHTS _UxGT("Lights ")
|
||||
#ifndef MSG_INTENSITY_R
|
||||
#define MSG_INTENSITY_R _UxGT("Red Intensity")
|
||||
#endif
|
||||
#ifndef MSG_LED_INTENSITY
|
||||
#define MSG_LED_INTENSITY _UxGT("Intensity ")
|
||||
#ifndef MSG_INTENSITY_G
|
||||
#define MSG_INTENSITY_G _UxGT("Green Intensity")
|
||||
#endif
|
||||
#ifndef MSG_LED_CUSTOM
|
||||
#define MSG_LED_CUSTOM _UxGT("Custom LED")
|
||||
#ifndef MSG_INTENSITY_B
|
||||
#define MSG_INTENSITY_B _UxGT("Blue Intensity")
|
||||
#endif
|
||||
#ifndef MSG_LED_SAVE
|
||||
#define MSG_LED_SAVE _UxGT("Save ")
|
||||
#ifndef MSG_INTENSITY_W
|
||||
#define MSG_INTENSITY_W _UxGT("White Intensity")
|
||||
#endif
|
||||
#ifndef MSG_LED_LOAD
|
||||
#define MSG_LED_LOAD _UxGT("Load ")
|
||||
#ifndef MSG_LED_BRIGHTNESS
|
||||
#define MSG_LED_BRIGHTNESS _UxGT("Brightness")
|
||||
#endif
|
||||
|
||||
#ifndef MSG_MOVING
|
||||
#define MSG_MOVING _UxGT("Moving...")
|
||||
#endif
|
||||
|
@ -191,7 +191,6 @@ uint16_t max_display_update_time = 0;
|
||||
|
||||
#if ENABLED(LED_CONTROL_MENU)
|
||||
void lcd_led_menu();
|
||||
void lcd_led_custom_menu();
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
@ -1024,8 +1023,9 @@ void kill_screen(const char* lcd_msg) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(LED_CONTROL_MENU)
|
||||
MENU_ITEM(submenu, "LED Control", lcd_led_menu);
|
||||
MENU_ITEM(submenu, MSG_LED_CONTROL, lcd_led_menu);
|
||||
#endif
|
||||
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
@ -3951,105 +3951,37 @@ void kill_screen(const char* lcd_msg) {
|
||||
|
||||
#if ENABLED(LED_CONTROL_MENU)
|
||||
|
||||
bool led_restore_color =
|
||||
#if ENABLED(LED_USER_PRESET_STARTUP)
|
||||
false;
|
||||
#else
|
||||
true;
|
||||
#endif
|
||||
#if ENABLED(LED_COLOR_PRESETS)
|
||||
|
||||
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
|
||||
void lcd_led_presets_menu() {
|
||||
START_MENU();
|
||||
#if LCD_HEIGHT > 2
|
||||
STATIC_ITEM(MSG_LED_PRESETS, true, true);
|
||||
#endif
|
||||
led_restore_color = false;
|
||||
MENU_BACK(MSG_LED_CONTROL);
|
||||
MENU_ITEM(function, MSG_SET_LEDS_WHITE, leds.set_white);
|
||||
MENU_ITEM(function, MSG_SET_LEDS_RED, leds.set_red);
|
||||
MENU_ITEM(function, MSG_SET_LEDS_ORANGE, leds.set_orange);
|
||||
MENU_ITEM(function, MSG_SET_LEDS_YELLOW,leds.set_yellow);
|
||||
MENU_ITEM(function, MSG_SET_LEDS_GREEN, leds.set_green);
|
||||
MENU_ITEM(function, MSG_SET_LEDS_BLUE, leds.set_blue);
|
||||
MENU_ITEM(function, MSG_SET_LEDS_INDIGO, leds.set_indigo);
|
||||
MENU_ITEM(function, MSG_SET_LEDS_VIOLET, leds.set_violet);
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
#endif // LED_COLOR_PRESETS
|
||||
|
||||
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);
|
||||
MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true);
|
||||
MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true);
|
||||
MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, 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);
|
||||
MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true);
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
MENU_ITEM_EDIT_CALLBACK(int8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true);
|
||||
#endif
|
||||
#endif
|
||||
END_MENU();
|
||||
}
|
||||
@ -4057,13 +3989,15 @@ void kill_screen(const char* lcd_msg) {
|
||||
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_LIGHTS, led_restore_default); // works
|
||||
if (leds.lights_on)
|
||||
MENU_ITEM(function, MSG_LEDS_OFF, leds.toggle);
|
||||
else
|
||||
MENU_ITEM(function, MSG_LEDS_ON, leds.toggle);
|
||||
MENU_ITEM(function, MSG_SET_LEDS_DEFAULT, leds.set_default);
|
||||
#if ENABLED(LED_COLOR_PRESETS)
|
||||
MENU_ITEM(submenu, MSG_LED_PRESET MSG_LIGHTS, lcd_led_presets_menu);
|
||||
MENU_ITEM(submenu, MSG_LED_PRESETS, lcd_led_presets_menu);
|
||||
#endif
|
||||
MENU_ITEM(submenu, MSG_CUSTOM MSG_LIGHTS, lcd_led_custom_menu);
|
||||
MENU_ITEM(submenu, MSG_CUSTOM_LEDS, lcd_led_custom_menu);
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user