mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 13:45:03 -05:00
Ability to control backlight for soft lock action
See Settings -> General Settings -> Display -> LCD Settings -> Backlight on Lock Change-Id: I201cb1c2907bb6842bf5d0b7a657e9db27aa905a
This commit is contained in:
parent
6b0e3fe775
commit
7bbaf74c5c
7 changed files with 20 additions and 23 deletions
|
|
@ -2347,15 +2347,15 @@
|
||||||
desc: in lcd settings
|
desc: in lcd settings
|
||||||
user: core
|
user: core
|
||||||
<source>
|
<source>
|
||||||
*: none
|
*: "Backlight on Lock"
|
||||||
hold_button: "Backlight on Hold"
|
hold_button: "Backlight on Hold"
|
||||||
</source>
|
</source>
|
||||||
<dest>
|
<dest>
|
||||||
*: none
|
*: "Backlight on Lock"
|
||||||
hold_button: "Backlight on Hold"
|
hold_button: "Backlight on Hold"
|
||||||
</dest>
|
</dest>
|
||||||
<voice>
|
<voice>
|
||||||
*: none
|
*: "Backlight on Lock"
|
||||||
hold_button: "Backlight on hold"
|
hold_button: "Backlight on hold"
|
||||||
</voice>
|
</voice>
|
||||||
</phrase>
|
</phrase>
|
||||||
|
|
|
||||||
|
|
@ -149,10 +149,10 @@ MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL);
|
||||||
MENUITEM_SETTING(backlight_timeout_plugged,
|
MENUITEM_SETTING(backlight_timeout_plugged,
|
||||||
&global_settings.backlight_timeout_plugged, NULL);
|
&global_settings.backlight_timeout_plugged, NULL);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_BUTTON_HOLD
|
|
||||||
MENUITEM_SETTING(backlight_on_button_hold,
|
MENUITEM_SETTING(backlight_on_button_hold,
|
||||||
&global_settings.backlight_on_button_hold, NULL);
|
&global_settings.backlight_on_button_hold, NULL);
|
||||||
#endif
|
|
||||||
MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL);
|
MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL);
|
||||||
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
|
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
|
||||||
|| defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
|
|| defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
|
||||||
|
|
@ -200,9 +200,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
|
||||||
# if CONFIG_CHARGING
|
# if CONFIG_CHARGING
|
||||||
,&backlight_timeout_plugged
|
,&backlight_timeout_plugged
|
||||||
# endif
|
# endif
|
||||||
# ifdef HAS_BUTTON_HOLD
|
|
||||||
,&backlight_on_button_hold
|
,&backlight_on_button_hold
|
||||||
# endif
|
|
||||||
,&caption_backlight
|
,&caption_backlight
|
||||||
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
|
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
|
||||||
|| defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
|
|| defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
|
||||||
|
|
|
||||||
|
|
@ -1051,9 +1051,7 @@ void settings_apply(bool read_disk)
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
|
set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_BUTTON_HOLD
|
|
||||||
backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
|
backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_SLEEP_SETTING
|
#ifdef HAVE_LCD_SLEEP_SETTING
|
||||||
lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
|
lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
|
||||||
|
|
|
||||||
|
|
@ -691,10 +691,8 @@ struct user_settings
|
||||||
#ifdef HAVE_BACKLIGHT
|
#ifdef HAVE_BACKLIGHT
|
||||||
bool bl_selective_actions; /* backlight disable on some actions */
|
bool bl_selective_actions; /* backlight disable on some actions */
|
||||||
int bl_selective_actions_mask;/* mask of actions that will not enable backlight */
|
int bl_selective_actions_mask;/* mask of actions that will not enable backlight */
|
||||||
#ifdef HAS_BUTTON_HOLD
|
|
||||||
int backlight_on_button_hold; /* what to do with backlight when hold
|
int backlight_on_button_hold; /* what to do with backlight when hold
|
||||||
switch is on */
|
switch is on */
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_SLEEP_SETTING
|
#ifdef HAVE_LCD_SLEEP_SETTING
|
||||||
int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
|
int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
|
||||||
has turned off: -1=never, 0=always,
|
has turned off: -1=never, 0=always,
|
||||||
|
|
|
||||||
|
|
@ -1846,12 +1846,16 @@ const struct settings_list settings[] = {
|
||||||
ID2P(LANG_IN_SUBMENU)),
|
ID2P(LANG_IN_SUBMENU)),
|
||||||
|
|
||||||
#ifdef HAVE_BACKLIGHT
|
#ifdef HAVE_BACKLIGHT
|
||||||
#ifdef HAS_BUTTON_HOLD
|
CHOICE_SETTING(0, backlight_on_button_hold,
|
||||||
CHOICE_SETTING(0, backlight_on_button_hold, LANG_BACKLIGHT_ON_BUTTON_HOLD,
|
LANG_BACKLIGHT_ON_BUTTON_HOLD,
|
||||||
1, "backlight on button hold", "normal,off,on",
|
#ifdef HAS_HOLD_BUTTON
|
||||||
|
1,
|
||||||
|
#else
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
"backlight on button hold", "normal,off,on",
|
||||||
backlight_set_on_button_hold, 3,
|
backlight_set_on_button_hold, 3,
|
||||||
ID2P(LANG_NORMAL), ID2P(LANG_OFF), ID2P(LANG_ON)),
|
ID2P(LANG_NORMAL), ID2P(LANG_OFF), ID2P(LANG_ON)),
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_SLEEP_SETTING
|
#ifdef HAVE_LCD_SLEEP_SETTING
|
||||||
TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS,
|
TABLE_SETTING_LIST(F_TIME_SETTING | F_ALLOW_ARBITRARY_VALS,
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "screendump.h"
|
#include "screendump.h"
|
||||||
|
#include "action.h"
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
#include "lcd-remote.h"
|
#include "lcd-remote.h"
|
||||||
|
|
@ -120,9 +121,7 @@ static int backlight_timeout_normal = 5*HZ;
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
static int backlight_timeout_plugged = 5*HZ;
|
static int backlight_timeout_plugged = 5*HZ;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_BUTTON_HOLD
|
|
||||||
static int backlight_on_button_hold = 0;
|
static int backlight_on_button_hold = 0;
|
||||||
#endif
|
|
||||||
static void backlight_handle_timeout(void);
|
static void backlight_handle_timeout(void);
|
||||||
|
|
||||||
#ifdef HAVE_BUTTON_LIGHT
|
#ifdef HAVE_BUTTON_LIGHT
|
||||||
|
|
@ -846,18 +845,18 @@ bool is_backlight_on(bool ignore_always_off)
|
||||||
/* return value in ticks; 0 means always on, <0 means always off */
|
/* return value in ticks; 0 means always on, <0 means always off */
|
||||||
int backlight_get_current_timeout(void)
|
int backlight_get_current_timeout(void)
|
||||||
{
|
{
|
||||||
#ifdef HAS_BUTTON_HOLD
|
|
||||||
if ((backlight_on_button_hold != 0)
|
if ((backlight_on_button_hold != 0)
|
||||||
#ifdef HAVE_REMOTE_LCD_AS_MAIN
|
#if defined(HAVE_REMOTE_LCD_AS_MAIN) && defined(HAS_REMOTE_BUTTON_HOLD)
|
||||||
&& remote_button_hold()
|
&& remote_button_hold()
|
||||||
#else
|
#elifdef HAS_BUTTON_HOLD
|
||||||
&& button_hold()
|
&& button_hold()
|
||||||
|
#else
|
||||||
|
&& is_keys_locked()
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
return (backlight_on_button_hold == 2) ? 0 : -1;
|
return (backlight_on_button_hold == 2) ? 0 : -1;
|
||||||
/* always on or always off */
|
/* always on or always off */
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
if (power_input_present())
|
if (power_input_present())
|
||||||
return backlight_timeout_plugged;
|
return backlight_timeout_plugged;
|
||||||
|
|
@ -893,6 +892,7 @@ void backlight_hold_changed(bool hold_button)
|
||||||
queue_post(&backlight_queue, BACKLIGHT_ON, 0);
|
queue_post(&backlight_queue, BACKLIGHT_ON, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* HAS_BUTTON_HOLD */
|
||||||
|
|
||||||
void backlight_set_on_button_hold(int index)
|
void backlight_set_on_button_hold(int index)
|
||||||
{
|
{
|
||||||
|
|
@ -903,7 +903,6 @@ void backlight_set_on_button_hold(int index)
|
||||||
backlight_on_button_hold = index;
|
backlight_on_button_hold = index;
|
||||||
queue_post(&backlight_queue, BACKLIGHT_TMO_CHANGED, 0);
|
queue_post(&backlight_queue, BACKLIGHT_TMO_CHANGED, 0);
|
||||||
}
|
}
|
||||||
#endif /* HAS_BUTTON_HOLD */
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_SLEEP_SETTING
|
#ifdef HAVE_LCD_SLEEP_SETTING
|
||||||
void lcd_set_sleep_after_backlight_off(int timeout_seconds)
|
void lcd_set_sleep_after_backlight_off(int timeout_seconds)
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,8 @@ void backlight_set_timeout_plugged(int value);
|
||||||
|
|
||||||
#ifdef HAS_BUTTON_HOLD
|
#ifdef HAS_BUTTON_HOLD
|
||||||
void backlight_hold_changed(bool hold_button);
|
void backlight_hold_changed(bool hold_button);
|
||||||
void backlight_set_on_button_hold(int index);
|
|
||||||
#endif
|
#endif
|
||||||
|
void backlight_set_on_button_hold(int index);
|
||||||
|
|
||||||
#if defined(HAVE_LCD_SLEEP) && defined(HAVE_LCD_SLEEP_SETTING)
|
#if defined(HAVE_LCD_SLEEP) && defined(HAVE_LCD_SLEEP_SETTING)
|
||||||
void lcd_set_sleep_after_backlight_off(int timeout_seconds);
|
void lcd_set_sleep_after_backlight_off(int timeout_seconds);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue