summaryrefslogtreecommitdiff
path: root/apps/menus
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2009-01-28 20:53:50 +0000
committerMichael Sevakis <jethead71@rockbox.org>2009-01-28 20:53:50 +0000
commit4118de4cc87246360cc36a77069460b015cfb21b (patch)
tree205d9425934bd85350a99a9c29849ed3e9f22016 /apps/menus
parent76ba8ec8903f0ee3f9c7a3548e35acf8f209f8ab (diff)
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
Diffstat (limited to 'apps/menus')
-rw-r--r--apps/menus/main_menu.c34
1 files changed, 27 insertions, 7 deletions
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),