summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
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 795bde69f8..6ef4d40390 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -2925,3 +2925,21 @@ desc: ID3 virtual folder name
2925eng: "Found %d matches" 2925eng: "Found %d matches"
2926voice: "" 2926voice: ""
2927new: 2927new:
2928
2929id: LANG_BATTERY_TYPE
2930desc: in battery settings
2931eng: "Battery type"
2932voice: "Battery type"
2933new:
2934
2935id: LANG_BATTERY_TYPE_ALKALINE
2936desc: in battery settings
2937eng: "Alkaline"
2938voice: "Alkaline"
2939new:
2940
2941id: LANG_BATTERY_TYPE_NIMH
2942desc: in battery settings
2943eng: "NiMH"
2944voice: "Nickel metal hydride"
2945new:
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
712static 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 */