mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-24 20:43:32 +00:00
🐛 Fix LCD contrast/brightness init (#23567)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
d5f2334140
commit
f6e8622360
@ -377,6 +377,7 @@
|
||||
#define _LCD_CONTRAST_MIN 255
|
||||
#define _LCD_CONTRAST_INIT 255
|
||||
#elif ENABLED(FYSETC_MINI_12864)
|
||||
#define _LCD_CONTRAST_MIN 180
|
||||
#define _LCD_CONTRAST_INIT 220
|
||||
#elif ENABLED(ULTI_CONTROLLER)
|
||||
#define _LCD_CONTRAST_INIT 127
|
||||
|
@ -96,8 +96,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_CONTRAST
|
||||
uint8_t MarlinUI::contrast; // Initialized by settings.load()
|
||||
|
||||
uint8_t MarlinUI::contrast = LCD_CONTRAST_DEFAULT; // Initialized by settings.load()
|
||||
void MarlinUI::set_contrast(const uint8_t value) {
|
||||
contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
|
||||
_set_contrast();
|
||||
|
@ -578,6 +578,9 @@ void MarlinSettings::postprocess() {
|
||||
update_software_endstops((AxisEnum)i);
|
||||
}
|
||||
|
||||
TERN_(HAS_LCD_CONTRAST, ui.refresh_contrast());
|
||||
TERN_(HAS_LCD_BRIGHTNESS, ui.refresh_brightness());
|
||||
|
||||
TERN_(ENABLE_LEVELING_FADE_HEIGHT, set_z_fade_height(new_z_fade_height, false)); // false = no report
|
||||
|
||||
TERN_(AUTO_BED_LEVELING_BILINEAR, refresh_bed_level());
|
||||
@ -1986,10 +1989,10 @@ void MarlinSettings::postprocess() {
|
||||
// LCD Contrast
|
||||
//
|
||||
{
|
||||
_FIELD_TEST(lcd_contrast);
|
||||
uint8_t lcd_contrast;
|
||||
_FIELD_TEST(lcd_contrast);
|
||||
EEPROM_READ(lcd_contrast);
|
||||
TERN_(HAS_LCD_CONTRAST, if (!validating) ui.set_contrast(lcd_contrast));
|
||||
TERN_(HAS_LCD_CONTRAST, if (!validating) ui.contrast = lcd_contrast);
|
||||
}
|
||||
|
||||
//
|
||||
@ -1997,8 +2000,9 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
{
|
||||
uint8_t lcd_brightness;
|
||||
_FIELD_TEST(lcd_brightness);
|
||||
EEPROM_READ(lcd_brightness);
|
||||
TERN_(HAS_LCD_BRIGHTNESS, if (!validating) ui.set_brightness(lcd_brightness));
|
||||
TERN_(HAS_LCD_BRIGHTNESS, if (!validating) ui.brightness = lcd_brightness);
|
||||
}
|
||||
|
||||
//
|
||||
@ -3018,12 +3022,12 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
// LCD Contrast
|
||||
//
|
||||
TERN_(HAS_LCD_CONTRAST, ui.set_contrast(DEFAULT_LCD_CONTRAST));
|
||||
TERN_(HAS_LCD_CONTRAST, ui.contrast = LCD_CONTRAST_DEFAULT);
|
||||
|
||||
//
|
||||
// LCD Brightness
|
||||
//
|
||||
TERN_(HAS_LCD_BRIGHTNESS, ui.set_brightness(DEFAULT_LCD_BRIGHTNESS));
|
||||
TERN_(HAS_LCD_BRIGHTNESS, ui.brightness = DEFAULT_LCD_BRIGHTNESS);
|
||||
|
||||
//
|
||||
// Controller Fan
|
||||
|
Loading…
Reference in New Issue
Block a user