forked from len0rd/rockbox
Backlight handling: * Added 'Caption Backlight' and 'Backlight On When Charging' for the iriver remote LCD. * Enabled the backlight code for the simulator, and prepared backlight simulation. It's only a stub atm, writing messages to the console window. * Added tick task handling to the simulators for this to work. * Code cleanup in backlight.c, less dead code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8034 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e68680ac31
commit
b51f7dfc9b
29 changed files with 416 additions and 231 deletions
|
@ -1612,12 +1612,12 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
|
|||
data->peak_meter_enabled = enable_pm;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BACKLIGHT) && !defined(SIMULATOR)
|
||||
#ifdef CONFIG_BACKLIGHT
|
||||
if (global_settings.caption_backlight && state->id3) {
|
||||
/* turn on backlight n seconds before track ends, and turn it off n
|
||||
seconds into the new track. n == backlight_timeout, or 5s */
|
||||
int n =
|
||||
backlight_timeout_value[global_settings.backlight_timeout] * 1000;
|
||||
int n = backlight_timeout_value[global_settings.backlight_timeout]
|
||||
* 1000;
|
||||
|
||||
if ( n < 1000 )
|
||||
n = 5000; /* use 5s if backlight is always on or off */
|
||||
|
@ -1626,6 +1626,22 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
|
|||
((state->id3->length - state->id3->elapsed) < (unsigned)n))
|
||||
backlight_on();
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
if (global_settings.remote_caption_backlight && state->id3) {
|
||||
/* turn on remote backlight n seconds before track ends, and turn it
|
||||
off n seconds into the new track. n == remote_backlight_timeout,
|
||||
or 5s */
|
||||
int n = backlight_timeout_value[global_settings.remote_backlight_timeout]
|
||||
* 1000;
|
||||
|
||||
if ( n < 1000 )
|
||||
n = 5000; /* use 5s if backlight is always on or off */
|
||||
|
||||
if ((state->id3->elapsed < 1000) ||
|
||||
((state->id3->length - state->id3->elapsed) < (unsigned)n))
|
||||
remote_backlight_on();
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -147,6 +147,8 @@ void init(void)
|
|||
#endif
|
||||
font_init();
|
||||
show_logo();
|
||||
button_init();
|
||||
backlight_init();
|
||||
lang_init();
|
||||
/* Must be done before any code uses the multi-screen APi */
|
||||
screen_access_init();
|
||||
|
|
|
@ -169,8 +169,8 @@ static const struct plugin_api rockbox_api = {
|
|||
lcd_remote_update,
|
||||
lcd_remote_update_rect,
|
||||
|
||||
lcd_remote_backlight_on,
|
||||
lcd_remote_backlight_off,
|
||||
remote_backlight_on,
|
||||
remote_backlight_off,
|
||||
#endif
|
||||
/* button */
|
||||
button_get,
|
||||
|
|
|
@ -277,8 +277,14 @@ static const struct bit_entry rtc_bits[] =
|
|||
{1, S_O(bidi_support), false, "bidi hebrew/arabic", off_on },
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REMOTE_LCD_TICKING /* move to REMOTE_LCD next time we bump version */
|
||||
#ifdef HAVE_REMOTE_LCD /* move to REMOTE_LCD next time we bump version */
|
||||
#ifdef HAVE_REMOTE_LCD_TICKING
|
||||
{1, S_O(remote_reduce_ticking), false, "remote reduce ticking", off_on },
|
||||
#endif
|
||||
#ifdef HAVE_CHARGING
|
||||
{1, S_O(remote_backlight_on_when_charging), false,
|
||||
"remote backlight when plugged", off_on },
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* new stuff to be added here */
|
||||
|
@ -475,6 +481,10 @@ static const struct bit_entry hd_bits[] =
|
|||
{8|SIGNED, S_O(rec_adc_right_gain), 0, /* 0dB */ "adc right gain", NULL }, /* -128...48 */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
{1, S_O(remote_caption_backlight), false,
|
||||
"remote caption backlight", off_on },
|
||||
#endif
|
||||
/* If values are just added to the end, no need to bump the version. */
|
||||
/* new stuff to be added at the end */
|
||||
|
||||
|
@ -862,11 +872,15 @@ void settings_apply(void)
|
|||
#endif
|
||||
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
||||
#endif
|
||||
#ifdef CONFIG_BACKLIGHT
|
||||
backlight_set_timeout(global_settings.backlight_timeout);
|
||||
#ifdef HAVE_CHARGING
|
||||
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
||||
#if CONFIG_BACKLIGHT == BL_IRIVER_H100
|
||||
#endif
|
||||
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
||||
backlight_set_fade_in(global_settings.backlight_fade_in);
|
||||
backlight_set_fade_out(global_settings.backlight_fade_out);
|
||||
#endif
|
||||
#endif
|
||||
ata_spindown(global_settings.disk_spindown);
|
||||
#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
|
||||
|
|
|
@ -343,7 +343,9 @@ struct user_settings
|
|||
int remote_backlight_timeout; /* backlight off timeout: 0-18 0=never,
|
||||
1=always,
|
||||
then according to timeout_values[] */
|
||||
#ifdef HAVE_REMOTE_LCD_TICKING
|
||||
bool remote_backlight_on_when_charging;
|
||||
bool remote_caption_backlight; /* turn on backlight at end and start of track */
|
||||
#ifdef HAVE_REMOTE_LCD_TICKING
|
||||
bool remote_reduce_ticking; /* 0=normal operation,
|
||||
1=EMI reduce on with cost more CPU. */
|
||||
#endif
|
||||
|
|
|
@ -137,10 +137,8 @@ static bool remote_reduce_ticking(void)
|
|||
#ifdef CONFIG_BACKLIGHT
|
||||
static bool caption_backlight(void)
|
||||
{
|
||||
bool rc = set_bool( str(LANG_CAPTION_BACKLIGHT),
|
||||
&global_settings.caption_backlight);
|
||||
|
||||
return rc;
|
||||
return set_bool( str(LANG_CAPTION_BACKLIGHT),
|
||||
&global_settings.caption_backlight);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHARGING
|
||||
|
@ -180,7 +178,7 @@ static bool backlight_timer(void)
|
|||
INT, names, 19, backlight_set_timeout );
|
||||
}
|
||||
|
||||
#if CONFIG_BACKLIGHT == BL_IRIVER_H100
|
||||
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
||||
static bool backlight_fade_in(void)
|
||||
{
|
||||
static const struct opt_items names[] = {
|
||||
|
@ -242,6 +240,22 @@ static bool remote_backlight_timer(void)
|
|||
INT, names, 19, remote_backlight_set_timeout );
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHARGING
|
||||
static bool remote_backlight_on_when_charging(void)
|
||||
{
|
||||
bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
|
||||
&global_settings.remote_backlight_on_when_charging);
|
||||
remote_backlight_set_on_when_charging(
|
||||
global_settings.remote_backlight_on_when_charging);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool remote_caption_backlight(void)
|
||||
{
|
||||
return set_bool( str(LANG_CAPTION_BACKLIGHT),
|
||||
&global_settings.remote_caption_backlight);
|
||||
}
|
||||
#endif /* HAVE_REMOTE_LCD */
|
||||
|
||||
static bool contrast(void)
|
||||
|
@ -1521,7 +1535,7 @@ static bool lcd_settings_menu(void)
|
|||
{ ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging },
|
||||
#endif
|
||||
{ ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
|
||||
#if CONFIG_BACKLIGHT == BL_IRIVER_H100
|
||||
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
||||
{ ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in },
|
||||
{ ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out },
|
||||
#endif
|
||||
|
@ -1549,6 +1563,11 @@ static bool lcd_remote_settings_menu(void)
|
|||
|
||||
static const struct menu_item items[] = {
|
||||
{ ID2P(LANG_BACKLIGHT), remote_backlight_timer },
|
||||
#ifdef HAVE_CHARGING
|
||||
{ ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING),
|
||||
remote_backlight_on_when_charging },
|
||||
#endif
|
||||
{ ID2P(LANG_CAPTION_BACKLIGHT), remote_caption_backlight },
|
||||
{ ID2P(LANG_CONTRAST), remote_contrast },
|
||||
{ ID2P(LANG_INVERT), remote_invert },
|
||||
{ ID2P(LANG_FLIP_DISPLAY), remote_flip_display },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue