From 69f88a5c352ddfcca314560b0bffb8baffdc313a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Doyon?= Date: Sat, 3 Nov 2007 04:13:25 +0000 Subject: [PATCH] Info screen: charging and battery. For CHARGING_SIMPLE: if the charger is inserted, then indicate that the battery is charging, and do not show the battery level (which should be bogus anyway). This is the only place the charger status is reported for blind users. Allow reporting charge_state for CHARGING_MONITOR: the header file says it could be CHARGING or TRICKLE. Hope this is right. Interestingly, that's how the #ifdefs were for the voice part. Have the voice match the displayed info. In particular do not report battery level when in a charging state. Use the new talk time unit for the battery remaining duration. If battery_level() is 0 and no info is available, then say "blank" instead of nothing. LANG_BATTERY_CHARGE: more verbose voice entry. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15419 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 2 +- apps/menus/main_menu.c | 35 ++++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 97111a1a7c..91fb2905dd 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -8654,7 +8654,7 @@ *: none - charging: "Charging" + charging: "Battery: Charging" diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 0a86d1f514..ddc2689263 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -204,7 +204,11 @@ static char* info_getname(int selected_item, void *data, char *buffer) } break; case INFO_BATTERY: /* battery */ -#if CONFIG_CHARGING == CHARGING_CONTROL +#if CONFIG_CHARGING == CHARGING_SIMPLE + if (charger_input_state == CHARGER) + snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE)); + else +#elif CONFIG_CHARGING >= CHARGING_MONITOR if (charge_state == CHARGING) snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE)); else if (charge_state == TOPOFF) @@ -284,25 +288,26 @@ static int info_speak_item(int selected_item, void * data) break; } case INFO_BATTERY: /* battery */ +#if CONFIG_CHARGING == CHARGING_SIMPLE + if (charger_input_state == CHARGER) + talk_id(LANG_BATTERY_CHARGE, true); + else +#elif CONFIG_CHARGING >= CHARGING_MONITOR + if (charge_state == CHARGING) + talk_id(LANG_BATTERY_CHARGE, true); + 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 +#endif if (battery_level() >= 0) { talk_id(LANG_BATTERY_TIME, false); talk_value(battery_level(), UNIT_PERCENT, true); - if(battery_time () / 60 > 0) - talk_value(battery_time () / 60, UNIT_INT, true); - if(battery_time () % 60 > 0) - talk_value(battery_time () % 60, UNIT_INT, true); -#if CONFIG_CHARGING >= CHARGING_MONITOR - if (charge_state == CHARGING) - talk_id(LANG_BATTERY_CHARGE, true); -#if CONFIG_CHARGING == CHARGING_CONTROL - else if (charge_state == TOPOFF) - talk_id(LANG_BATTERY_TOPOFF_CHARGE, true); -#endif - else if (charge_state == TRICKLE) - talk_id(LANG_BATTERY_TRICKLE_CHARGE, true); -#endif + talk_value(battery_time() *60, UNIT_TIME, true); } + else talk_id(VOICE_BLANK, false); break; case INFO_DISK1: /* disk 1 */ #ifdef HAVE_MULTIVOLUME