forked from len0rd/rockbox
Mark A. Hillebrand's patch that offers a new setting that if enabled, keeps
the backlight on all the time while the charger is connected. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2464 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
180485c304
commit
b95fe1afc6
7 changed files with 99 additions and 15 deletions
|
|
@ -864,3 +864,8 @@ id: LANG_PM_UNITS_PER_READ
|
|||
desc: in the peak meter menu
|
||||
eng: "Units per read"
|
||||
new:
|
||||
|
||||
id: LANG_BACKLIGHT_ON_WHEN_CHARGING
|
||||
desc: in display_settings_menu
|
||||
eng: "Backlight on when charging"
|
||||
new:
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ offset abs
|
|||
0x08 0x1c <loudness byte>
|
||||
0x09 0x1d <bass boost byte>
|
||||
0x0a 0x1e <contrast byte>
|
||||
0x0b 0x1f <backlight byte>
|
||||
0x0b 0x1f <backlight_on_when_charging, backlight_timeout>
|
||||
0x0c 0x20 <poweroff timer byte>
|
||||
0x0d 0x21 <resume settings byte>
|
||||
0x0e 0x22 <shuffle,dirfilter,sort_case,discharge,statusbar,show_hidden,
|
||||
|
|
@ -270,7 +270,16 @@ int settings_save( void )
|
|||
config_block[0x9] = (unsigned char)global_settings.bass_boost;
|
||||
|
||||
config_block[0xa] = (unsigned char)global_settings.contrast;
|
||||
config_block[0xb] = (unsigned char)global_settings.backlight;
|
||||
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
if( global_settings.backlight_on_when_charging ) {
|
||||
config_block[0xb] = (unsigned char) (global_settings.backlight_timeout + 128);
|
||||
} else {
|
||||
config_block[0xb] = (unsigned char)global_settings.backlight_timeout;
|
||||
}
|
||||
#else
|
||||
config_block[0xb] = (unsigned char)global_settings.backlight_timeout;
|
||||
#endif
|
||||
config_block[0xc] = (unsigned char)global_settings.poweroff;
|
||||
config_block[0xd] = (unsigned char)global_settings.resume;
|
||||
|
||||
|
|
@ -366,8 +375,15 @@ void settings_load(void)
|
|||
if ( global_settings.contrast < MIN_CONTRAST_SETTING )
|
||||
global_settings.contrast = DEFAULT_CONTRAST_SETTING;
|
||||
}
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
if (config_block[0xb] != 0xFF) {
|
||||
global_settings.backlight_timeout = config_block[0xb] & 127;
|
||||
global_settings.backlight_on_when_charging = config_block[0xb] & 128 ? 1 : 0;
|
||||
}
|
||||
#else
|
||||
if (config_block[0xb] != 0xFF)
|
||||
global_settings.backlight = config_block[0xb];
|
||||
global_settings.backlight_timeout = config_block[0xb];
|
||||
#endif
|
||||
if (config_block[0xc] != 0xFF)
|
||||
global_settings.poweroff = config_block[0xc];
|
||||
if (config_block[0xd] != 0xFF)
|
||||
|
|
@ -432,7 +448,10 @@ void settings_load(void)
|
|||
}
|
||||
lcd_set_contrast(global_settings.contrast);
|
||||
lcd_scroll_speed(global_settings.scroll_speed);
|
||||
backlight_time(global_settings.backlight);
|
||||
backlight_set_timeout(global_settings.backlight_timeout);
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
||||
#endif
|
||||
ata_spindown(global_settings.disk_spindown);
|
||||
set_poweroff_timeout(global_settings.poweroff);
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
|
|
@ -615,7 +634,10 @@ void settings_reset(void) {
|
|||
global_settings.resume = RESUME_ASK;
|
||||
global_settings.contrast = DEFAULT_CONTRAST_SETTING;
|
||||
global_settings.poweroff = DEFAULT_POWEROFF_SETTING;
|
||||
global_settings.backlight = DEFAULT_BACKLIGHT_SETTING;
|
||||
global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING;
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
global_settings.backlight_on_when_charging = DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING;
|
||||
#endif
|
||||
global_settings.dirfilter = SHOW_MUSIC;
|
||||
global_settings.sort_case = false;
|
||||
global_settings.statusbar = true;
|
||||
|
|
@ -654,10 +676,10 @@ void settings_display(void)
|
|||
global_settings.loudness,
|
||||
global_settings.bass_boost );
|
||||
|
||||
DEBUGF( "contrast:\t%d\npoweroff:\t%d\nbacklight:\t%d\n",
|
||||
DEBUGF( "contrast:\t%d\npoweroff:\t%d\nbacklight_timeout:\t%d\n",
|
||||
global_settings.contrast,
|
||||
global_settings.poweroff,
|
||||
global_settings.backlight );
|
||||
global_settings.backlight_timeout );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,10 @@ struct user_settings
|
|||
|
||||
int contrast; /* lcd contrast: 0-100 0=low 100=high */
|
||||
int poweroff; /* power off timer */
|
||||
int backlight; /* backlight off timer: 0-100 0=never:each 1% = 10 secs */
|
||||
int backlight_timeout; /* backlight off timeout: 0-18 0=never,1=always,then according to timeout_values[] */
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
bool backlight_on_when_charging;
|
||||
#endif
|
||||
bool discharge; /* maintain charge of at least: false = 90%, true = 10% */
|
||||
|
||||
/* resume settings */
|
||||
|
|
@ -144,7 +147,8 @@ extern char rockboxdir[];
|
|||
#endif
|
||||
#define MIN_CONTRAST_SETTING 5
|
||||
#define DEFAULT_POWEROFF_SETTING 0
|
||||
#define DEFAULT_BACKLIGHT_SETTING 5
|
||||
#define DEFAULT_BACKLIGHT_TIMEOUT_SETTING 5
|
||||
#define DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING 0
|
||||
#define DEFAULT_FF_REWIND_MIN_STEP FF_REWIND_1000
|
||||
#define DEFAULT_FF_REWIND_ACCEL_SETTING 3
|
||||
|
||||
|
|
|
|||
|
|
@ -144,6 +144,16 @@ static bool resume(void)
|
|||
names, 3, NULL );
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
static bool backlight_on_when_charging(void)
|
||||
{
|
||||
bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
|
||||
&global_settings.backlight_on_when_charging);
|
||||
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool backlight_timer(void)
|
||||
{
|
||||
char* names[] = { str(LANG_OFF), str(LANG_ON),
|
||||
|
|
@ -151,8 +161,8 @@ static bool backlight_timer(void)
|
|||
"6s ", "7s ", "8s ", "9s ", "10s",
|
||||
"15s", "20s", "25s", "30s", "45s",
|
||||
"60s", "90s"};
|
||||
return set_option(str(LANG_BACKLIGHT), &global_settings.backlight,
|
||||
names, 19, backlight_time );
|
||||
return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout,
|
||||
names, 19, backlight_set_timeout );
|
||||
}
|
||||
|
||||
static bool poweroff_idle_timer(void)
|
||||
|
|
@ -377,6 +387,9 @@ static bool display_settings_menu(void)
|
|||
struct menu_items items[] = {
|
||||
{ str(LANG_SCROLL_MENU), scroll_speed },
|
||||
{ str(LANG_BACKLIGHT), backlight_timer },
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
{ str(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging },
|
||||
#endif
|
||||
{ str(LANG_CONTRAST), contrast },
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
{ str(LANG_PM_MENU), peak_meter_menu },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue