summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-10-06 10:13:48 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-10-06 10:13:48 +0000
commitc5b24010cbbf87a979ed78d6b2c9fe76e0e7d439 (patch)
tree221f41df8878a055b20fb6c856f1ff33840b2598 /apps/settings.c
parent83611fe8c32d99bb463358f5ec8e0ebe466f1f42 (diff)
Accepted Brian King's backlight-on-when-charging patch, slightly modified
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2515 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/apps/settings.c b/apps/settings.c
index dab44fe229..122f1109fb 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -275,15 +275,9 @@ int settings_save( void )
config_block[0xa] = (unsigned char)global_settings.contrast;
-#ifdef HAVE_CHARGE_CTRL
- if( global_settings.backlight_on_when_charging ) {
- config_block[0xb] = (unsigned char) (global_settings.backlight_timeout + 128);
- } else {
- config_block[0xb] = (unsigned char)global_settings.backlight_timeout;
- }
-#else
- config_block[0xb] = (unsigned char)global_settings.backlight_timeout;
-#endif
+ config_block[0xb] = (unsigned char)
+ ((global_settings.backlight_on_when_charging?0x40:0) |
+ (global_settings.backlight_timeout & 0x3f));
config_block[0xc] = (unsigned char)global_settings.poweroff;
config_block[0xd] = (unsigned char)global_settings.resume;
@@ -408,15 +402,14 @@ void settings_load(void)
if ( global_settings.contrast < MIN_CONTRAST_SETTING )
global_settings.contrast = DEFAULT_CONTRAST_SETTING;
}
-#ifdef HAVE_CHARGE_CTRL
+
if (config_block[0xb] != 0xFF) {
- global_settings.backlight_timeout = config_block[0xb] & 127;
- global_settings.backlight_on_when_charging = config_block[0xb] & 128 ? 1 : 0;
+ /* Bit 7 is unused to be able to detect uninitialized entry */
+ global_settings.backlight_timeout = config_block[0xb] & 0x3f;
+ global_settings.backlight_on_when_charging =
+ config_block[0xb] & 0x40 ? true : false;
}
-#else
- if (config_block[0xb] != 0xFF)
- global_settings.backlight_timeout = config_block[0xb];
-#endif
+
if (config_block[0xc] != 0xFF)
global_settings.poweroff = config_block[0xc];
if (config_block[0xd] != 0xFF)