diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/backlight.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c index 588867f1a5..05bf007210 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c | |||
@@ -205,7 +205,7 @@ static int lcd_sleep_timeout = 10*HZ; | |||
205 | static const int lcd_sleep_timeout = LCD_SLEEP_TIMEOUT; | 205 | static const int lcd_sleep_timeout = LCD_SLEEP_TIMEOUT; |
206 | #endif | 206 | #endif |
207 | 207 | ||
208 | static int lcd_sleep_timer = 0; | 208 | static int lcd_sleep_timer SHAREDDATA_ATTR = 0; |
209 | 209 | ||
210 | void backlight_lcd_sleep_countdown(bool start) | 210 | void backlight_lcd_sleep_countdown(bool start) |
211 | { | 211 | { |
@@ -220,7 +220,12 @@ void backlight_lcd_sleep_countdown(bool start) | |||
220 | if (lcd_sleep_timeout < 0) | 220 | if (lcd_sleep_timeout < 0) |
221 | { | 221 | { |
222 | lcd_sleep_timer = 0; /* Setting == Always */ | 222 | lcd_sleep_timer = 0; /* Setting == Always */ |
223 | #if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM) | ||
224 | /* Ensure lcd_sleep() is called from backlight_thread() */ | ||
225 | queue_post(&backlight_queue, LCD_SLEEP, 0); | ||
226 | #else | ||
223 | lcd_sleep(); | 227 | lcd_sleep(); |
228 | #endif | ||
224 | } | 229 | } |
225 | else | 230 | else |
226 | { | 231 | { |
@@ -304,6 +309,11 @@ static void backlight_isr(void) | |||
304 | #endif | 309 | #endif |
305 | timer_unregister(); | 310 | timer_unregister(); |
306 | bl_timer_active = false; | 311 | bl_timer_active = false; |
312 | |||
313 | #ifdef HAVE_LCD_SLEEP | ||
314 | if (bl_dim_current == 0) | ||
315 | backlight_lcd_sleep_countdown(true); | ||
316 | #endif | ||
307 | } | 317 | } |
308 | else | 318 | else |
309 | timer_set_period(timer_period); | 319 | timer_set_period(timer_period); |
@@ -320,6 +330,10 @@ static void backlight_switch(void) | |||
320 | { | 330 | { |
321 | _backlight_off_normal(); | 331 | _backlight_off_normal(); |
322 | bl_dim_fraction = 0; | 332 | bl_dim_fraction = 0; |
333 | |||
334 | #ifdef HAVE_LCD_SLEEP | ||
335 | backlight_lcd_sleep_countdown(true); | ||
336 | #endif | ||
323 | } | 337 | } |
324 | } | 338 | } |
325 | 339 | ||
@@ -388,11 +402,11 @@ static void _backlight_off(void) | |||
388 | { | 402 | { |
389 | bl_dim_target = bl_dim_fraction = 0; | 403 | bl_dim_target = bl_dim_fraction = 0; |
390 | _backlight_off_normal(); | 404 | _backlight_off_normal(); |
391 | } | ||
392 | 405 | ||
393 | #ifdef HAVE_LCD_SLEEP | 406 | #ifdef HAVE_LCD_SLEEP |
394 | backlight_lcd_sleep_countdown(true); | 407 | backlight_lcd_sleep_countdown(true); |
395 | #endif | 408 | #endif |
409 | } | ||
396 | } | 410 | } |
397 | 411 | ||
398 | void backlight_set_fade_in(int value) | 412 | void backlight_set_fade_in(int value) |