summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-04-14 22:13:29 +0000
committerThomas Martitz <kugel@rockbox.org>2009-04-14 22:13:29 +0000
commitec7a0c5676ac34c7cdc41282bb1b151fd010818e (patch)
tree6e796e34222ed9f025c30a678b4cd3f997a7c693
parent0e74f75deba4029751050eefa6c4d13c1880b5d2 (diff)
downloadrockbox-ec7a0c5676ac34c7cdc41282bb1b151fd010818e.tar.gz
rockbox-ec7a0c5676ac34c7cdc41282bb1b151fd010818e.zip
Fix caption backlight.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20708 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c34
-rw-r--r--apps/gui/gwps.c47
2 files changed, 47 insertions, 34 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 189fc6fa31..5ab0097b2c 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -40,7 +40,6 @@
40#endif 40#endif
41#include "abrepeat.h" 41#include "abrepeat.h"
42#include "mp3_playback.h" 42#include "mp3_playback.h"
43#include "backlight.h"
44#include "lang.h" 43#include "lang.h"
45#include "misc.h" 44#include "misc.h"
46#include "splash.h" 45#include "splash.h"
@@ -2058,38 +2057,5 @@ bool gui_wps_redraw(struct gui_wps *gwps,
2058 2057
2059 display->update(); 2058 display->update();
2060 2059
2061#ifdef HAVE_BACKLIGHT
2062 if (global_settings.caption_backlight)
2063 {
2064 /* turn on backlight n seconds before track ends, and turn it off n
2065 seconds into the new track. n == backlight_timeout, or 5s */
2066 int n = global_settings.backlight_timeout * 1000;
2067
2068 if ( n < 1000 )
2069 n = 5000; /* use 5s if backlight is always on or off */
2070
2071 if (((id3->elapsed < 1000) ||
2072 ((id3->length - id3->elapsed) < (unsigned)n)) &&
2073 (state->paused == false))
2074 backlight_on();
2075 }
2076#endif
2077#ifdef HAVE_REMOTE_LCD
2078 if (global_settings.remote_caption_backlight)
2079 {
2080 /* turn on remote backlight n seconds before track ends, and turn it
2081 off n seconds into the new track. n == remote_backlight_timeout,
2082 or 5s */
2083 int n = global_settings.remote_backlight_timeout * 1000;
2084
2085 if ( n < 1000 )
2086 n = 5000; /* use 5s if backlight is always on or off */
2087
2088 if (((id3->elapsed < 1000) ||
2089 ((id3->length - id3->elapsed) < (unsigned)n)) &&
2090 (state->paused == false))
2091 remote_backlight_on();
2092 }
2093#endif
2094 return true; 2060 return true;
2095} 2061}
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 6285f7793f..0c8a3aa2b1 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -81,6 +81,50 @@ static void wps_state_init(void);
81static void track_changed_callback(void *param); 81static void track_changed_callback(void *param);
82static void nextid3available_callback(void* param); 82static void nextid3available_callback(void* param);
83 83
84
85#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD)
86static void gwps_caption_backlight(struct wps_state *state)
87{
88 if (state && state->id3)
89 {
90#ifdef HAVE_BACKLIGHT
91 if (global_settings.caption_backlight)
92 {
93 /* turn on backlight n seconds before track ends, and turn it off n
94 seconds into the new track. n == backlight_timeout, or 5s */
95 int n = global_settings.backlight_timeout * 1000;
96
97 if ( n < 1000 )
98 n = 5000; /* use 5s if backlight is always on or off */
99
100 if (((state->id3->elapsed < 1000) ||
101 ((state->id3->length - state->id3->elapsed) < (unsigned)n)) &&
102 (state->paused == false))
103 backlight_on();
104 }
105#endif
106#ifdef HAVE_REMOTE_LCD
107 if (global_settings.remote_caption_backlight)
108 {
109 /* turn on remote backlight n seconds before track ends, and turn it
110 off n seconds into the new track. n == remote_backlight_timeout,
111 or 5s */
112 int n = global_settings.remote_backlight_timeout * 1000;
113
114 if ( n < 1000 )
115 n = 5000; /* use 5s if backlight is always on or off */
116
117 if (((state->id3->elapsed < 1000) ||
118 ((state->id3->length - state->id3->elapsed) < (unsigned)n)) &&
119 (state->paused == false))
120 remote_backlight_on();
121 }
122#endif
123 }
124}
125#endif
126
127
84static void change_dir(int direction) 128static void change_dir(int direction)
85{ 129{
86 if (global_settings.prevent_skip) 130 if (global_settings.prevent_skip)
@@ -680,6 +724,9 @@ long gui_wps_show(void)
680 724
681 if (wps_state.do_full_update || update) 725 if (wps_state.do_full_update || update)
682 { 726 {
727#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD)
728 gwps_caption_backlight(&wps_state);
729#endif
683 FOR_NB_SCREENS(i) 730 FOR_NB_SCREENS(i)
684 { 731 {
685#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 732#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)