spring: Tweak battery LED policy

When battery is nearly full, we sometimes see:
  - Battery asks for no current, but slowly discharge (5-7 mA)
  - Battery asks for current, but not charging.
For these cases, we consider the battery full and show green LED.

BUG=chrome-os-partner:17561
TEST=Manual
BRANCH=none

Change-Id: I2808d4c1a89d37000244fb308197cdef473ec5be
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42688
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Vic Yang
2013-02-06 10:47:11 +08:00
committed by ChromeBot
parent e955c62792
commit e9c3b705d5

View File

@@ -301,6 +301,7 @@ int board_get_ac(void)
int board_battery_led(enum charging_state state)
{
int current;
int desired_current;
uint32_t color = LED_COLOR_RED;
/*
@@ -316,12 +317,13 @@ int board_battery_led(enum charging_state state)
color = LED_COLOR_YELLOW;
break;
case ST_CHARGING:
if (battery_desired_current(&current)) {
if (battery_current(&current) ||
battery_desired_current(&desired_current)) {
/* Cannot talk to the battery. Set LED to red. */
color = LED_COLOR_RED;
break;
}
if (current)
if (current && desired_current)
color = LED_COLOR_YELLOW;
else
color = LED_COLOR_GREEN;