diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2005-11-21 23:55:39 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2005-11-21 23:55:39 +0000 |
| commit | b51f7dfc9b507ab9db12fe90b2ddad708f435e06 (patch) | |
| tree | efcef3411689401da21795d700a0741f8ab1072b /apps | |
| parent | e68680ac310adb8373c9f3a5194466766d64cf37 (diff) | |
| download | rockbox-b51f7dfc9b507ab9db12fe90b2ddad708f435e06.zip rockbox-b51f7dfc9b507ab9db12fe90b2ddad708f435e06.tar.gz rockbox-b51f7dfc9b507ab9db12fe90b2ddad708f435e06.tar.bz2 rockbox-b51f7dfc9b507ab9db12fe90b2ddad708f435e06.tar.xz | |
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
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/gui/gwps-common.c | 22 | ||||
| -rw-r--r-- | apps/main.c | 2 | ||||
| -rw-r--r-- | apps/plugin.c | 4 | ||||
| -rw-r--r-- | apps/settings.c | 18 | ||||
| -rw-r--r-- | apps/settings.h | 4 | ||||
| -rw-r--r-- | apps/settings_menu.c | 31 |
6 files changed, 67 insertions, 14 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index c2a4dff..16f3a6f 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -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 */ @@ -1627,6 +1627,22 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, 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; } diff --git a/apps/main.c b/apps/main.c index 9afb3e9..7472eb4 100644 --- a/apps/main.c +++ b/apps/main.c @@ -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(); diff --git a/apps/plugin.c b/apps/plugin.c index d5607aa..7d92998 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -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, diff --git a/apps/settings.c b/apps/settings.c index 7d68dae..939d488 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -277,9 +277,15 @@ 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 */ /* If values are just added to the end, no need to bump the version. */ @@ -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,12 +872,16 @@ 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) dac_line_in(global_settings.line_in); diff --git a/apps/settings.h b/apps/settings.h index a4401f8..689dffc 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -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 diff --git a/apps/settings_menu.c b/apps/settings_menu.c index fc54436..5230dd2 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -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 }, |