diff options
-rw-r--r-- | firmware/export/config.h | 4 | ||||
-rw-r--r-- | uisimulator/common/backlight-sim.c | 9 | ||||
-rw-r--r-- | uisimulator/sdl/lcd-bitmap.c | 6 |
3 files changed, 10 insertions, 9 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h index 3b50775faa..367c392a7c 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -558,8 +558,8 @@ Lyre prototype 1 */ | |||
558 | #define CONFIG_TUNER_MULTI | 558 | #define CONFIG_TUNER_MULTI |
559 | #endif | 559 | #endif |
560 | 560 | ||
561 | /* deactivate fading in bootloader/sim */ | 561 | /* deactivate fading in bootloader */ |
562 | #if defined(BOOTLOADER) || defined(SIMULATOR) | 562 | #if defined(BOOTLOADER) |
563 | #undef CONFIG_BACKLIGHT_FADING | 563 | #undef CONFIG_BACKLIGHT_FADING |
564 | #define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING | 564 | #define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING |
565 | #endif | 565 | #endif |
diff --git a/uisimulator/common/backlight-sim.c b/uisimulator/common/backlight-sim.c index e8bce8ff7a..74a715a035 100644 --- a/uisimulator/common/backlight-sim.c +++ b/uisimulator/common/backlight-sim.c | |||
@@ -30,6 +30,8 @@ extern void lcd_awake(void); | |||
30 | /* in uisimulator/sdl/lcd-bitmap.c and lcd-charcell.c */ | 30 | /* in uisimulator/sdl/lcd-bitmap.c and lcd-charcell.c */ |
31 | extern void sim_backlight(int value); | 31 | extern void sim_backlight(int value); |
32 | 32 | ||
33 | static int old_val = 100; | ||
34 | |||
33 | bool _backlight_init(void) | 35 | bool _backlight_init(void) |
34 | { | 36 | { |
35 | return true; | 37 | return true; |
@@ -37,7 +39,7 @@ bool _backlight_init(void) | |||
37 | 39 | ||
38 | void _backlight_on(void) | 40 | void _backlight_on(void) |
39 | { | 41 | { |
40 | sim_backlight(100); | 42 | sim_backlight(old_val); |
41 | #if defined(HAVE_LCD_ENABLE) | 43 | #if defined(HAVE_LCD_ENABLE) |
42 | lcd_enable(true); | 44 | lcd_enable(true); |
43 | #elif defined(HAVE_LCD_SLEEP) | 45 | #elif defined(HAVE_LCD_SLEEP) |
@@ -56,7 +58,10 @@ void _backlight_off(void) | |||
56 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 58 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
57 | void _backlight_set_brightness(int val) | 59 | void _backlight_set_brightness(int val) |
58 | { | 60 | { |
59 | (void)val; | 61 | int normalized = ((val - MIN_BRIGHTNESS_SETTING + 1) * 100) / MAX_BRIGHTNESS_SETTING; |
62 | sim_backlight(normalized); | ||
63 | |||
64 | old_val = normalized; | ||
60 | } | 65 | } |
61 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | 66 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ |
62 | #ifdef HAVE_BUTTON_LIGHT | 67 | #ifdef HAVE_BUTTON_LIGHT |
diff --git a/uisimulator/sdl/lcd-bitmap.c b/uisimulator/sdl/lcd-bitmap.c index 3c73b6fc5d..0bd90196e4 100644 --- a/uisimulator/sdl/lcd-bitmap.c +++ b/uisimulator/sdl/lcd-bitmap.c | |||
@@ -149,11 +149,7 @@ void sim_backlight(int value) | |||
149 | #endif | 149 | #endif |
150 | } | 150 | } |
151 | #else /* LCD_DEPTH > 8 */ | 151 | #else /* LCD_DEPTH > 8 */ |
152 | if (value > 0) { | 152 | SDL_SetAlpha(lcd_surface, SDL_SRCALPHA, (value * 255) / 100); |
153 | SDL_SetAlpha(lcd_surface, 0, SDL_ALPHA_OPAQUE); /* full on */ | ||
154 | } else { | ||
155 | SDL_SetAlpha(lcd_surface, SDL_SRCALPHA, BACKLIGHT_OFF_ALPHA); | ||
156 | } | ||
157 | #endif /* LCD_DEPTH */ | 153 | #endif /* LCD_DEPTH */ |
158 | 154 | ||
159 | sdl_gui_update(lcd_surface, 0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT, | 155 | sdl_gui_update(lcd_surface, 0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT, |