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 @@
</dest>
<voice>
*: "(Vol- : Re-enable)"
+<phrase>
+ id: LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL
+ desc: in lcd settings
+ user:
+ <source>
+ *: "Normal"
+ </source>
+ <dest>
+ *: "Normal"
+ </dest>
+ <voice>
+ *: "Normal"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_BACKLIGHT_ON_BUTTON_HOLD
+ desc: in lcd settings
+ user:
+ <source>
+ *: "Backlight (On Hold Key)"
+ </source>
+ <dest>
+ *: "Backlight (On Hold Key)"
+ </dest>
+ <voice>
+ *: "Backlight on hold key"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_NEVER
+ desc: in lcd settings
+ user:
+ <source>
+ *: "Never"
+ </source>
+ <dest>
+ *: "Never"
+ </dest>
+ <voice>
+ *: "Never"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF
+ desc: In display settings, time to switch LCD chip into power saving state
+ user:
+ <source>
+ *: "Sleep (After Backlight Off)"
+ </source>
+ <dest>
+ *: "Sleep (After Backlight Off)"
+ </dest>
+ <voice>
+ *: "Sleep after backlight off"
+ </voice>
+</phrase>
</voice>
</phrase>
<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)
{
FOR_NB_SCREENS(i)
screens[i].clear_display();
+#ifdef X5_BACKLIGHT_SHUTDOWN
+ x5_backlight_shutdown();
+#endif
gui_syncsplash(0, true, str(LANG_SHUTTINGDOWN));
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 @@
#include "config.h"
#include "kernel.h"
#include "thread.h"
+#include "button.h"
#include "settings.h"
#include "disk.h"
#include "panic.h"
#include "debug.h"
-#include "button.h"
#include "usb.h"
#include "backlight.h"
#include "lcd.h"
@@ -40,7 +40,6 @@
#include "ata.h"
#include "fat.h"
#include "power.h"
-#include "backlight.h"
#include "powermgmt.h"
#include "status.h"
#include "atoi.h"
@@ -244,7 +243,7 @@ static const struct bit_entry rtc_bits[] =
{6, S_O(contrast), DEFAULT_CONTRAST_SETTING, "contrast", NULL },
#endif
#ifdef CONFIG_BACKLIGHT
- {5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf },
+ {5, S_O(backlight_timeout), 6, "backlight timeout", backlight_times_conf },
#ifdef CONFIG_CHARGING
{5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged",
backlight_times_conf },
@@ -296,7 +295,7 @@ static const struct bit_entry rtc_bits[] =
{6, S_O(remote_contrast), 42, "remote contrast", NULL },
{1, S_O(remote_invert), false, "remote invert", off_on },
{1, S_O(remote_flip_display), false, "remote flip display", off_on },
- {5, S_O(remote_backlight_timeout), 5, "remote backlight timeout",
+ {5, S_O(remote_backlight_timeout), 6, "remote backlight timeout",
backlight_times_conf },
#ifdef CONFIG_CHARGING
{5, S_O(remote_backlight_timeout_plugged), 11,
@@ -319,8 +318,7 @@ static const struct bit_entry rtc_bits[] =
{1, S_O(remote_bl_filter_first_keypress), false,
"backlight filters first remote keypress", off_on },
#endif
-
-#endif
+#endif /* CONFIG_BACKLIGHT */
/* new stuff to be added here */
/* 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[] =
{1, S_O(warnon_erase_dynplaylist), false,
"warn when erasing dynamic playlist", off_on },
+#ifdef CONFIG_BACKLIGHT
+#ifdef HAS_BUTTON_HOLD
+ {2, S_O(backlight_on_button_hold), 0, "backlight on button hold",
+ "normal,off,on" },
+#endif
+
+#ifdef HAVE_LCD_SLEEP
+ {4, S_O(lcd_sleep_after_backlight_off), 3,
+ "lcd sleep after backlight off",
+ "always,never,5,10,15,20,30,45,60,90" },
+#endif
+#endif /* CONFIG_BACKLIGHT */
+
+
/* If values are just added to the end, no need to bump the version. */
/* new stuff to be added at the end */
@@ -1183,7 +1195,13 @@ void settings_apply(void)
#ifdef HAVE_REMOTE_LCD
set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
#endif
+#ifdef HAS_BUTTON_HOLD
+ backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
+#endif
+#ifdef HAVE_LCD_SLEEP
+ lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
#endif
+#endif /* CONFIG_BACKLIGHT */
}
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
#ifdef HAVE_REMOTE_LCD
bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */
#endif
+#ifdef HAS_BUTTON_HOLD
+ int backlight_on_button_hold;
#endif
+#ifdef HAVE_LCD_SLEEP
+ int lcd_sleep_after_backlight_off;
+#endif
+#endif /* CONFIG_BACKLIGHT */
#ifdef HAVE_LCD_BITMAP
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)
backlight_set_timeout );
}
+#ifdef HAS_BUTTON_HOLD
+static bool backlight_on_button_hold(void)
+{
+ static const struct opt_items names[3] = {
+ { STR(LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL) },
+ { STR(LANG_OFF) },
+ { STR(LANG_ON) },
+ };
+ return set_option(str(LANG_BACKLIGHT_ON_BUTTON_HOLD),
+ &global_settings.backlight_on_button_hold,
+ INT, names, 3,
+ backlight_set_on_button_hold);
+}
+#endif /* HAS_BUTTON_HOLD */
+
#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
static bool backlight_fade_in(void)
{
@@ -227,6 +242,29 @@ static bool backlight_fade_out(void)
INT, names, 8, backlight_set_fade_out );
}
#endif
+
+#ifdef HAVE_LCD_SLEEP
+static bool lcd_sleep_after_backlight_off(void)
+{
+ static const struct opt_items names[] = {
+ { STR(LANG_ALWAYS) },
+ { STR(LANG_NEVER) },
+ { (unsigned char *)"5s", TALK_ID(5, UNIT_SEC) },
+ { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC) },
+ { (unsigned char *)"15s", TALK_ID(15, UNIT_SEC) },
+ { (unsigned char *)"20s", TALK_ID(20, UNIT_SEC) },
+ { (unsigned char *)"30s", TALK_ID(30, UNIT_SEC) },
+ { (unsigned char *)"45s", TALK_ID(45, UNIT_SEC) },
+ { (unsigned char *)"60s", TALK_ID(60, UNIT_SEC) },
+ { (unsigned char *)"90s", TALK_ID(90, UNIT_SEC) },
+ };
+
+ return set_option(str(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF),
+ &global_settings.lcd_sleep_after_backlight_off,
+ INT, names, 10,
+ lcd_set_sleep_after_backlight_off );
+}
+#endif /* HAVE_LCD_SLEEP */
#endif /* CONFIG_BACKLIGHT */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
@@ -257,7 +295,7 @@ static bool remote_backlight_timer_plugged(void)
INT, backlight_timeouts, 19,
remote_backlight_set_timeout_plugged );
}
-#endif
+#endif /* HAVE_REMOTE_LCD */
static bool remote_caption_backlight(void)
{
@@ -1771,12 +1809,18 @@ static bool lcd_settings_menu(void)
#ifdef CONFIG_CHARGING
{ ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_timer_plugged },
#endif
+#ifdef HAS_BUTTON_HOLD
+ { ID2P(LANG_BACKLIGHT_ON_BUTTON_HOLD), backlight_on_button_hold },
+#endif
{ ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
{ ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in },
{ ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out },
#endif
{ ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_bl_filter_first_keypress },
+#ifdef HAVE_LCD_SLEEP
+ { ID2P(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF), lcd_sleep_after_backlight_off },
+#endif
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
{ ID2P(LANG_BRIGHTNESS), brightness },
#endif