summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-04-23 09:17:34 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-04-23 09:17:34 +0000
commit86587527f52db8320f8d8ea48dfc76d3d93d79c8 (patch)
treec823b7c0d71d0f68ce087a1ab0fcf35c2b8560d6
parentb39dadf7f206695fa23ca7b6f305148a22b760c0 (diff)
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
-rw-r--r--apps/lang/english.lang5
-rw-r--r--apps/settings.c8
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_menu.c8
-rw-r--r--apps/wps-display.c16
-rw-r--r--firmware/backlight.c4
-rw-r--r--firmware/export/backlight.h1
7 files changed, 39 insertions, 4 deletions
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;
}
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 0974005136..887e5943f1 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -41,7 +41,7 @@ static bool backlight_on_when_charging = 0;
static int backlight_timer;
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
};
@@ -63,7 +63,7 @@ void backlight_thread(void)
}
else
{
- backlight_timer = HZ*timeout_value[backlight_timeout];
+ backlight_timer = HZ*backlight_timeout_value[backlight_timeout];
}
if(backlight_timer < 0)
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index 09efc45060..d0bfc62e2e 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -27,5 +27,6 @@ int backlight_get_timeout(void);
void backlight_set_timeout(int seconds);
bool backlight_get_on_when_charging(void);
void backlight_set_on_when_charging(bool yesno);
+extern const char backlight_timeout_value[];
#endif