forked from len0rd/rockbox
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
This commit is contained in:
parent
04941881fc
commit
dfb9b2418b
1 changed files with 10 additions and 7 deletions
|
|
@ -126,7 +126,7 @@ modified unless the header & checksum test fails.
|
||||||
|
|
||||||
Rest of config block, only saved to disk:
|
Rest of config block, only saved to disk:
|
||||||
|
|
||||||
0xB1 (int) battery capacity
|
0xB4 battery capacity
|
||||||
0xB5 scroll step in pixels
|
0xB5 scroll step in pixels
|
||||||
0xB6 scroll start and endpoint delay
|
0xB6 scroll start and endpoint delay
|
||||||
0xB7 bidir scroll setting (bidi if 0-200% longer than screen width)
|
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);
|
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[0xb5]=(unsigned char)global_settings.scroll_step;
|
||||||
config_block[0xb6]=(unsigned char)global_settings.scroll_delay;
|
config_block[0xb6]=(unsigned char)global_settings.scroll_delay;
|
||||||
config_block[0xb7]=(unsigned char)global_settings.bidir_limit;
|
config_block[0xb7]=(unsigned char)global_settings.bidir_limit;
|
||||||
|
|
@ -652,7 +652,7 @@ void settings_load(void)
|
||||||
global_settings.topruntime =
|
global_settings.topruntime =
|
||||||
config_block[0x28] | (config_block[0x29] << 8);
|
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)
|
if (config_block[0xb5] != 0xff)
|
||||||
global_settings.scroll_step = config_block[0xb5];
|
global_settings.scroll_step = config_block[0xb5];
|
||||||
|
|
@ -959,8 +959,6 @@ bool set_int(char* string,
|
||||||
case BUTTON_RIGHT | BUTTON_REPEAT:
|
case BUTTON_RIGHT | BUTTON_REPEAT:
|
||||||
#endif
|
#endif
|
||||||
*variable += step;
|
*variable += step;
|
||||||
if(*variable > max )
|
|
||||||
*variable = max;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_RECORDER_KEYPAD
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
|
|
@ -971,8 +969,6 @@ bool set_int(char* string,
|
||||||
case BUTTON_LEFT | BUTTON_REPEAT:
|
case BUTTON_LEFT | BUTTON_REPEAT:
|
||||||
#endif
|
#endif
|
||||||
*variable -= step;
|
*variable -= step;
|
||||||
if(*variable < min )
|
|
||||||
*variable = min;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_RECORDER_KEYPAD
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
|
|
@ -987,7 +983,14 @@ bool set_int(char* string,
|
||||||
case SYS_USB_CONNECTED:
|
case SYS_USB_CONNECTED:
|
||||||
usb_screen();
|
usb_screen();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(*variable > max )
|
||||||
|
*variable = max;
|
||||||
|
|
||||||
|
if(*variable < min )
|
||||||
|
*variable = min;
|
||||||
|
|
||||||
if ( function && button != BUTTON_NONE)
|
if ( function && button != BUTTON_NONE)
|
||||||
function(*variable);
|
function(*variable);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue