summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/gwps-common.c22
-rw-r--r--apps/main.c2
-rw-r--r--apps/plugin.c4
-rw-r--r--apps/settings.c18
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_menu.c31
6 files changed, 67 insertions, 14 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index c2a4dff3b6..16f3a6f2cc 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,
1612 data->peak_meter_enabled = enable_pm; 1612 data->peak_meter_enabled = enable_pm;
1613#endif 1613#endif
1614 1614
1615#if defined(CONFIG_BACKLIGHT) && !defined(SIMULATOR) 1615#ifdef CONFIG_BACKLIGHT
1616 if (global_settings.caption_backlight && state->id3) { 1616 if (global_settings.caption_backlight && state->id3) {
1617 /* turn on backlight n seconds before track ends, and turn it off n 1617 /* turn on backlight n seconds before track ends, and turn it off n
1618 seconds into the new track. n == backlight_timeout, or 5s */ 1618 seconds into the new track. n == backlight_timeout, or 5s */
1619 int n = 1619 int n = backlight_timeout_value[global_settings.backlight_timeout]
1620 backlight_timeout_value[global_settings.backlight_timeout] * 1000; 1620 * 1000;
1621 1621
1622 if ( n < 1000 ) 1622 if ( n < 1000 )
1623 n = 5000; /* use 5s if backlight is always on or off */ 1623 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,
1627 backlight_on(); 1627 backlight_on();
1628 } 1628 }
1629#endif 1629#endif
1630#ifdef HAVE_REMOTE_LCD
1631 if (global_settings.remote_caption_backlight && state->id3) {
1632 /* turn on remote backlight n seconds before track ends, and turn it
1633 off n seconds into the new track. n == remote_backlight_timeout,
1634 or 5s */
1635 int n = backlight_timeout_value[global_settings.remote_backlight_timeout]
1636 * 1000;
1637
1638 if ( n < 1000 )
1639 n = 5000; /* use 5s if backlight is always on or off */
1640
1641 if ((state->id3->elapsed < 1000) ||
1642 ((state->id3->length - state->id3->elapsed) < (unsigned)n))
1643 remote_backlight_on();
1644 }
1645#endif
1630 return true; 1646 return true;
1631} 1647}
1632 1648
diff --git a/apps/main.c b/apps/main.c
index 9afb3e9a13..7472eb4661 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -147,6 +147,8 @@ void init(void)
147#endif 147#endif
148 font_init(); 148 font_init();
149 show_logo(); 149 show_logo();
150 button_init();
151 backlight_init();
150 lang_init(); 152 lang_init();
151 /* Must be done before any code uses the multi-screen APi */ 153 /* Must be done before any code uses the multi-screen APi */
152 screen_access_init(); 154 screen_access_init();
diff --git a/apps/plugin.c b/apps/plugin.c
index d5607aa822..7d92998e34 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -169,8 +169,8 @@ static const struct plugin_api rockbox_api = {
169 lcd_remote_update, 169 lcd_remote_update,
170 lcd_remote_update_rect, 170 lcd_remote_update_rect,
171 171
172 lcd_remote_backlight_on, 172 remote_backlight_on,
173 lcd_remote_backlight_off, 173 remote_backlight_off,
174#endif 174#endif
175 /* button */ 175 /* button */
176 button_get, 176 button_get,
diff --git a/apps/settings.c b/apps/settings.c
index 7d68daee98..939d4880e2 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -277,9 +277,15 @@ static const struct bit_entry rtc_bits[] =
277 {1, S_O(bidi_support), false, "bidi hebrew/arabic", off_on }, 277 {1, S_O(bidi_support), false, "bidi hebrew/arabic", off_on },
278#endif 278#endif
279 279
280#ifdef HAVE_REMOTE_LCD_TICKING /* move to REMOTE_LCD next time we bump version */ 280#ifdef HAVE_REMOTE_LCD /* move to REMOTE_LCD next time we bump version */
281#ifdef HAVE_REMOTE_LCD_TICKING
281 {1, S_O(remote_reduce_ticking), false, "remote reduce ticking", off_on }, 282 {1, S_O(remote_reduce_ticking), false, "remote reduce ticking", off_on },
282#endif 283#endif
284#ifdef HAVE_CHARGING
285 {1, S_O(remote_backlight_on_when_charging), false,
286 "remote backlight when plugged", off_on },
287#endif
288#endif
283 289
284 /* new stuff to be added here */ 290 /* new stuff to be added here */
285 /* If values are just added to the end, no need to bump the version. */ 291 /* 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[] =
475 {8|SIGNED, S_O(rec_adc_right_gain), 0, /* 0dB */ "adc right gain", NULL }, /* -128...48 */ 481 {8|SIGNED, S_O(rec_adc_right_gain), 0, /* 0dB */ "adc right gain", NULL }, /* -128...48 */
476#endif 482#endif
477 483
484#ifdef HAVE_REMOTE_LCD
485 {1, S_O(remote_caption_backlight), false,
486 "remote caption backlight", off_on },
487#endif
478 /* If values are just added to the end, no need to bump the version. */ 488 /* If values are just added to the end, no need to bump the version. */
479 /* new stuff to be added at the end */ 489 /* new stuff to be added at the end */
480 490
@@ -862,12 +872,16 @@ void settings_apply(void)
862#endif 872#endif
863 remote_backlight_set_timeout(global_settings.remote_backlight_timeout); 873 remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
864#endif 874#endif
875#ifdef CONFIG_BACKLIGHT
865 backlight_set_timeout(global_settings.backlight_timeout); 876 backlight_set_timeout(global_settings.backlight_timeout);
877#ifdef HAVE_CHARGING
866 backlight_set_on_when_charging(global_settings.backlight_on_when_charging); 878 backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
867#if CONFIG_BACKLIGHT == BL_IRIVER_H100 879#endif
880#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
868 backlight_set_fade_in(global_settings.backlight_fade_in); 881 backlight_set_fade_in(global_settings.backlight_fade_in);
869 backlight_set_fade_out(global_settings.backlight_fade_out); 882 backlight_set_fade_out(global_settings.backlight_fade_out);
870#endif 883#endif
884#endif
871 ata_spindown(global_settings.disk_spindown); 885 ata_spindown(global_settings.disk_spindown);
872#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR) 886#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
873 dac_line_in(global_settings.line_in); 887 dac_line_in(global_settings.line_in);
diff --git a/apps/settings.h b/apps/settings.h
index a4401f8ae5..689dffc739 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -343,7 +343,9 @@ struct user_settings
343 int remote_backlight_timeout; /* backlight off timeout: 0-18 0=never, 343 int remote_backlight_timeout; /* backlight off timeout: 0-18 0=never,
344 1=always, 344 1=always,
345 then according to timeout_values[] */ 345 then according to timeout_values[] */
346#ifdef HAVE_REMOTE_LCD_TICKING 346 bool remote_backlight_on_when_charging;
347 bool remote_caption_backlight; /* turn on backlight at end and start of track */
348#ifdef HAVE_REMOTE_LCD_TICKING
347 bool remote_reduce_ticking; /* 0=normal operation, 349 bool remote_reduce_ticking; /* 0=normal operation,
348 1=EMI reduce on with cost more CPU. */ 350 1=EMI reduce on with cost more CPU. */
349#endif 351#endif
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index fc54436afb..5230dd2010 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -137,10 +137,8 @@ static bool remote_reduce_ticking(void)
137#ifdef CONFIG_BACKLIGHT 137#ifdef CONFIG_BACKLIGHT
138static bool caption_backlight(void) 138static bool caption_backlight(void)
139{ 139{
140 bool rc = set_bool( str(LANG_CAPTION_BACKLIGHT), 140 return set_bool( str(LANG_CAPTION_BACKLIGHT),
141 &global_settings.caption_backlight); 141 &global_settings.caption_backlight);
142
143 return rc;
144} 142}
145 143
146#ifdef HAVE_CHARGING 144#ifdef HAVE_CHARGING
@@ -180,7 +178,7 @@ static bool backlight_timer(void)
180 INT, names, 19, backlight_set_timeout ); 178 INT, names, 19, backlight_set_timeout );
181} 179}
182 180
183#if CONFIG_BACKLIGHT == BL_IRIVER_H100 181#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
184static bool backlight_fade_in(void) 182static bool backlight_fade_in(void)
185{ 183{
186 static const struct opt_items names[] = { 184 static const struct opt_items names[] = {
@@ -242,6 +240,22 @@ static bool remote_backlight_timer(void)
242 INT, names, 19, remote_backlight_set_timeout ); 240 INT, names, 19, remote_backlight_set_timeout );
243} 241}
244 242
243#ifdef HAVE_CHARGING
244static bool remote_backlight_on_when_charging(void)
245{
246 bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
247 &global_settings.remote_backlight_on_when_charging);
248 remote_backlight_set_on_when_charging(
249 global_settings.remote_backlight_on_when_charging);
250 return result;
251}
252#endif
253
254static bool remote_caption_backlight(void)
255{
256 return set_bool( str(LANG_CAPTION_BACKLIGHT),
257 &global_settings.remote_caption_backlight);
258}
245#endif /* HAVE_REMOTE_LCD */ 259#endif /* HAVE_REMOTE_LCD */
246 260
247static bool contrast(void) 261static bool contrast(void)
@@ -1521,7 +1535,7 @@ static bool lcd_settings_menu(void)
1521 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, 1535 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging },
1522#endif 1536#endif
1523 { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight }, 1537 { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
1524#if CONFIG_BACKLIGHT == BL_IRIVER_H100 1538#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
1525 { ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in }, 1539 { ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in },
1526 { ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out }, 1540 { ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out },
1527#endif 1541#endif
@@ -1549,6 +1563,11 @@ static bool lcd_remote_settings_menu(void)
1549 1563
1550 static const struct menu_item items[] = { 1564 static const struct menu_item items[] = {
1551 { ID2P(LANG_BACKLIGHT), remote_backlight_timer }, 1565 { ID2P(LANG_BACKLIGHT), remote_backlight_timer },
1566#ifdef HAVE_CHARGING
1567 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING),
1568 remote_backlight_on_when_charging },
1569#endif
1570 { ID2P(LANG_CAPTION_BACKLIGHT), remote_caption_backlight },
1552 { ID2P(LANG_CONTRAST), remote_contrast }, 1571 { ID2P(LANG_CONTRAST), remote_contrast },
1553 { ID2P(LANG_INVERT), remote_invert }, 1572 { ID2P(LANG_INVERT), remote_invert },
1554 { ID2P(LANG_FLIP_DISPLAY), remote_flip_display }, 1573 { ID2P(LANG_FLIP_DISPLAY), remote_flip_display },