diff options
author | Kenneth Lo <Kenneth_Lo@asus.com> | 2014-04-21 19:34:32 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-04-24 17:55:57 +0000 |
commit | d6e43a834e46e2769ba94afd09dc47892a8ef423 (patch) | |
tree | c21d4889f279c9c08122bf850220e295ea713787 | |
parent | 7de5089409f5b9c823d932fff2598e12644ec58f (diff) | |
download | chrome-ec-d6e43a834e46e2769ba94afd09dc47892a8ef423.tar.gz |
Quawks: Adjust charge thresholds for altering LED behavior
The EC and host have different ways of computing and presenting the
battery charge level. This change adjusts the charge levels at which
the charging LED indicates a full and low battery to match what is
presented to the user in the host UI.
(Ported from [4e470aa]Squawks: Adjust charge thresholds for altering LED
behavior)
BUG=chrome-os-partner:27449
BRANCH=rambi
TEST=Run "battfake 91" which charging, verify charging LED turns green
and the UI reports 96%.
Run "battfake 90" which charging, verify charging LED turns orange
and the UI reports 94%.
Run "battfake 13" while discharging, verify charging LED blinks
amber (1 sec on, 1 sec off) and the UI reports 10%.
Change-Id: Ib89dc4750fc4af91d0a7e706fa8c76c21823dfe8
Signed-off-by: Kenneth Lo <Kenneth_Lo@asus.com>
Reviewed-on: https://chromium-review.googlesource.com/196156
Reviewed-by: Charles Yu <charles.yu@intel.com>
Reviewed-by: Dave Parker <dparker@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
-rw-r--r-- | board/quawks/led.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/board/quawks/led.c b/board/quawks/led.c index 4047634d4f..7fbaf69cce 100644 --- a/board/quawks/led.c +++ b/board/quawks/led.c @@ -130,9 +130,12 @@ static enum led_color new_battery_led_color(void) (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)) return (ticks & 0x4) ? LED_GREEN : LED_OFF; - /* If the system is charging, orange under 95%; green if over */ + /* + * If the system is charging, orange; green if 95% or over. + * Subtract 4% to compensate for how the UI reports charge remaining. + */ if (chstate == PWR_STATE_CHARGE) - return charge_get_percent() < 95 ? LED_ORANGE : LED_GREEN; + return charge_get_percent() < 91 ? LED_ORANGE : LED_GREEN; /* If AC connected and fully charged (or close to it), solid green */ if (chstate == PWR_STATE_CHARGE_NEAR_FULL || @@ -140,9 +143,13 @@ static enum led_color new_battery_led_color(void) return LED_GREEN; } - /* Otherwise, discharging; flash orange if less than 10% power */ - if (charge_get_percent() < 10) - return (ticks % 8 < 2) ? LED_ORANGE : LED_OFF; + /* + * Otherwise, discharging; flash orange if 10% or less power, 50% + * duty cycle, 2 sec period. Adding 4% bias to compensate for how + * the UI reports charge remaining. + */ + if (charge_get_percent() < 14) + return (ticks & 0x4) ? LED_ORANGE : LED_OFF; /* Discharging and greater than 10% power, so off */ return LED_OFF; |