From 3157e1395674a930c74e2ef4cc4ce78dffea8569 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 24 Dec 2008 16:58:41 +0000 Subject: 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 --- apps/menus/main_menu.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'apps/menus/main_menu.c') 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); -- cgit v1.2.3