Fix reversal of "always/never" in "LCD setting > Sleep (After Backlight Off)"

The bug was introduced in a06d9c8.
The patch also fixes some (more or less) related obsolete comments.

Change-Id: I5e491d64574c37cdbc46b146d7cfc555d86b9a11
This commit is contained in:
Sebastian Leonhardt 2019-06-25 22:32:39 +02:00
parent 7b118eccac
commit 3e504c3dcd
2 changed files with 14 additions and 11 deletions

View File

@ -668,9 +668,8 @@ struct user_settings
#endif
unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */
#endif /* HAVE_LCD_BITMAP */
int backlight_timeout; /* backlight off timeout: 0-18 0=never,
1=always,
then according to timeout_values[] */
int backlight_timeout; /* backlight off timeout: -1=never,
0=always, or time in seconds */
bool caption_backlight; /* turn on backlight at end and start of track */
bool bl_filter_first_keypress; /* filter first keypress when dark? */
#if CONFIG_CHARGING
@ -689,7 +688,8 @@ struct user_settings
#endif
#ifdef HAVE_LCD_SLEEP_SETTING
int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
has turned off */
has turned off: -1=never, 0=always,
or time in seconds */
#endif
#endif /* HAVE_BACKLIGHT */
@ -707,8 +707,8 @@ struct user_settings
#ifdef HAVE_REMOTE_LCD
/* remote lcd */
int remote_contrast; /* lcd contrast: 0-63 0=low 63=high */
int remote_backlight_timeout; /* backlight off timeout: 0-18 0=never,
1=always, then according to timeout_values[] */
int remote_backlight_timeout; /* backlight off timeout: -1=never,
0=always, or time in seconds */
int remote_backlight_timeout_plugged;
int remote_scroll_speed; /* long texts scrolling speed: 1-30 */
int remote_scroll_delay; /* delay (in 1/10s) before starting scroll */

View File

@ -209,15 +209,18 @@ static void backlight_lcd_sleep_countdown(bool start)
}
/* Start LCD sleep countdown */
if (lcd_sleep_timeout < 0)
if (lcd_sleep_timeout <= 0)
{
lcd_sleep_timer = 0; /* Setting == Always */
/* Ensure lcd_sleep() is called from backlight_thread() */
lcd_sleep_timer = 0;
if (lcd_sleep_timeout == 0) /* Setting == Always */
{
/* Ensure lcd_sleep() is called from backlight_thread() */
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
queue_post(&backlight_queue, LCD_SLEEP, 0);
queue_post(&backlight_queue, LCD_SLEEP, 0);
#else
lcd_sleep();
lcd_sleep();
#endif
}
}
else
{