forked from len0rd/rockbox
battery capacity (1500-2400 in 50mAh steps) saved to disk
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3008 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ae1ba1d5de
commit
0bf70e65e8
5 changed files with 20 additions and 29 deletions
|
@ -126,6 +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
|
||||||
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)
|
||||||
|
@ -368,6 +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[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;
|
||||||
|
@ -466,6 +468,8 @@ void settings_apply(void)
|
||||||
enable_trickle_charge(global_settings.trickle_charge);
|
enable_trickle_charge(global_settings.trickle_charge);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
set_battery_capacity(global_settings.battery_capacity);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
settings_apply_pm_range();
|
settings_apply_pm_range();
|
||||||
peak_meter_init_times(
|
peak_meter_init_times(
|
||||||
|
@ -648,6 +652,8 @@ 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);
|
||||||
|
|
||||||
if (config_block[0xb5] != 0xff)
|
if (config_block[0xb5] != 0xff)
|
||||||
global_settings.scroll_step = config_block[0xb5];
|
global_settings.scroll_step = config_block[0xb5];
|
||||||
|
|
||||||
|
@ -831,7 +837,7 @@ void settings_reset(void) {
|
||||||
global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING;
|
global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING;
|
||||||
global_settings.backlight_on_when_charging =
|
global_settings.backlight_on_when_charging =
|
||||||
DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING;
|
DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING;
|
||||||
global_settings.battery_capacity = 0; /* 1500 mAh */
|
global_settings.battery_capacity = 1500; /* mAh */
|
||||||
global_settings.trickle_charge = true;
|
global_settings.trickle_charge = true;
|
||||||
global_settings.dirfilter = SHOW_MUSIC;
|
global_settings.dirfilter = SHOW_MUSIC;
|
||||||
global_settings.sort_case = false;
|
global_settings.sort_case = false;
|
||||||
|
|
|
@ -85,14 +85,7 @@ struct user_settings
|
||||||
bool backlight_on_when_charging;
|
bool backlight_on_when_charging;
|
||||||
bool discharge; /* maintain charge of at least: false = 85%, true = 10% */
|
bool discharge; /* maintain charge of at least: false = 85%, true = 10% */
|
||||||
bool trickle_charge; /* do trickle charging: 0=off, 1=on */
|
bool trickle_charge; /* do trickle charging: 0=off, 1=on */
|
||||||
int battery_capacity; /* 0 = 1500 mAh
|
int battery_capacity; /* in mAh */
|
||||||
1 = 1600 mAh
|
|
||||||
2 = 1700 mAh
|
|
||||||
3 = 1800 mAh
|
|
||||||
4 = 1900 mAh
|
|
||||||
5 = 2000 mAh
|
|
||||||
6 = 2100 mAh
|
|
||||||
7 = 2200 mAh */
|
|
||||||
|
|
||||||
/* resume settings */
|
/* resume settings */
|
||||||
|
|
||||||
|
|
|
@ -428,27 +428,16 @@ static bool bidir_limit(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SIMULATOR
|
||||||
/**
|
/**
|
||||||
* Menu to set the battery capacity
|
* Menu to set the battery capacity
|
||||||
*/
|
*/
|
||||||
static bool battery_capacity(void) {
|
static bool battery_capacity(void)
|
||||||
bool retval = false;
|
{
|
||||||
|
return set_int(str(LANG_BATTERY_CAPACITY), " mAh", &global_settings.battery_capacity,
|
||||||
char* names[] = { "1500 mAh ", "1600 mAh ",
|
&set_battery_capacity, 50, 1500, BATTERY_CAPACITY_MAX );
|
||||||
"1700 mAh ", "1800 mAh ",
|
|
||||||
"1900 mAh ", "2000 mAh ",
|
|
||||||
"2100 mAh ", "2200 mAh "
|
|
||||||
};
|
|
||||||
|
|
||||||
retval = set_option( str(LANG_BATTERY_CAPACITY),
|
|
||||||
&global_settings.battery_capacity, names, 8, NULL);
|
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
|
||||||
set_battery_capacity(global_settings.battery_capacity);
|
|
||||||
#endif /* SIMULATOR */
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CHARGE_CTRL
|
#ifdef HAVE_CHARGE_CTRL
|
||||||
static bool deep_discharge(void)
|
static bool deep_discharge(void)
|
||||||
|
@ -742,7 +731,9 @@ static bool system_settings_menu(void)
|
||||||
#ifdef HAVE_ATA_POWER_OFF
|
#ifdef HAVE_ATA_POWER_OFF
|
||||||
{ str(LANG_POWEROFF), poweroff },
|
{ str(LANG_POWEROFF), poweroff },
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef SIMULATOR
|
||||||
{ str(LANG_BATTERY_CAPACITY), battery_capacity },
|
{ str(LANG_BATTERY_CAPACITY), battery_capacity },
|
||||||
|
#endif
|
||||||
#ifdef HAVE_CHARGE_CTRL
|
#ifdef HAVE_CHARGE_CTRL
|
||||||
{ str(LANG_DISCHARGE), deep_discharge },
|
{ str(LANG_DISCHARGE), deep_discharge },
|
||||||
{ str(LANG_TRICKLE_CHARGE), trickle_charge },
|
{ str(LANG_TRICKLE_CHARGE), trickle_charge },
|
||||||
|
|
|
@ -73,9 +73,9 @@ int battery_capacity = 1500; /* only a default value */
|
||||||
|
|
||||||
void set_battery_capacity(int capacity)
|
void set_battery_capacity(int capacity)
|
||||||
{
|
{
|
||||||
int values[8] = {1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200};
|
battery_capacity = capacity;
|
||||||
|
if ((battery_capacity > BATTERY_CAPACITY_MAX) || (battery_capacity < 1500))
|
||||||
battery_capacity = values[capacity];
|
battery_capacity = 1500;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CHARGE_CTRL
|
#ifdef HAVE_CHARGE_CTRL
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#define BATTERY_LEVEL_FULL 585 /* 5.85V */
|
#define BATTERY_LEVEL_FULL 585 /* 5.85V */
|
||||||
|
|
||||||
#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_EMPTY)
|
#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_EMPTY)
|
||||||
|
#define BATTERY_CAPACITY_MAX 2400 /* max. capacity that can be selected in settings menu, min. is always 1500 */
|
||||||
|
|
||||||
#define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */
|
#define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */
|
||||||
#define POWER_AVG_N 4 /* how many samples to take for each measurement */
|
#define POWER_AVG_N 4 /* how many samples to take for each measurement */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue