summaryrefslogtreecommitdiff
path: root/apps/menus/main_menu.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-24 16:58:41 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-24 16:58:41 +0000
commit3157e1395674a930c74e2ef4cc4ce78dffea8569 (patch)
tree5b2a9befc3b051caf0806995ebd32a5ab3bcf5ff /apps/menus/main_menu.c
parent0f9729739f2fd90759c1caeca86e487c36f98834 (diff)
Simplify powermgmt thread loops so it calls functions turn (no more power_thread_sleep). Do other target-friendly simplifications, generic battery switch handling and split sim-specific code. Whoever can, please verify charging on the Archos Recorder (due to change in the charger duty cycle code).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19579 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menus/main_menu.c')
-rw-r--r--apps/menus/main_menu.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index 4c15b1de4b..b22824d8bd 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -27,6 +27,7 @@
#include "lang.h"
#include "action.h"
#include "settings.h"
+#include "power.h"
#include "powermgmt.h"
#include "menu.h"
#include "misc.h"
@@ -199,15 +200,14 @@ static char* info_getname(int selected_item, void *data,
if (charge_state == CHARGING)
return (char *)str(LANG_BATTERY_CHARGE);
else
-#if CONFIG_CHARGING == CHARGING_CONTROL
+#ifdef ARCHOS_RECORDER
if (charge_state == TOPOFF)
return (char *)str(LANG_BATTERY_TOPOFF_CHARGE);
- else
-#endif
- if (charge_state == TRICKLE)
+ else if (charge_state == TRICKLE)
return (char *)str(LANG_BATTERY_TRICKLE_CHARGE);
else
-#endif
+#endif /* ARCHOS_RECORDER */
+#endif /* CONFIG_CHARGING = */
if (battery_level() >= 0)
snprintf(buffer, buffer_len, (char *)str(LANG_BATTERY_TIME),
battery_level(), battery_time() / 60, battery_time() % 60);
@@ -282,22 +282,21 @@ static int info_speak_item(int selected_item, void * data)
}
case INFO_BATTERY: /* battery */
#if CONFIG_CHARGING == CHARGING_SIMPLE
- if (charger_input_state == CHARGER)
+ if (charger_inserted())
talk_id(LANG_BATTERY_CHARGE, true);
else
#elif CONFIG_CHARGING >= CHARGING_MONITOR
if (charge_state == CHARGING)
talk_id(LANG_BATTERY_CHARGE, true);
else
-#if CONFIG_CHARGING == CHARGING_CONTROL
+#ifdef ARCHOS_RECORDER
if (charge_state == TOPOFF)
talk_id(LANG_BATTERY_TOPOFF_CHARGE, true);
- else
-#endif
- if (charge_state == TRICKLE)
+ else if (charge_state == TRICKLE)
talk_id(LANG_BATTERY_TRICKLE_CHARGE, true);
else
-#endif
+#endif /* ARCHOS_RECORDER */
+#endif /* CONFIG_CHARGING = */
if (battery_level() >= 0)
{
talk_id(LANG_BATTERY_TIME, false);