summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
1482desc: display menu, F3 substitute 1482desc: display menu, F3 substitute
1483eng: "Scroll Bar" 1483eng: "Scroll Bar"
1484new: 1484new:
1485
1486id: LANG_CAPTION_BACKLIGHT
1487desc: in settings_menu
1488eng: "Caption backlight"
1489new:
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.
125 125
126Rest of config block, only saved to disk: 126Rest of config block, only saved to disk:
1270xAE fade on pause/unpause/stop setting (bit 0) 1270xAE fade on pause/unpause/stop setting (bit 0)
128 caption backlight (bit 1)
1280xB0 peak meter clip hold timeout (bit 0-4), peak meter performance (bit 7) 1290xB0 peak meter clip hold timeout (bit 0-4), peak meter performance (bit 7)
1290xB1 peak meter release step size, peak_meter_dbfs (bit 7) 1300xB1 peak meter release step size, peak_meter_dbfs (bit 7)
1300xB2 peak meter min either in -db or in percent 1310xB2 peak meter min either in -db or in percent
@@ -376,7 +377,9 @@ int settings_save( void )
376 config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8); 377 config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8);
377 } 378 }
378 379
379 config_block[0xae] = (unsigned char)global_settings.fade_on_stop; 380 config_block[0xae] = (unsigned char)
381 ((global_settings.fade_on_stop & 1) |
382 ((global_settings.caption_backlight & 1) << 1));
380 config_block[0xb0] = (unsigned char)global_settings.peak_meter_clip_hold | 383 config_block[0xb0] = (unsigned char)global_settings.peak_meter_clip_hold |
381 (global_settings.peak_meter_performance ? 0x80 : 0); 384 (global_settings.peak_meter_performance ? 0x80 : 0);
382 config_block[0xb1] = global_settings.peak_meter_release | 385 config_block[0xb1] = global_settings.peak_meter_release |
@@ -663,7 +666,8 @@ void settings_load(void)
663 global_settings.topruntime = 666 global_settings.topruntime =
664 config_block[0x28] | (config_block[0x29] << 8); 667 config_block[0x28] | (config_block[0x29] << 8);
665 668
666 global_settings.fade_on_stop=config_block[0xae]; 669 global_settings.fade_on_stop = config_block[0xae] & 1;
670 global_settings.caption_backlight = config_block[0xae] & 2;
667 671
668 global_settings.peak_meter_clip_hold = (config_block[0xb0]) & 0x1f; 672 global_settings.peak_meter_clip_hold = (config_block[0xb0]) & 0x1f;
669 global_settings.peak_meter_performance = 673 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
153 int scroll_step; /* pixels to advance per update */ 153 int scroll_step; /* pixels to advance per update */
154 154
155 bool fade_on_stop; /* fade on pause/unpause/stop */ 155 bool fade_on_stop; /* fade on pause/unpause/stop */
156 bool caption_backlight; /* turn on backlight at end and start of track */
156}; 157};
157 158
158/* prototypes */ 159/* 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)
67 return rc; 67 return rc;
68} 68}
69 69
70static bool caption_backlight(void)
71{
72 bool rc = set_bool( str(LANG_CAPTION_BACKLIGHT),
73 &global_settings.caption_backlight);
74
75 return rc;
76}
70/** 77/**
71 * Menu to configure the battery display on status bar 78 * Menu to configure the battery display on status bar
72 */ 79 */
@@ -752,6 +759,7 @@ static bool display_settings_menu(void)
752 { str(LANG_PM_MENU), peak_meter_menu }, 759 { str(LANG_PM_MENU), peak_meter_menu },
753 { str(LANG_VOLUME_DISPLAY), volume_type }, 760 { str(LANG_VOLUME_DISPLAY), volume_type },
754 { str(LANG_BATTERY_DISPLAY), battery_type }, 761 { str(LANG_BATTERY_DISPLAY), battery_type },
762 { str(LANG_CAPTION_BACKLIGHT), caption_backlight },
755#endif 763#endif
756 }; 764 };
757 765
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 @@
42#include "lang.h" 42#include "lang.h"
43#include "powermgmt.h" 43#include "powermgmt.h"
44#include "sprintf.h" 44#include "sprintf.h"
45#include "backlight.h"
45 46
46#ifdef HAVE_LCD_BITMAP 47#ifdef HAVE_LCD_BITMAP
47#include "icons.h" 48#include "icons.h"
@@ -768,6 +769,21 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, unsigned char refresh_mo
768 peak_meter_enabled = enable_pm; 769 peak_meter_enabled = enable_pm;
769#endif 770#endif
770 771
772#ifndef SIMULATOR
773 if (global_settings.caption_backlight && id3) {
774 /* turn on backlight n seconds before track ends, and turn it off n
775 seconds into the new track. n == backlight_timeout, or 5s */
776 int n =
777 backlight_timeout_value[global_settings.backlight_timeout] * 1000;
778
779 if ( n < 1000 )
780 n = 5000; /* use 5s if backlight is always on or off */
781
782 if ((id3->elapsed < 1000) ||
783 ((id3->length - id3->elapsed) < (unsigned)n))
784 backlight_on();
785 }
786#endif
771 return true; 787 return true;
772} 788}
773 789
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;
41static int backlight_timer; 41static int backlight_timer;
42static int backlight_timeout = 5; 42static int backlight_timeout = 5;
43 43
44static char timeout_value[19] = 44const char backlight_timeout_value[19] =
45{ 45{
46 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90 46 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90
47}; 47};
@@ -63,7 +63,7 @@ void backlight_thread(void)
63 } 63 }
64 else 64 else
65 { 65 {
66 backlight_timer = HZ*timeout_value[backlight_timeout]; 66 backlight_timer = HZ*backlight_timeout_value[backlight_timeout];
67 } 67 }
68 68
69 if(backlight_timer < 0) 69 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);
27void backlight_set_timeout(int seconds); 27void backlight_set_timeout(int seconds);
28bool backlight_get_on_when_charging(void); 28bool backlight_get_on_when_charging(void);
29void backlight_set_on_when_charging(bool yesno); 29void backlight_set_on_when_charging(bool yesno);
30extern const char backlight_timeout_value[];
30 31
31#endif 32#endif