diff options
author | Jimmy Lin <jimmy.lin@quantatw.com> | 2014-07-10 14:43:09 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-07-10 16:21:22 +0000 |
commit | c5a86fe518e24b7abe6cfb5b969fbe9a241fdf16 (patch) | |
tree | 26c4483cd9aae8a43099e671d42e834dfba9f6eb | |
parent | f3845025c3234be951ab733b398d46acc4a1d44f (diff) | |
download | chrome-ec-c5a86fe518e24b7abe6cfb5b969fbe9a241fdf16.tar.gz |
Gnawty: Change battery LED to flash orange when battery low
BUG=chrome-os-partner:29937
BRANCH=gnawty
TEST=manual
Low Battery Case:
To config Battery LED blinks orange during low Battery(=<13%),
Check battery LED show amber directly when plugging in adpater.
Critical Battery Case:
To config Battery LED blinks orange during Critical Battery(=<7%),
Check battery LED show amber directly when plugging in adpater.
Battery full Case:
To config Battery LED blinks full during Battery near full(=>95%),
Check battery LED show blue directly when plugging in adpater.
Change-Id: I6bcb205c48508b05f460d87511c85d3dec002dd5
Signed-off-by: Jimmy Lin <jimmy.Lin@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/207304
Reviewed-by: Dave Parker <dparker@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
-rw-r--r-- | board/gnawty/board.h | 3 | ||||
-rw-r--r-- | board/gnawty/led.c | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/board/gnawty/board.h b/board/gnawty/board.h index 16a1b603a3..ba7c75f01b 100644 --- a/board/gnawty/board.h +++ b/board/gnawty/board.h @@ -11,6 +11,9 @@ /* Optional features */ #define CONFIG_AP_HANG_DETECT #define CONFIG_BACKLIGHT_LID +#define CONFIG_BATTERY_LEVEL_CRITICAL 7 +#define CONFIG_BATTERY_LEVEL_LOW 13 +#define CONFIG_BATTERY_LEVEL_NEAR_FULL 95 #define CONFIG_BATTERY_SMART #define CONFIG_BOARD_VERSION #define CONFIG_CHARGER diff --git a/board/gnawty/led.c b/board/gnawty/led.c index e83cea319a..aefdeb9f95 100644 --- a/board/gnawty/led.c +++ b/board/gnawty/led.c @@ -12,6 +12,7 @@ #include "led_common.h" #include "pwm.h" #include "util.h" +#include "extpower.h" const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED , EC_LED_ID_POWER_LED}; @@ -146,16 +147,18 @@ static void battery_led(void) /* If Battery critical Low, blink orange, 50% duty cycle, * 2 sec period. */ - if (batt.state_of_charge <= BATTERY_LEVEL_CRITICAL) { + if (!extpower_is_present() && chipset_in_state(CHIPSET_STATE_ON) && + (batt.state_of_charge <= CONFIG_BATTERY_LEVEL_CRITICAL)) { set_color_battery_led((battery_ticks & 0x4) ? - LED_ORANGE : LED_OFF); + LED_ORANGE : LED_OFF); return; } /* If Battery Low, blink orange, 25% duty cycle, 4 sec period */ - if (batt.state_of_charge <= BATTERY_LEVEL_LOW) { + if (!extpower_is_present() && chipset_in_state(CHIPSET_STATE_ON) && + (batt.state_of_charge <= CONFIG_BATTERY_LEVEL_LOW)) { set_color_battery_led((battery_ticks % 16) < 4 ? - LED_ORANGE : LED_OFF); + LED_ORANGE : LED_OFF); return; } |