diff options
author | Uwe Freese <thebreaker@rockbox.org> | 2002-12-16 22:58:48 +0000 |
---|---|---|
committer | Uwe Freese <thebreaker@rockbox.org> | 2002-12-16 22:58:48 +0000 |
commit | 0bf70e65e8b61fceb4b2833277b36ba3ad14fdbf (patch) | |
tree | 20e05355105f0bbbddef5a20a4cbbc7d01013364 /apps | |
parent | ae1ba1d5de779ff66d5a86bfb6c5326f3e902ac3 (diff) | |
download | rockbox-0bf70e65e8b61fceb4b2833277b36ba3ad14fdbf.tar.gz rockbox-0bf70e65e8b61fceb4b2833277b36ba3ad14fdbf.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings.c | 8 | ||||
-rw-r--r-- | apps/settings.h | 9 | ||||
-rw-r--r-- | apps/settings_menu.c | 25 |
3 files changed, 16 insertions, 26 deletions
diff --git a/apps/settings.c b/apps/settings.c index 64a1a8c0a2..9d0a9f62b3 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -126,6 +126,7 @@ modified unless the header & checksum test fails. | |||
126 | 126 | ||
127 | Rest of config block, only saved to disk: | 127 | Rest of config block, only saved to disk: |
128 | 128 | ||
129 | 0xB1 (int) battery capacity | ||
129 | 0xB5 scroll step in pixels | 130 | 0xB5 scroll step in pixels |
130 | 0xB6 scroll start and endpoint delay | 131 | 0xB6 scroll start and endpoint delay |
131 | 0xB7 bidir scroll setting (bidi if 0-200% longer than screen width) | 132 | 0xB7 bidir scroll setting (bidi if 0-200% longer than screen width) |
@@ -368,6 +369,7 @@ int settings_save( void ) | |||
368 | config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8); | 369 | config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8); |
369 | } | 370 | } |
370 | 371 | ||
372 | memcpy(&config_block[0xb1], &global_settings.battery_capacity, 4); | ||
371 | config_block[0xb5]=(unsigned char)global_settings.scroll_step; | 373 | config_block[0xb5]=(unsigned char)global_settings.scroll_step; |
372 | config_block[0xb6]=(unsigned char)global_settings.scroll_delay; | 374 | config_block[0xb6]=(unsigned char)global_settings.scroll_delay; |
373 | config_block[0xb7]=(unsigned char)global_settings.bidir_limit; | 375 | config_block[0xb7]=(unsigned char)global_settings.bidir_limit; |
@@ -466,6 +468,8 @@ void settings_apply(void) | |||
466 | enable_trickle_charge(global_settings.trickle_charge); | 468 | enable_trickle_charge(global_settings.trickle_charge); |
467 | #endif | 469 | #endif |
468 | 470 | ||
471 | set_battery_capacity(global_settings.battery_capacity); | ||
472 | |||
469 | #ifdef HAVE_LCD_BITMAP | 473 | #ifdef HAVE_LCD_BITMAP |
470 | settings_apply_pm_range(); | 474 | settings_apply_pm_range(); |
471 | peak_meter_init_times( | 475 | peak_meter_init_times( |
@@ -648,6 +652,8 @@ void settings_load(void) | |||
648 | global_settings.topruntime = | 652 | global_settings.topruntime = |
649 | config_block[0x28] | (config_block[0x29] << 8); | 653 | config_block[0x28] | (config_block[0x29] << 8); |
650 | 654 | ||
655 | memcpy(&global_settings.battery_capacity, &config_block[0xb1], 4); | ||
656 | |||
651 | if (config_block[0xb5] != 0xff) | 657 | if (config_block[0xb5] != 0xff) |
652 | global_settings.scroll_step = config_block[0xb5]; | 658 | global_settings.scroll_step = config_block[0xb5]; |
653 | 659 | ||
@@ -831,7 +837,7 @@ void settings_reset(void) { | |||
831 | global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; | 837 | global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; |
832 | global_settings.backlight_on_when_charging = | 838 | global_settings.backlight_on_when_charging = |
833 | DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING; | 839 | DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING; |
834 | global_settings.battery_capacity = 0; /* 1500 mAh */ | 840 | global_settings.battery_capacity = 1500; /* mAh */ |
835 | global_settings.trickle_charge = true; | 841 | global_settings.trickle_charge = true; |
836 | global_settings.dirfilter = SHOW_MUSIC; | 842 | global_settings.dirfilter = SHOW_MUSIC; |
837 | global_settings.sort_case = false; | 843 | global_settings.sort_case = false; |
diff --git a/apps/settings.h b/apps/settings.h index a2f7692d88..41f9b803c1 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -85,14 +85,7 @@ struct user_settings | |||
85 | bool backlight_on_when_charging; | 85 | bool backlight_on_when_charging; |
86 | bool discharge; /* maintain charge of at least: false = 85%, true = 10% */ | 86 | bool discharge; /* maintain charge of at least: false = 85%, true = 10% */ |
87 | bool trickle_charge; /* do trickle charging: 0=off, 1=on */ | 87 | bool trickle_charge; /* do trickle charging: 0=off, 1=on */ |
88 | int battery_capacity; /* 0 = 1500 mAh | 88 | int battery_capacity; /* in mAh */ |
89 | 1 = 1600 mAh | ||
90 | 2 = 1700 mAh | ||
91 | 3 = 1800 mAh | ||
92 | 4 = 1900 mAh | ||
93 | 5 = 2000 mAh | ||
94 | 6 = 2100 mAh | ||
95 | 7 = 2200 mAh */ | ||
96 | 89 | ||
97 | /* resume settings */ | 90 | /* resume settings */ |
98 | 91 | ||
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 9e7320eef6..94f6cc74ea 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -428,27 +428,16 @@ static bool bidir_limit(void) | |||
428 | } | 428 | } |
429 | #endif | 429 | #endif |
430 | 430 | ||
431 | #ifndef SIMULATOR | ||
431 | /** | 432 | /** |
432 | * Menu to set the battery capacity | 433 | * Menu to set the battery capacity |
433 | */ | 434 | */ |
434 | static bool battery_capacity(void) { | 435 | static bool battery_capacity(void) |
435 | bool retval = false; | 436 | { |
436 | 437 | return set_int(str(LANG_BATTERY_CAPACITY), " mAh", &global_settings.battery_capacity, | |
437 | char* names[] = { "1500 mAh ", "1600 mAh ", | 438 | &set_battery_capacity, 50, 1500, BATTERY_CAPACITY_MAX ); |
438 | "1700 mAh ", "1800 mAh ", | ||
439 | "1900 mAh ", "2000 mAh ", | ||
440 | "2100 mAh ", "2200 mAh " | ||
441 | }; | ||
442 | |||
443 | retval = set_option( str(LANG_BATTERY_CAPACITY), | ||
444 | &global_settings.battery_capacity, names, 8, NULL); | ||
445 | |||
446 | #ifndef SIMULATOR | ||
447 | set_battery_capacity(global_settings.battery_capacity); | ||
448 | #endif /* SIMULATOR */ | ||
449 | |||
450 | return retval; | ||
451 | } | 439 | } |
440 | #endif | ||
452 | 441 | ||
453 | #ifdef HAVE_CHARGE_CTRL | 442 | #ifdef HAVE_CHARGE_CTRL |
454 | static bool deep_discharge(void) | 443 | static bool deep_discharge(void) |
@@ -742,7 +731,9 @@ static bool system_settings_menu(void) | |||
742 | #ifdef HAVE_ATA_POWER_OFF | 731 | #ifdef HAVE_ATA_POWER_OFF |
743 | { str(LANG_POWEROFF), poweroff }, | 732 | { str(LANG_POWEROFF), poweroff }, |
744 | #endif | 733 | #endif |
734 | #ifndef SIMULATOR | ||
745 | { str(LANG_BATTERY_CAPACITY), battery_capacity }, | 735 | { str(LANG_BATTERY_CAPACITY), battery_capacity }, |
736 | #endif | ||
746 | #ifdef HAVE_CHARGE_CTRL | 737 | #ifdef HAVE_CHARGE_CTRL |
747 | { str(LANG_DISCHARGE), deep_discharge }, | 738 | { str(LANG_DISCHARGE), deep_discharge }, |
748 | { str(LANG_TRICKLE_CHARGE), trickle_charge }, | 739 | { str(LANG_TRICKLE_CHARGE), trickle_charge }, |