Index: firmware/backlight.c =================================================================== --- firmware/backlight.c (revision 20087) +++ firmware/backlight.c (working copy) @@ -205,7 +205,7 @@ static const int lcd_sleep_timeout = LCD_SLEEP_TIMEOUT; #endif -static int lcd_sleep_timer = 0; +static int lcd_sleep_timer SHAREDDATA_ATTR = 0; void backlight_lcd_sleep_countdown(bool start) { @@ -219,8 +219,14 @@ /* Start LCD sleep countdown */ if (lcd_sleep_timeout < 0) { - lcd_sleep_timer = 0; /* Setting == Always */ + /* Setting == Always */ +#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM) + /* Don't call lcd_sleep() from backlight_isr() */ + queue_post(&backlight_queue, LCD_SLEEP, 0); +#else + lcd_sleep_timer = 0; lcd_sleep(); +#endif } else { @@ -304,6 +310,11 @@ #endif timer_unregister(); bl_timer_active = false; + +#ifdef HAVE_LCD_SLEEP + if (bl_dim_current == 0) + backlight_lcd_sleep_countdown(true); +#endif } else timer_set_period(timer_period); @@ -320,6 +331,10 @@ { _backlight_off_normal(); bl_dim_fraction = 0; + +#ifdef HAVE_LCD_SLEEP + backlight_lcd_sleep_countdown(true); +#endif } } @@ -388,11 +403,11 @@ { bl_dim_target = bl_dim_fraction = 0; _backlight_off_normal(); - } #ifdef HAVE_LCD_SLEEP - backlight_lcd_sleep_countdown(true); + backlight_lcd_sleep_countdown(true); #endif + } } void backlight_set_fade_in(int value)