summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-09-01 23:49:28 +0000
committerThomas Martitz <kugel@rockbox.org>2010-09-01 23:49:28 +0000
commit24424bab2ae1a7a781b727a94501a75eaa218c56 (patch)
treef76e447932ae3407b36c4a0fc5b76cd9036e980c
parent8ec51135b6733491e4980925a919e926609674fe (diff)
downloadrockbox-24424bab2ae1a7a781b727a94501a75eaa218c56.tar.gz
rockbox-24424bab2ae1a7a781b727a94501a75eaa218c56.tar.bz2
rockbox-24424bab2ae1a7a781b727a94501a75eaa218c56.zip
Fix reds. The battery_capacity setting is used even for fixed-battery targets.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27976 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/menus/settings_menu.c2
-rw-r--r--apps/settings.c1
-rw-r--r--apps/settings.h2
-rw-r--r--apps/settings_list.c10
4 files changed, 12 insertions, 3 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index f619bb7db7..b49a8a813d 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -156,7 +156,7 @@ static int usbcharging_callback(int action,const struct menu_item_ex *this_item)
MENUITEM_SETTING(usb_charging, &global_settings.usb_charging, usbcharging_callback);
#endif /* HAVE_USB_CHARGING_ENABLE */
MAKE_MENU(battery_menu, ID2P(LANG_BATTERY_MENU), 0, Icon_NOICON,
-#if BATTERY_CAPACITY_INC > 0
+#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
&battery_capacity,
#endif
#if BATTERY_TYPES_COUNT > 1
diff --git a/apps/settings.c b/apps/settings.c
index e9f0dc9330..3b12274eae 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -853,6 +853,7 @@ void settings_apply(bool read_disk)
set_poweroff_timeout(global_settings.poweroff);
#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
+ /* only call if it's really exchangable */
set_battery_capacity(global_settings.battery_capacity);
#endif
diff --git a/apps/settings.h b/apps/settings.h
index 3ba8fe9868..24ff9ef62a 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -619,7 +619,7 @@ struct user_settings
/* power settings */
int poweroff; /* idle power off timer */
-#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
+#ifdef BATTERY_CAPACITY_DEFAULT
int battery_capacity; /* in mAh */
#endif
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 5a9eeb90ce..7dfa62e105 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -763,7 +763,15 @@ const struct settings_list settings[] = {
#endif
"max files in dir", UNIT_INT, 50, 10000, 50,
NULL, NULL, NULL),
-#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
+/* use this setting for user code even if there's no exchangable battery
+ * support enabled */
+#ifdef BATTERY_CAPACITY_DEFAULT
+/* define min/max/inc for this file if there's only one battery */
+#ifndef BATTERY_CAPACITY_MIN
+#define BATTERY_CAPACITY_MIN BATTERY_CAPACITY_DEFAULT
+#define BATTERY_CAPACITY_MAX BATTERY_CAPACITY_DEFAULT
+#define BATTERY_CAPACITY_INC 0
+#endif
INT_SETTING(0, battery_capacity, LANG_BATTERY_CAPACITY,
BATTERY_CAPACITY_DEFAULT, "battery capacity", UNIT_MAH,
BATTERY_CAPACITY_MIN, BATTERY_CAPACITY_MAX,