diff options
author | Zick Wei <zick.wei@quanta.corp-partner.google.com> | 2021-12-10 08:53:21 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-12-13 01:37:56 +0000 |
commit | 236074b9a6abdc468c97e197c4b563038144ef23 (patch) | |
tree | 1c6ab64384ee722edc8adff265a28eaaeec24053 | |
parent | 3af17c9a04585c0d465e708ca8766ddadc701da8 (diff) | |
download | chrome-ec-stabilize-14396.B-main.tar.gz |
nipperkin: update led behaviorstabilize-14396.B-main
Update LED behavior as below:
Battery < 10%: amber 1 second On, 1 second Off for each LED.
Battery error: amber 0.5 second On, 0.5 second Off for each LED.
BUG=b:209729573
BRANCH=none
TEST=verify LED behavior as intended.
Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
Change-Id: I45e7245530ae155b98150b951505305c2f1009aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3329181
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Rob Barnes <robbarnes@google.com>
-rw-r--r-- | board/nipperkin/led.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/board/nipperkin/led.c b/board/nipperkin/led.c index 59d03dbe83..93131400d2 100644 --- a/board/nipperkin/led.c +++ b/board/nipperkin/led.c @@ -167,18 +167,32 @@ static void led_set_battery(void) if (charge_get_percent() < 10) led_set_color_battery(LED_RIGHT_PORT, (battery_ticks % LED_TICKS_PER_CYCLE - < LED_ON_TICKS) ? LED_WHITE : LED_OFF); + < LED_ON_TICKS) ? LED_AMBER : LED_OFF); else led_set_color_battery(LED_RIGHT_PORT, LED_OFF); } - if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) - led_set_color_battery(LED_LEFT_PORT, LED_OFF); + if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { + if (charge_get_percent() < 10) + led_set_color_battery(LED_LEFT_PORT, + (battery_ticks % LED_TICKS_PER_CYCLE + < LED_ON_TICKS) ? LED_AMBER : LED_OFF); + else + led_set_color_battery(LED_LEFT_PORT, LED_OFF); + } break; case PWR_STATE_ERROR: - set_active_port_color((battery_ticks & 0x2) ? - LED_WHITE : LED_OFF); + if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { + led_set_color_battery(LED_RIGHT_PORT, + (battery_ticks & 0x1) ? LED_AMBER : LED_OFF); + } + + if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { + led_set_color_battery(LED_LEFT_PORT, + (battery_ticks & 0x1) ? LED_AMBER : LED_OFF); + } break; + case PWR_STATE_CHARGE_NEAR_FULL: set_active_port_color(LED_WHITE); break; |