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
This commit is contained in:
Björn Stenberg 2003-04-23 09:17:34 +00:00
parent b39dadf7f2
commit 86587527f5
7 changed files with 39 additions and 4 deletions

View file

@ -1482,3 +1482,8 @@ id: LANG_SCROLL_BAR
desc: display menu, F3 substitute desc: display menu, F3 substitute
eng: "Scroll Bar" eng: "Scroll Bar"
new: new:
id: LANG_CAPTION_BACKLIGHT
desc: in settings_menu
eng: "Caption backlight"
new:

View file

@ -125,6 +125,7 @@ modified unless the header & checksum test fails.
Rest of config block, only saved to disk: Rest of config block, only saved to disk:
0xAE fade on pause/unpause/stop setting (bit 0) 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) 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) 0xB1 peak meter release step size, peak_meter_dbfs (bit 7)
0xB2 peak meter min either in -db or in percent 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[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 | config_block[0xb0] = (unsigned char)global_settings.peak_meter_clip_hold |
(global_settings.peak_meter_performance ? 0x80 : 0); (global_settings.peak_meter_performance ? 0x80 : 0);
config_block[0xb1] = global_settings.peak_meter_release | config_block[0xb1] = global_settings.peak_meter_release |
@ -663,7 +666,8 @@ void settings_load(void)
global_settings.topruntime = global_settings.topruntime =
config_block[0x28] | (config_block[0x29] << 8); 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_clip_hold = (config_block[0xb0]) & 0x1f;
global_settings.peak_meter_performance = global_settings.peak_meter_performance =

View file

@ -153,6 +153,7 @@ struct user_settings
int scroll_step; /* pixels to advance per update */ int scroll_step; /* pixels to advance per update */
bool fade_on_stop; /* fade on pause/unpause/stop */ bool fade_on_stop; /* fade on pause/unpause/stop */
bool caption_backlight; /* turn on backlight at end and start of track */
}; };
/* prototypes */ /* prototypes */

View file

@ -67,6 +67,13 @@ static bool invert_cursor(void)
return rc; 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 * 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_PM_MENU), peak_meter_menu },
{ str(LANG_VOLUME_DISPLAY), volume_type }, { str(LANG_VOLUME_DISPLAY), volume_type },
{ str(LANG_BATTERY_DISPLAY), battery_type }, { str(LANG_BATTERY_DISPLAY), battery_type },
{ str(LANG_CAPTION_BACKLIGHT), caption_backlight },
#endif #endif
}; };

View file

@ -42,6 +42,7 @@
#include "lang.h" #include "lang.h"
#include "powermgmt.h" #include "powermgmt.h"
#include "sprintf.h" #include "sprintf.h"
#include "backlight.h"
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#include "icons.h" #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; peak_meter_enabled = enable_pm;
#endif #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; return true;
} }

View file

@ -41,7 +41,7 @@ static bool backlight_on_when_charging = 0;
static int backlight_timer; static int backlight_timer;
static int backlight_timeout = 5; static int backlight_timeout = 5;
static char timeout_value[19] = const char backlight_timeout_value[19] =
{ {
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90
}; };
@ -63,7 +63,7 @@ void backlight_thread(void)
} }
else else
{ {
backlight_timer = HZ*timeout_value[backlight_timeout]; backlight_timer = HZ*backlight_timeout_value[backlight_timeout];
} }
if(backlight_timer < 0) if(backlight_timer < 0)

View file

@ -27,5 +27,6 @@ int backlight_get_timeout(void);
void backlight_set_timeout(int seconds); void backlight_set_timeout(int seconds);
bool backlight_get_on_when_charging(void); bool backlight_get_on_when_charging(void);
void backlight_set_on_when_charging(bool yesno); void backlight_set_on_when_charging(bool yesno);
extern const char backlight_timeout_value[];
#endif #endif