summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-12-16 23:33:34 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-12-16 23:33:34 +0000
commitdfb9b2418bad770071a32fd2ed5633a39d237b66 (patch)
tree4cdd1c56df527f3b732a325e7ba6934028732318 /apps
parent04941881fc2b925cccdf3e1a856054947438d450 (diff)
Store a byte instead of an int for battery capacity.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3010 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/settings.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 9d0a9f62b3..5a532bf95e 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -126,7 +126,7 @@ modified unless the header & checksum test fails.
Rest of config block, only saved to disk:
-0xB1 (int) battery capacity
+0xB4 battery capacity
0xB5 scroll step in pixels
0xB6 scroll start and endpoint delay
0xB7 bidir scroll setting (bidi if 0-200% longer than screen width)
@@ -369,7 +369,7 @@ int settings_save( void )
config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8);
}
- memcpy(&config_block[0xb1], &global_settings.battery_capacity, 4);
+ config_block[0xb4]=(global_settings.battery_capacity - 1000) / 50;
config_block[0xb5]=(unsigned char)global_settings.scroll_step;
config_block[0xb6]=(unsigned char)global_settings.scroll_delay;
config_block[0xb7]=(unsigned char)global_settings.bidir_limit;
@@ -652,7 +652,7 @@ void settings_load(void)
global_settings.topruntime =
config_block[0x28] | (config_block[0x29] << 8);
- memcpy(&global_settings.battery_capacity, &config_block[0xb1], 4);
+ global_settings.battery_capacity = config_block[0xb4]*50 + 1000;
if (config_block[0xb5] != 0xff)
global_settings.scroll_step = config_block[0xb5];
@@ -959,8 +959,6 @@ bool set_int(char* string,
case BUTTON_RIGHT | BUTTON_REPEAT:
#endif
*variable += step;
- if(*variable > max )
- *variable = max;
break;
#ifdef HAVE_RECORDER_KEYPAD
@@ -971,8 +969,6 @@ bool set_int(char* string,
case BUTTON_LEFT | BUTTON_REPEAT:
#endif
*variable -= step;
- if(*variable < min )
- *variable = min;
break;
#ifdef HAVE_RECORDER_KEYPAD
@@ -987,7 +983,14 @@ bool set_int(char* string,
case SYS_USB_CONNECTED:
usb_screen();
return true;
+
}
+ if(*variable > max )
+ *variable = max;
+
+ if(*variable < min )
+ *variable = min;
+
if ( function && button != BUTTON_NONE)
function(*variable);
}