summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-11-23 20:12:33 +0000
committerJens Arnold <amiconn@rockbox.org>2005-11-23 20:12:33 +0000
commita6d409d9db969aedd3977ca3d0894bbf75533e39 (patch)
tree848ac0a55eb16c5f407017d3f7f73318f248088d /apps
parent47569223ebb5e99040c7c5cfc7d2a725999c6197 (diff)
downloadrockbox-a6d409d9db969aedd3977ca3d0894bbf75533e39.zip
rockbox-a6d409d9db969aedd3977ca3d0894bbf75533e39.tar.gz
rockbox-a6d409d9db969aedd3977ca3d0894bbf75533e39.tar.bz2
rockbox-a6d409d9db969aedd3977ca3d0894bbf75533e39.tar.xz
Replaced the booolean 'Backlight On When Plugged' setting with a complete alternative 'Backlight When Plugged' timeout setting. * Yield during poweroff to make backlight_off() work. * Bumped config version, save your settings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8053 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/lang/english.lang6
-rw-r--r--apps/screens.c2
-rw-r--r--apps/settings.c37
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_menu.c101
5 files changed, 67 insertions, 83 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 5e49b95..0192578 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -680,9 +680,9 @@ voice: "Units Per Read"
new:
id: LANG_BACKLIGHT_ON_WHEN_CHARGING
-desc: in display_settings_menu
-eng: "Backlight On When Plugged"
-voice: "Backlight On When Plugged"
+desc: in display_settings_menu, backlight timeout with charger connected
+eng: "Backlight When Plugged"
+voice: "Backlight When Plugged"
new:
id: LANG_REPEAT
diff --git a/apps/screens.c b/apps/screens.c
index 368a185..1693c31 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -313,7 +313,7 @@ int charging_screen(void)
#ifdef HAVE_REMOTE_LCD
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
#endif
- backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
+ backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
gui_syncstatusbar_draw(&statusbars, true);
#ifdef HAVE_LCD_CHARCELLS
diff --git a/apps/settings.c b/apps/settings.c
index 939d488..516518d 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -85,7 +85,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
#include "dsp.h"
#endif
-#define CONFIG_BLOCK_VERSION 32
+#define CONFIG_BLOCK_VERSION 33
#define CONFIG_BLOCK_SIZE 512
#define RTC_BLOCK_SIZE 44
@@ -179,6 +179,11 @@ static const char trig_durations_conf [] =
"0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min";
#endif
+#if defined(CONFIG_BACKLIGHT)
+static const char backlight_times_conf [] =
+ "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90";
+#endif
+
/* the part of the settings which ends up in the RTC RAM, where available
(those we either need early, save frequently, or without spinup) */
static const struct bit_entry rtc_bits[] =
@@ -216,12 +221,11 @@ static const struct bit_entry rtc_bits[] =
/* LCD */
{6, S_O(contrast), 40, "contrast", NULL },
#ifdef CONFIG_BACKLIGHT
+ {5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf },
#ifdef HAVE_CHARGING
- {1, S_O(backlight_on_when_charging), false,
- "backlight when plugged", off_on },
+ {5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged",
+ backlight_times_conf },
#endif
- {5, S_O(backlight_timeout), 5, "backlight timeout",
- "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90" },
#endif /* CONFIG_BACKLIGHT */
#ifdef HAVE_LCD_BITMAP
{1, S_O(invert), false, "invert", off_on },
@@ -236,6 +240,7 @@ static const struct bit_entry rtc_bits[] =
{1, S_O(volume_type), 0, "volume display", graphic_numeric },
{1, S_O(battery_display), 0, "battery display", graphic_numeric },
{1, S_O(timeformat), 0, "time format", "24hour,12hour" },
+ {1, S_O(bidi_support), false, "bidi hebrew/arabic", off_on },
#endif /* HAVE_LCD_BITMAP */
{1, S_O(show_icons), true, "show icons", off_on },
/* system */
@@ -268,23 +273,16 @@ static const struct bit_entry rtc_bits[] =
/* remote lcd */
{6, S_O(remote_contrast), 42, "remote contrast", NULL },
{1, S_O(remote_invert), false, "remote invert", off_on },
- {5, S_O(remote_backlight_timeout), 5, "remote backlight timeout",
- "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90" },
{1, S_O(remote_flip_display), false, "remote flip display", off_on },
+ {5, S_O(remote_backlight_timeout), 5, "remote backlight timeout",
+ backlight_times_conf },
+#ifdef HAVE_CHARGING
+ {5, S_O(remote_backlight_timeout_plugged), 11,
+ "remote backlight timeout plugged", backlight_times_conf },
#endif
-
-#ifdef HAVE_LCD_BITMAP /* move to LCD next time we bump version */
- {1, S_O(bidi_support), false, "bidi hebrew/arabic", off_on },
-#endif
-
-#ifdef HAVE_REMOTE_LCD /* move to REMOTE_LCD next time we bump version */
#ifdef HAVE_REMOTE_LCD_TICKING
{1, S_O(remote_reduce_ticking), false, "remote reduce ticking", off_on },
#endif
-#ifdef HAVE_CHARGING
- {1, S_O(remote_backlight_on_when_charging), false,
- "remote backlight when plugged", off_on },
-#endif
#endif
/* new stuff to be added here */
@@ -871,11 +869,14 @@ void settings_apply(void)
lcd_remote_emireduce(global_settings.remote_reduce_ticking);
#endif
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
+#ifdef HAVE_CHARGING
+ remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
+#endif
#endif
#ifdef CONFIG_BACKLIGHT
backlight_set_timeout(global_settings.backlight_timeout);
#ifdef HAVE_CHARGING
- backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
+ backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
#endif
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
backlight_set_fade_in(global_settings.backlight_fade_in);
diff --git a/apps/settings.h b/apps/settings.h
index 689dffc..9587033 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -221,7 +221,7 @@ struct user_settings
int backlight_timeout; /* backlight off timeout: 0-18 0=never,
1=always,
then according to timeout_values[] */
- bool backlight_on_when_charging;
+ int backlight_timeout_plugged;
#if CONFIG_BACKLIGHT == BL_IRIVER_H100
int backlight_fade_in; /* backlight fade in timing: 0..3 */
int backlight_fade_out; /* backlight fade in timing: 0..7 */
@@ -343,7 +343,7 @@ struct user_settings
int remote_backlight_timeout; /* backlight off timeout: 0-18 0=never,
1=always,
then according to timeout_values[] */
- bool remote_backlight_on_when_charging;
+ int remote_backlight_timeout_plugged;
bool remote_caption_backlight; /* turn on backlight at end and start of track */
#ifdef HAVE_REMOTE_LCD_TICKING
bool remote_reduce_ticking; /* 0=normal operation,
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 5230dd2..864ad63 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -135,6 +135,28 @@ static bool remote_reduce_ticking(void)
#endif
#ifdef CONFIG_BACKLIGHT
+static const struct opt_items backlight_timeouts[] = {
+ { STR(LANG_OFF) },
+ { STR(LANG_ON) },
+ { "1s ", TALK_ID(1, UNIT_SEC) },
+ { "2s ", TALK_ID(2, UNIT_SEC) },
+ { "3s ", TALK_ID(3, UNIT_SEC) },
+ { "4s ", TALK_ID(4, UNIT_SEC) },
+ { "5s ", TALK_ID(5, UNIT_SEC) },
+ { "6s ", TALK_ID(6, UNIT_SEC) },
+ { "7s ", TALK_ID(7, UNIT_SEC) },
+ { "8s ", TALK_ID(8, UNIT_SEC) },
+ { "9s ", TALK_ID(9, UNIT_SEC) },
+ { "10s", TALK_ID(10, UNIT_SEC) },
+ { "15s", TALK_ID(15, UNIT_SEC) },
+ { "20s", TALK_ID(20, UNIT_SEC) },
+ { "25s", TALK_ID(25, UNIT_SEC) },
+ { "30s", TALK_ID(30, UNIT_SEC) },
+ { "45s", TALK_ID(45, UNIT_SEC) },
+ { "60s", TALK_ID(60, UNIT_SEC) },
+ { "90s", TALK_ID(90, UNIT_SEC) }
+};
+
static bool caption_backlight(void)
{
return set_bool( str(LANG_CAPTION_BACKLIGHT),
@@ -142,40 +164,21 @@ static bool caption_backlight(void)
}
#ifdef HAVE_CHARGING
-static bool backlight_on_when_charging(void)
+static bool backlight_timer_plugged(void)
{
- bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
- &global_settings.backlight_on_when_charging);
- backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
- return result;
+ return set_option(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
+ &global_settings.backlight_timeout_plugged,
+ INT, backlight_timeouts, 19,
+ backlight_set_timeout_plugged );
}
#endif
static bool backlight_timer(void)
{
- static const struct opt_items names[] = {
- { STR(LANG_OFF) },
- { STR(LANG_ON) },
- { "1s ", TALK_ID(1, UNIT_SEC) },
- { "2s ", TALK_ID(2, UNIT_SEC) },
- { "3s ", TALK_ID(3, UNIT_SEC) },
- { "4s ", TALK_ID(4, UNIT_SEC) },
- { "5s ", TALK_ID(5, UNIT_SEC) },
- { "6s ", TALK_ID(6, UNIT_SEC) },
- { "7s ", TALK_ID(7, UNIT_SEC) },
- { "8s ", TALK_ID(8, UNIT_SEC) },
- { "9s ", TALK_ID(9, UNIT_SEC) },
- { "10s", TALK_ID(10, UNIT_SEC) },
- { "15s", TALK_ID(15, UNIT_SEC) },
- { "20s", TALK_ID(20, UNIT_SEC) },
- { "25s", TALK_ID(25, UNIT_SEC) },
- { "30s", TALK_ID(30, UNIT_SEC) },
- { "45s", TALK_ID(45, UNIT_SEC) },
- { "60s", TALK_ID(60, UNIT_SEC) },
- { "90s", TALK_ID(90, UNIT_SEC) }
- };
- return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout,
- INT, names, 19, backlight_set_timeout );
+ return set_option(str(LANG_BACKLIGHT),
+ &global_settings.backlight_timeout,
+ INT, backlight_timeouts, 19,
+ backlight_set_timeout );
}
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
@@ -215,39 +218,19 @@ static bool backlight_fade_out(void)
static bool remote_backlight_timer(void)
{
- static const struct opt_items names[] = {
- { STR(LANG_OFF) },
- { STR(LANG_ON) },
- { "1s ", TALK_ID(1, UNIT_SEC) },
- { "2s ", TALK_ID(2, UNIT_SEC) },
- { "3s ", TALK_ID(3, UNIT_SEC) },
- { "4s ", TALK_ID(4, UNIT_SEC) },
- { "5s ", TALK_ID(5, UNIT_SEC) },
- { "6s ", TALK_ID(6, UNIT_SEC) },
- { "7s ", TALK_ID(7, UNIT_SEC) },
- { "8s ", TALK_ID(8, UNIT_SEC) },
- { "9s ", TALK_ID(9, UNIT_SEC) },
- { "10s", TALK_ID(10, UNIT_SEC) },
- { "15s", TALK_ID(15, UNIT_SEC) },
- { "20s", TALK_ID(20, UNIT_SEC) },
- { "25s", TALK_ID(25, UNIT_SEC) },
- { "30s", TALK_ID(30, UNIT_SEC) },
- { "45s", TALK_ID(45, UNIT_SEC) },
- { "60s", TALK_ID(60, UNIT_SEC) },
- { "90s", TALK_ID(90, UNIT_SEC) }
- };
- return set_option(str(LANG_BACKLIGHT), &global_settings.remote_backlight_timeout,
- INT, names, 19, remote_backlight_set_timeout );
+ return set_option(str(LANG_BACKLIGHT),
+ &global_settings.remote_backlight_timeout,
+ INT, backlight_timeouts, 19,
+ remote_backlight_set_timeout );
}
#ifdef HAVE_CHARGING
-static bool remote_backlight_on_when_charging(void)
+static bool remote_backlight_timer_plugged(void)
{
- bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
- &global_settings.remote_backlight_on_when_charging);
- remote_backlight_set_on_when_charging(
- global_settings.remote_backlight_on_when_charging);
- return result;
+ return set_option(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
+ &global_settings.remote_backlight_timeout_plugged,
+ INT, backlight_timeouts, 19,
+ remote_backlight_set_timeout_plugged );
}
#endif
@@ -1532,7 +1515,7 @@ static bool lcd_settings_menu(void)
#ifdef CONFIG_BACKLIGHT
{ ID2P(LANG_BACKLIGHT), backlight_timer },
#ifdef HAVE_CHARGING
- { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging },
+ { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_timer_plugged },
#endif
{ ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
@@ -1565,7 +1548,7 @@ static bool lcd_remote_settings_menu(void)
{ ID2P(LANG_BACKLIGHT), remote_backlight_timer },
#ifdef HAVE_CHARGING
{ ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING),
- remote_backlight_on_when_charging },
+ remote_backlight_timer_plugged },
#endif
{ ID2P(LANG_CAPTION_BACKLIGHT), remote_caption_backlight },
{ ID2P(LANG_CONTRAST), remote_contrast },