mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
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:
@@ -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(¤t)) {
|
||||
if (battery_current(¤t) ||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user