From 86587527f52db8320f8d8ea48dfc76d3d93d79c8 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Wed, 23 Apr 2003 09:17:34 +0000 Subject: Added caption backlight: Turns on backlight briefly at the start and end of each track. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3585 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 5 +++++ apps/settings.c | 8 ++++++-- apps/settings.h | 1 + apps/settings_menu.c | 8 ++++++++ apps/wps-display.c | 16 ++++++++++++++++ 5 files changed, 36 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 9b0ef36782..8bef2ce5db 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -1482,3 +1482,8 @@ id: LANG_SCROLL_BAR desc: display menu, F3 substitute eng: "Scroll Bar" new: + +id: LANG_CAPTION_BACKLIGHT +desc: in settings_menu +eng: "Caption backlight" +new: diff --git a/apps/settings.c b/apps/settings.c index 8b74df852b..f4949416cd 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -125,6 +125,7 @@ modified unless the header & checksum test fails. Rest of config block, only saved to disk: 0xAE fade on pause/unpause/stop setting (bit 0) + caption backlight (bit 1) 0xB0 peak meter clip hold timeout (bit 0-4), peak meter performance (bit 7) 0xB1 peak meter release step size, peak_meter_dbfs (bit 7) 0xB2 peak meter min either in -db or in percent @@ -376,7 +377,9 @@ int settings_save( void ) config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8); } - config_block[0xae] = (unsigned char)global_settings.fade_on_stop; + config_block[0xae] = (unsigned char) + ((global_settings.fade_on_stop & 1) | + ((global_settings.caption_backlight & 1) << 1)); config_block[0xb0] = (unsigned char)global_settings.peak_meter_clip_hold | (global_settings.peak_meter_performance ? 0x80 : 0); config_block[0xb1] = global_settings.peak_meter_release | @@ -663,7 +666,8 @@ void settings_load(void) global_settings.topruntime = config_block[0x28] | (config_block[0x29] << 8); - global_settings.fade_on_stop=config_block[0xae]; + global_settings.fade_on_stop = config_block[0xae] & 1; + global_settings.caption_backlight = config_block[0xae] & 2; global_settings.peak_meter_clip_hold = (config_block[0xb0]) & 0x1f; global_settings.peak_meter_performance = diff --git a/apps/settings.h b/apps/settings.h index 0ff7cb2102..1a29899c01 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -153,6 +153,7 @@ struct user_settings int scroll_step; /* pixels to advance per update */ bool fade_on_stop; /* fade on pause/unpause/stop */ + bool caption_backlight; /* turn on backlight at end and start of track */ }; /* prototypes */ diff --git a/apps/settings_menu.c b/apps/settings_menu.c index e336585866..c1b113ffe4 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -67,6 +67,13 @@ static bool invert_cursor(void) return rc; } +static bool caption_backlight(void) +{ + bool rc = set_bool( str(LANG_CAPTION_BACKLIGHT), + &global_settings.caption_backlight); + + return rc; +} /** * Menu to configure the battery display on status bar */ @@ -752,6 +759,7 @@ static bool display_settings_menu(void) { str(LANG_PM_MENU), peak_meter_menu }, { str(LANG_VOLUME_DISPLAY), volume_type }, { str(LANG_BATTERY_DISPLAY), battery_type }, + { str(LANG_CAPTION_BACKLIGHT), caption_backlight }, #endif }; diff --git a/apps/wps-display.c b/apps/wps-display.c index 42c4759831..e6cf65a260 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c @@ -42,6 +42,7 @@ #include "lang.h" #include "powermgmt.h" #include "sprintf.h" +#include "backlight.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" @@ -768,6 +769,21 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, unsigned char refresh_mo peak_meter_enabled = enable_pm; #endif +#ifndef SIMULATOR + if (global_settings.caption_backlight && 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; + + if ( n < 1000 ) + n = 5000; /* use 5s if backlight is always on or off */ + + if ((id3->elapsed < 1000) || + ((id3->length - id3->elapsed) < (unsigned)n)) + backlight_on(); + } +#endif return true; } -- cgit v1.2.3