summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-01-30 16:25:46 +0000
committerJens Arnold <amiconn@rockbox.org>2005-01-30 16:25:46 +0000
commit91846a1a8d94dc8c7540efe3bbc8216f6ded7cb2 (patch)
tree8a8f0c328495e0631e568c1bdbe7c151e2590190 /apps
parent8a77317e9c7c708153d8547bfccc3b4ef2324e3c (diff)
downloadrockbox-91846a1a8d94dc8c7540efe3bbc8216f6ded7cb2.zip
rockbox-91846a1a8d94dc8c7540efe3bbc8216f6ded7cb2.tar.gz
rockbox-91846a1a8d94dc8c7540efe3bbc8216f6ded7cb2.tar.bz2
rockbox-91846a1a8d94dc8c7540efe3bbc8216f6ded7cb2.tar.xz
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.lang18
-rw-r--r--apps/settings.c7
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_menu.c16
4 files changed, 42 insertions, 0 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 795bde6..6ef4d40 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -2925,3 +2925,21 @@ desc: ID3 virtual folder name
eng: "Found %d matches"
voice: ""
new:
+
+id: LANG_BATTERY_TYPE
+desc: in battery settings
+eng: "Battery type"
+voice: "Battery type"
+new:
+
+id: LANG_BATTERY_TYPE_ALKALINE
+desc: in battery settings
+eng: "Alkaline"
+voice: "Alkaline"
+new:
+
+id: LANG_BATTERY_TYPE_NIMH
+desc: in battery settings
+eng: "NiMH"
+voice: "Nickel metal hydride"
+new:
diff --git a/apps/settings.c b/apps/settings.c
index de4254e..e16d546 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -235,6 +235,10 @@ static const struct bit_entry rtc_bits[] =
/* new stuff to be added here */
/* If values are just added to the end, no need to bump the version. */
+#if BATTERY_TYPES_COUNT > 1
+ {1, S_O(battery_type), 0, "battery type", "alkaline,nimh" },
+#endif
+
/* Current sum of bits: 259 (worst case) */
/* Sum of all bit sizes must not grow beyond 288! */
};
@@ -759,6 +763,9 @@ void settings_apply(void)
#endif
set_battery_capacity(global_settings.battery_capacity);
+#if BATTERY_TYPES_COUNT > 1
+ set_battery_type(global_settings.battery_type);
+#endif
#ifdef HAVE_LCD_BITMAP
lcd_set_invert_display(global_settings.invert);
diff --git a/apps/settings.h b/apps/settings.h
index b28f4ce..8a12b26 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -185,6 +185,7 @@ struct user_settings
bool discharge; /* maintain charge of at least: false = 85%, true = 10% */
bool trickle_charge; /* do trickle charging: 0=off, 1=on */
int battery_capacity; /* in mAh */
+ int battery_type; /* for units which can take multiple types (Ondio). */
/* resume settings */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 63f1415..b19f2ed 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -707,6 +707,19 @@ static bool battery_capacity(void)
&set_battery_capacity, 50, BATTERY_CAPACITY_MIN,
BATTERY_CAPACITY_MAX );
}
+
+#if BATTERY_TYPES_COUNT > 1
+static bool battery_type(void)
+{
+ static const struct opt_items names[] = {
+ { STR(LANG_BATTERY_TYPE_ALKALINE) },
+ { STR(LANG_BATTERY_TYPE_NIMH) }
+ };
+
+ return set_option(str(LANG_BATTERY_TYPE), &global_settings.battery_type,
+ INT, names, 2, set_battery_type);
+}
+#endif
#endif
#ifdef HAVE_CHARGE_CTRL
@@ -1250,6 +1263,9 @@ static bool battery_settings_menu(void)
#endif
#ifndef SIMULATOR
{ ID2P(LANG_BATTERY_CAPACITY), battery_capacity },
+#if BATTERY_TYPES_COUNT > 1
+ { ID2P(LANG_BATTERY_TYPE), battery_type },
+#endif
#else
#ifndef HAVE_CHARGE_CTRL
{ "Dummy", NULL }, /* to have an entry at all, in the simulator */