diff options
author | Vic Yang <victoryang@chromium.org> | 2013-06-08 21:07:00 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-06-13 22:16:06 -0700 |
commit | 6a701c59576ace1c6a5d5f74ae661285b1773b97 (patch) | |
tree | 034439894c7a13eb8c7a9b997dd11de923affaf2 | |
parent | 1695760e95a9d86eb11ca239da28cfe48a142af8 (diff) | |
download | chrome-ec-6a701c59576ace1c6a5d5f74ae661285b1773b97.tar.gz |
spring: Show green LED when 94% charged
For Spring, we cannot rely on the battery current to decide if it's
fully charged. Therefore, we just use the battery charge level as the
sole indicator. The battery spec says it might stop charging when charge
level is 95%+, so we should show green LED when it reaches 94%.
Otherwise, show yellow LED.
BUG=chrome-os-partner:20017
TEST=Manual. Monitor the battery level and see LED turns green when it
goes from 93% to 94%.
BRANCH=spring
Change-Id: Ia525b2e89ebe36cc2ccce1ea0b798ba03be258a7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58059
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | common/lp5562_battery_led.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/lp5562_battery_led.c b/common/lp5562_battery_led.c index d8b9a628fd..fe33b7e7fb 100644 --- a/common/lp5562_battery_led.c +++ b/common/lp5562_battery_led.c @@ -15,6 +15,8 @@ #include "smart_battery.h" #include "util.h" +#define GREEN_LED_THRESHOLD 94 + /* We use yellow LED instead of blue LED. Re-map colors here. */ #define LED_COLOR_NONE LP5562_COLOR_NONE #define LED_COLOR_GREEN LP5562_COLOR_GREEN @@ -112,6 +114,7 @@ static void battery_led_update(void) int current; int desired_current; int rv; + int state_of_charge; enum led_state_t state = LED_STATE_OFF; /* Current states and next states */ @@ -152,7 +155,8 @@ static void battery_led_update(void) break; case ST_CHARGING: if (battery_current(¤t) || - battery_desired_current(&desired_current)) { + battery_desired_current(&desired_current) || + battery_state_of_charge(&state_of_charge)) { /* Cannot talk to the battery. Set LED to red. */ state = LED_STATE_SOLID_RED; break; @@ -164,7 +168,7 @@ static void battery_led_update(void) } /* If battery doesn't want any current, it's considered full. */ - if (desired_current) + if (state_of_charge < GREEN_LED_THRESHOLD) state = LED_STATE_SOLID_YELLOW; else state = LED_STATE_SOLID_GREEN; |