summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/lang/english.lang56
-rw-r--r--apps/misc.c3
-rw-r--r--apps/settings.c30
-rw-r--r--apps/settings.h6
-rw-r--r--apps/settings_menu.c46
5 files changed, 134 insertions, 7 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 61d16d22f7..a723c1cc0e 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -8805,6 +8805,62 @@
8805 </dest> 8805 </dest>
8806 <voice> 8806 <voice>
8807 *: "(Vol- : Re-enable)" 8807 *: "(Vol- : Re-enable)"
8808<phrase>
8809 id: LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL
8810 desc: in lcd settings
8811 user:
8812 <source>
8813 *: "Normal"
8814 </source>
8815 <dest>
8816 *: "Normal"
8817 </dest>
8818 <voice>
8819 *: "Normal"
8820 </voice>
8821</phrase>
8822<phrase>
8823 id: LANG_BACKLIGHT_ON_BUTTON_HOLD
8824 desc: in lcd settings
8825 user:
8826 <source>
8827 *: "Backlight (On Hold Key)"
8828 </source>
8829 <dest>
8830 *: "Backlight (On Hold Key)"
8831 </dest>
8832 <voice>
8833 *: "Backlight on hold key"
8834 </voice>
8835</phrase>
8836<phrase>
8837 id: LANG_NEVER
8838 desc: in lcd settings
8839 user:
8840 <source>
8841 *: "Never"
8842 </source>
8843 <dest>
8844 *: "Never"
8845 </dest>
8846 <voice>
8847 *: "Never"
8848 </voice>
8849</phrase>
8850<phrase>
8851 id: LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF
8852 desc: In display settings, time to switch LCD chip into power saving state
8853 user:
8854 <source>
8855 *: "Sleep (After Backlight Off)"
8856 </source>
8857 <dest>
8858 *: "Sleep (After Backlight Off)"
8859 </dest>
8860 <voice>
8861 *: "Sleep after backlight off"
8862 </voice>
8863</phrase>
8808 </voice> 8864 </voice>
8809</phrase> 8865</phrase>
8810<phrase> 8866<phrase>
diff --git a/apps/misc.c b/apps/misc.c
index b0c315af98..ffacf7ed82 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -491,6 +491,9 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
491 { 491 {
492 FOR_NB_SCREENS(i) 492 FOR_NB_SCREENS(i)
493 screens[i].clear_display(); 493 screens[i].clear_display();
494#ifdef X5_BACKLIGHT_SHUTDOWN
495 x5_backlight_shutdown();
496#endif
494 gui_syncsplash(0, true, str(LANG_SHUTTINGDOWN)); 497 gui_syncsplash(0, true, str(LANG_SHUTTINGDOWN));
495 498
496 if (!tagcache_prepare_shutdown()) 499 if (!tagcache_prepare_shutdown())
diff --git a/apps/settings.c b/apps/settings.c
index 673b8fe246..3c036d8594 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -24,11 +24,11 @@
24#include "config.h" 24#include "config.h"
25#include "kernel.h" 25#include "kernel.h"
26#include "thread.h" 26#include "thread.h"
27#include "button.h"
27#include "settings.h" 28#include "settings.h"
28#include "disk.h" 29#include "disk.h"
29#include "panic.h" 30#include "panic.h"
30#include "debug.h" 31#include "debug.h"
31#include "button.h"
32#include "usb.h" 32#include "usb.h"
33#include "backlight.h" 33#include "backlight.h"
34#include "lcd.h" 34#include "lcd.h"
@@ -40,7 +40,6 @@
40#include "ata.h" 40#include "ata.h"
41#include "fat.h" 41#include "fat.h"
42#include "power.h" 42#include "power.h"
43#include "backlight.h"
44#include "powermgmt.h" 43#include "powermgmt.h"
45#include "status.h" 44#include "status.h"
46#include "atoi.h" 45#include "atoi.h"
@@ -244,7 +243,7 @@ static const struct bit_entry rtc_bits[] =
244 {6, S_O(contrast), DEFAULT_CONTRAST_SETTING, "contrast", NULL }, 243 {6, S_O(contrast), DEFAULT_CONTRAST_SETTING, "contrast", NULL },
245#endif 244#endif
246#ifdef CONFIG_BACKLIGHT 245#ifdef CONFIG_BACKLIGHT
247 {5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf }, 246 {5, S_O(backlight_timeout), 6, "backlight timeout", backlight_times_conf },
248#ifdef CONFIG_CHARGING 247#ifdef CONFIG_CHARGING
249 {5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged", 248 {5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged",
250 backlight_times_conf }, 249 backlight_times_conf },
@@ -296,7 +295,7 @@ static const struct bit_entry rtc_bits[] =
296 {6, S_O(remote_contrast), 42, "remote contrast", NULL }, 295 {6, S_O(remote_contrast), 42, "remote contrast", NULL },
297 {1, S_O(remote_invert), false, "remote invert", off_on }, 296 {1, S_O(remote_invert), false, "remote invert", off_on },
298 {1, S_O(remote_flip_display), false, "remote flip display", off_on }, 297 {1, S_O(remote_flip_display), false, "remote flip display", off_on },
299 {5, S_O(remote_backlight_timeout), 5, "remote backlight timeout", 298 {5, S_O(remote_backlight_timeout), 6, "remote backlight timeout",
300 backlight_times_conf }, 299 backlight_times_conf },
301#ifdef CONFIG_CHARGING 300#ifdef CONFIG_CHARGING
302 {5, S_O(remote_backlight_timeout_plugged), 11, 301 {5, S_O(remote_backlight_timeout_plugged), 11,
@@ -319,8 +318,7 @@ static const struct bit_entry rtc_bits[] =
319 {1, S_O(remote_bl_filter_first_keypress), false, 318 {1, S_O(remote_bl_filter_first_keypress), false,
320 "backlight filters first remote keypress", off_on }, 319 "backlight filters first remote keypress", off_on },
321#endif 320#endif
322 321#endif /* CONFIG_BACKLIGHT */
323#endif
324 322
325 /* new stuff to be added here */ 323 /* new stuff to be added here */
326 /* If values are just added to the end, no need to bump the version. */ 324 /* If values are just added to the end, no need to bump the version. */
@@ -574,6 +572,20 @@ static const struct bit_entry hd_bits[] =
574 {1, S_O(warnon_erase_dynplaylist), false, 572 {1, S_O(warnon_erase_dynplaylist), false,
575 "warn when erasing dynamic playlist", off_on }, 573 "warn when erasing dynamic playlist", off_on },
576 574
575#ifdef CONFIG_BACKLIGHT
576#ifdef HAS_BUTTON_HOLD
577 {2, S_O(backlight_on_button_hold), 0, "backlight on button hold",
578 "normal,off,on" },
579#endif
580
581#ifdef HAVE_LCD_SLEEP
582 {4, S_O(lcd_sleep_after_backlight_off), 3,
583 "lcd sleep after backlight off",
584 "always,never,5,10,15,20,30,45,60,90" },
585#endif
586#endif /* CONFIG_BACKLIGHT */
587
588
577 589
578 /* If values are just added to the end, no need to bump the version. */ 590 /* If values are just added to the end, no need to bump the version. */
579 /* new stuff to be added at the end */ 591 /* new stuff to be added at the end */
@@ -1183,7 +1195,13 @@ void settings_apply(void)
1183#ifdef HAVE_REMOTE_LCD 1195#ifdef HAVE_REMOTE_LCD
1184 set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress); 1196 set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
1185#endif 1197#endif
1198#ifdef HAS_BUTTON_HOLD
1199 backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
1200#endif
1201#ifdef HAVE_LCD_SLEEP
1202 lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
1186#endif 1203#endif
1204#endif /* CONFIG_BACKLIGHT */
1187} 1205}
1188 1206
1189 1207
diff --git a/apps/settings.h b/apps/settings.h
index 4ab290914a..369e1ebd6b 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -531,7 +531,13 @@ struct user_settings
531#ifdef HAVE_REMOTE_LCD 531#ifdef HAVE_REMOTE_LCD
532 bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */ 532 bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */
533#endif 533#endif
534#ifdef HAS_BUTTON_HOLD
535 int backlight_on_button_hold;
534#endif 536#endif
537#ifdef HAVE_LCD_SLEEP
538 int lcd_sleep_after_backlight_off;
539#endif
540#endif /* CONFIG_BACKLIGHT */
535 541
536#ifdef HAVE_LCD_BITMAP 542#ifdef HAVE_LCD_BITMAP
537 unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */ 543 unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 20235f5a72..93c809d007 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -196,6 +196,21 @@ static bool backlight_timer(void)
196 backlight_set_timeout ); 196 backlight_set_timeout );
197} 197}
198 198
199#ifdef HAS_BUTTON_HOLD
200static bool backlight_on_button_hold(void)
201{
202 static const struct opt_items names[3] = {
203 { STR(LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL) },
204 { STR(LANG_OFF) },
205 { STR(LANG_ON) },
206 };
207 return set_option(str(LANG_BACKLIGHT_ON_BUTTON_HOLD),
208 &global_settings.backlight_on_button_hold,
209 INT, names, 3,
210 backlight_set_on_button_hold);
211}
212#endif /* HAS_BUTTON_HOLD */
213
199#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) 214#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
200static bool backlight_fade_in(void) 215static bool backlight_fade_in(void)
201{ 216{
@@ -227,6 +242,29 @@ static bool backlight_fade_out(void)
227 INT, names, 8, backlight_set_fade_out ); 242 INT, names, 8, backlight_set_fade_out );
228} 243}
229#endif 244#endif
245
246#ifdef HAVE_LCD_SLEEP
247static bool lcd_sleep_after_backlight_off(void)
248{
249 static const struct opt_items names[] = {
250 { STR(LANG_ALWAYS) },
251 { STR(LANG_NEVER) },
252 { (unsigned char *)"5s", TALK_ID(5, UNIT_SEC) },
253 { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC) },
254 { (unsigned char *)"15s", TALK_ID(15, UNIT_SEC) },
255 { (unsigned char *)"20s", TALK_ID(20, UNIT_SEC) },
256 { (unsigned char *)"30s", TALK_ID(30, UNIT_SEC) },
257 { (unsigned char *)"45s", TALK_ID(45, UNIT_SEC) },
258 { (unsigned char *)"60s", TALK_ID(60, UNIT_SEC) },
259 { (unsigned char *)"90s", TALK_ID(90, UNIT_SEC) },
260 };
261
262 return set_option(str(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF),
263 &global_settings.lcd_sleep_after_backlight_off,
264 INT, names, 10,
265 lcd_set_sleep_after_backlight_off );
266}
267#endif /* HAVE_LCD_SLEEP */
230#endif /* CONFIG_BACKLIGHT */ 268#endif /* CONFIG_BACKLIGHT */
231 269
232#ifdef HAVE_BACKLIGHT_BRIGHTNESS 270#ifdef HAVE_BACKLIGHT_BRIGHTNESS
@@ -257,7 +295,7 @@ static bool remote_backlight_timer_plugged(void)
257 INT, backlight_timeouts, 19, 295 INT, backlight_timeouts, 19,
258 remote_backlight_set_timeout_plugged ); 296 remote_backlight_set_timeout_plugged );
259} 297}
260#endif 298#endif /* HAVE_REMOTE_LCD */
261 299
262static bool remote_caption_backlight(void) 300static bool remote_caption_backlight(void)
263{ 301{
@@ -1771,12 +1809,18 @@ static bool lcd_settings_menu(void)
1771#ifdef CONFIG_CHARGING 1809#ifdef CONFIG_CHARGING
1772 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_timer_plugged }, 1810 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_timer_plugged },
1773#endif 1811#endif
1812#ifdef HAS_BUTTON_HOLD
1813 { ID2P(LANG_BACKLIGHT_ON_BUTTON_HOLD), backlight_on_button_hold },
1814#endif
1774 { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight }, 1815 { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
1775#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) 1816#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
1776 { ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in }, 1817 { ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in },
1777 { ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out }, 1818 { ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out },
1778#endif 1819#endif
1779 { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_bl_filter_first_keypress }, 1820 { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_bl_filter_first_keypress },
1821#ifdef HAVE_LCD_SLEEP
1822 { ID2P(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF), lcd_sleep_after_backlight_off },
1823#endif
1780#ifdef HAVE_BACKLIGHT_BRIGHTNESS 1824#ifdef HAVE_BACKLIGHT_BRIGHTNESS
1781 { ID2P(LANG_BRIGHTNESS), brightness }, 1825 { ID2P(LANG_BRIGHTNESS), brightness },
1782#endif 1826#endif