diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-01-30 16:25:46 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-01-30 16:25:46 +0000 |
commit | 91846a1a8d94dc8c7540efe3bbc8216f6ded7cb2 (patch) | |
tree | 8a8f0c328495e0631e568c1bdbe7c151e2590190 /apps | |
parent | 8a77317e9c7c708153d8547bfccc3b4ef2324e3c (diff) | |
download | rockbox-91846a1a8d94dc8c7540efe3bbc8216f6ded7cb2.tar.gz rockbox-91846a1a8d94dc8c7540efe3bbc8216f6ded7cb2.zip |
New Ondio feature: Battery type setting, for correct battery level display.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5717 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 18 | ||||
-rw-r--r-- | apps/settings.c | 7 | ||||
-rw-r--r-- | apps/settings.h | 1 | ||||
-rw-r--r-- | apps/settings_menu.c | 16 |
4 files changed, 42 insertions, 0 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 795bde69f8..6ef4d40390 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -2925,3 +2925,21 @@ desc: ID3 virtual folder name | |||
2925 | eng: "Found %d matches" | 2925 | eng: "Found %d matches" |
2926 | voice: "" | 2926 | voice: "" |
2927 | new: | 2927 | new: |
2928 | |||
2929 | id: LANG_BATTERY_TYPE | ||
2930 | desc: in battery settings | ||
2931 | eng: "Battery type" | ||
2932 | voice: "Battery type" | ||
2933 | new: | ||
2934 | |||
2935 | id: LANG_BATTERY_TYPE_ALKALINE | ||
2936 | desc: in battery settings | ||
2937 | eng: "Alkaline" | ||
2938 | voice: "Alkaline" | ||
2939 | new: | ||
2940 | |||
2941 | id: LANG_BATTERY_TYPE_NIMH | ||
2942 | desc: in battery settings | ||
2943 | eng: "NiMH" | ||
2944 | voice: "Nickel metal hydride" | ||
2945 | new: | ||
diff --git a/apps/settings.c b/apps/settings.c index de4254edad..e16d546bb6 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -235,6 +235,10 @@ static const struct bit_entry rtc_bits[] = | |||
235 | /* new stuff to be added here */ | 235 | /* new stuff to be added here */ |
236 | /* If values are just added to the end, no need to bump the version. */ | 236 | /* If values are just added to the end, no need to bump the version. */ |
237 | 237 | ||
238 | #if BATTERY_TYPES_COUNT > 1 | ||
239 | {1, S_O(battery_type), 0, "battery type", "alkaline,nimh" }, | ||
240 | #endif | ||
241 | |||
238 | /* Current sum of bits: 259 (worst case) */ | 242 | /* Current sum of bits: 259 (worst case) */ |
239 | /* Sum of all bit sizes must not grow beyond 288! */ | 243 | /* Sum of all bit sizes must not grow beyond 288! */ |
240 | }; | 244 | }; |
@@ -759,6 +763,9 @@ void settings_apply(void) | |||
759 | #endif | 763 | #endif |
760 | 764 | ||
761 | set_battery_capacity(global_settings.battery_capacity); | 765 | set_battery_capacity(global_settings.battery_capacity); |
766 | #if BATTERY_TYPES_COUNT > 1 | ||
767 | set_battery_type(global_settings.battery_type); | ||
768 | #endif | ||
762 | 769 | ||
763 | #ifdef HAVE_LCD_BITMAP | 770 | #ifdef HAVE_LCD_BITMAP |
764 | lcd_set_invert_display(global_settings.invert); | 771 | lcd_set_invert_display(global_settings.invert); |
diff --git a/apps/settings.h b/apps/settings.h index b28f4cedea..8a12b2623c 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -185,6 +185,7 @@ struct user_settings | |||
185 | bool discharge; /* maintain charge of at least: false = 85%, true = 10% */ | 185 | bool discharge; /* maintain charge of at least: false = 85%, true = 10% */ |
186 | bool trickle_charge; /* do trickle charging: 0=off, 1=on */ | 186 | bool trickle_charge; /* do trickle charging: 0=off, 1=on */ |
187 | int battery_capacity; /* in mAh */ | 187 | int battery_capacity; /* in mAh */ |
188 | int battery_type; /* for units which can take multiple types (Ondio). */ | ||
188 | 189 | ||
189 | /* resume settings */ | 190 | /* resume settings */ |
190 | 191 | ||
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 63f1415af8..b19f2eda3c 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -707,6 +707,19 @@ static bool battery_capacity(void) | |||
707 | &set_battery_capacity, 50, BATTERY_CAPACITY_MIN, | 707 | &set_battery_capacity, 50, BATTERY_CAPACITY_MIN, |
708 | BATTERY_CAPACITY_MAX ); | 708 | BATTERY_CAPACITY_MAX ); |
709 | } | 709 | } |
710 | |||
711 | #if BATTERY_TYPES_COUNT > 1 | ||
712 | static bool battery_type(void) | ||
713 | { | ||
714 | static const struct opt_items names[] = { | ||
715 | { STR(LANG_BATTERY_TYPE_ALKALINE) }, | ||
716 | { STR(LANG_BATTERY_TYPE_NIMH) } | ||
717 | }; | ||
718 | |||
719 | return set_option(str(LANG_BATTERY_TYPE), &global_settings.battery_type, | ||
720 | INT, names, 2, set_battery_type); | ||
721 | } | ||
722 | #endif | ||
710 | #endif | 723 | #endif |
711 | 724 | ||
712 | #ifdef HAVE_CHARGE_CTRL | 725 | #ifdef HAVE_CHARGE_CTRL |
@@ -1250,6 +1263,9 @@ static bool battery_settings_menu(void) | |||
1250 | #endif | 1263 | #endif |
1251 | #ifndef SIMULATOR | 1264 | #ifndef SIMULATOR |
1252 | { ID2P(LANG_BATTERY_CAPACITY), battery_capacity }, | 1265 | { ID2P(LANG_BATTERY_CAPACITY), battery_capacity }, |
1266 | #if BATTERY_TYPES_COUNT > 1 | ||
1267 | { ID2P(LANG_BATTERY_TYPE), battery_type }, | ||
1268 | #endif | ||
1253 | #else | 1269 | #else |
1254 | #ifndef HAVE_CHARGE_CTRL | 1270 | #ifndef HAVE_CHARGE_CTRL |
1255 | { "Dummy", NULL }, /* to have an entry at all, in the simulator */ | 1271 | { "Dummy", NULL }, /* to have an entry at all, in the simulator */ |