summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-09-01 23:36:15 +0000
committerThomas Martitz <kugel@rockbox.org>2010-09-01 23:36:15 +0000
commitf05cdc46f23bf28d31dfc4fc2ebe4d20e4d6f961 (patch)
tree26fb9244e04ffd4297cb918ae8c7de2b731dd28a /apps
parentc00fbc4d06dee2f075e8bb1671350c3079c992bf (diff)
downloadrockbox-f05cdc46f23bf28d31dfc4fc2ebe4d20e4d6f961.tar.gz
rockbox-f05cdc46f23bf28d31dfc4fc2ebe4d20e4d6f961.zip
Android: don't compile powermgmt-sim.c
Instead implement a bit of battery monitoring. Currently it only fetches the battery level (in %) every 30s, but it could do more like battery status, charger connected, voltage... Theoretically, we could also exit/quit after some time of inactivity too (perhaps not a bad idea since Rockbox puts a slight but still non-zero CPU load even if doing nothing). Ironically, Rockbox is now the only way to get the exact battery level (at least I haven't found anything yet) on my phone :-) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27974 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/settings.c3
-rw-r--r--apps/settings.h2
-rw-r--r--apps/settings_list.c2
3 files changed, 6 insertions, 1 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 3a851df0ff..e9f0dc9330 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -852,7 +852,10 @@ void settings_apply(bool read_disk)
#endif
set_poweroff_timeout(global_settings.poweroff);
+#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
set_battery_capacity(global_settings.battery_capacity);
+#endif
+
#if BATTERY_TYPES_COUNT > 1
set_battery_type(global_settings.battery_type);
#endif
diff --git a/apps/settings.h b/apps/settings.h
index 7deb2def41..3ba8fe9868 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -619,7 +619,9 @@ struct user_settings
/* power settings */
int poweroff; /* idle power off timer */
+#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
int battery_capacity; /* in mAh */
+#endif
#if BATTERY_TYPES_COUNT > 1
int battery_type; /* for units which can take multiple types (Ondio). */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index cab326671a..5a9eeb90ce 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -763,7 +763,7 @@ const struct settings_list settings[] = {
#endif
"max files in dir", UNIT_INT, 50, 10000, 50,
NULL, NULL, NULL),
-#if BATTERY_CAPACITY_INC > 0
+#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
INT_SETTING(0, battery_capacity, LANG_BATTERY_CAPACITY,
BATTERY_CAPACITY_DEFAULT, "battery capacity", UNIT_MAH,
BATTERY_CAPACITY_MIN, BATTERY_CAPACITY_MAX,