From 4118de4cc87246360cc36a77069460b015cfb21b Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 28 Jan 2009 20:53:50 +0000 Subject: Make sure 'Battery: Charging' is displayed in the info screen when charging no matter the algorithm (Archos Recorder still specially handled). Have screen refresh itself at 1HZ if CONFIG_CHARGING. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19872 a1c6a512-1295-4272-9138-f99709370657 --- apps/menus/main_menu.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'apps/menus') diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index fc4d3e45e9..598373116e 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -194,19 +194,25 @@ static char* info_getname(int selected_item, void *data, break; case INFO_BATTERY: /* battery */ #if CONFIG_CHARGING == CHARGING_SIMPLE - if (charger_input_state == CHARGER) + /* Only know if plugged */ + if (charger_inserted()) return (char *)str(LANG_BATTERY_CHARGE); else #elif CONFIG_CHARGING >= CHARGING_MONITOR +#ifdef ARCHOS_RECORDER + /* Report the particular algorithm state */ if (charge_state == CHARGING) return (char *)str(LANG_BATTERY_CHARGE); - else -#ifdef ARCHOS_RECORDER - if (charge_state == TOPOFF) + else if (charge_state == TOPOFF) return (char *)str(LANG_BATTERY_TOPOFF_CHARGE); else if (charge_state == TRICKLE) return (char *)str(LANG_BATTERY_TRICKLE_CHARGE); else +#else /* !ARCHOS_RECORDER */ + /* Go by what power management reports */ + if (charging_state()) + return (char *)str(LANG_BATTERY_CHARGE); + else #endif /* ARCHOS_RECORDER */ #endif /* CONFIG_CHARGING = */ if (battery_level() >= 0) @@ -283,19 +289,25 @@ static int info_speak_item(int selected_item, void * data) } case INFO_BATTERY: /* battery */ #if CONFIG_CHARGING == CHARGING_SIMPLE + /* Only know if plugged */ if (charger_inserted()) talk_id(LANG_BATTERY_CHARGE, true); else #elif CONFIG_CHARGING >= CHARGING_MONITOR +#ifdef ARCHOS_RECORDER + /* Report the particular algorithm state */ if (charge_state == CHARGING) talk_id(LANG_BATTERY_CHARGE, true); - else -#ifdef ARCHOS_RECORDER - if (charge_state == TOPOFF) + else if (charge_state == TOPOFF) talk_id(LANG_BATTERY_TOPOFF_CHARGE, true); else if (charge_state == TRICKLE) talk_id(LANG_BATTERY_TRICKLE_CHARGE, true); else +#else /* !ARCHOS_RECORDER */ + /* Go by what power management reports */ + if (charging_state()) + talk_id(LANG_BATTERY_CHARGE, true); + else #endif /* ARCHOS_RECORDER */ #endif /* CONFIG_CHARGING = */ if (battery_level() >= 0) @@ -354,6 +366,11 @@ static int info_speak_item(int selected_item, void * data) static int info_action_callback(int action, struct gui_synclist *lists) { +#if CONFIG_CHARGING + if (action == ACTION_NONE) + return ACTION_REDRAW; + else +#endif if (action == ACTION_STD_CANCEL) return action; else if ((action == ACTION_STD_OK) @@ -394,6 +411,9 @@ static bool show_info(void) if(global_settings.talk_menu) info.get_talk = info_speak_item; info.action_callback = info_action_callback; +#if CONFIG_CHARGING + info.timeout = HZ; +#endif return simplelist_show_list(&info); } MENUITEM_FUNCTION(show_info_item, 0, ID2P(LANG_ROCKBOX_INFO), -- cgit v1.2.3