summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2018-07-30 14:35:44 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-07-31 16:37:15 -0700
commit10aa31c7bf2a6a9637a6c2a286df992b8510a4ba (patch)
tree32798318dd1ed350c2d8932dfbddb099fbc035e6 /common
parent9f289643563800dd2a07fe022f26614a64bbfbc2 (diff)
downloadchrome-ec-10aa31c7bf2a6a9637a6c2a286df992b8510a4ba.tar.gz
led_pwm: Turn off LEDs when not pulsing.
This commit fixes a bug where sometimes if the EC was showing battery error LED lights, one side would remain lit with the error condition. This is because it's possible that the EC decided not to pulse the LEDs anymore while in the "on" period. That coupled with showing the charging state on the active charge only, would mean that until an unplug happened, the other LED could remain lit. BUG=None BRANCH=None TEST=Flash nocturne; cutoff battery, plug AC in, verify that only the charge port LED is on. Change-Id: I3cf09d31749bc783b1507045e58b8b97968bae4b Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/1155763 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/led_pwm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/led_pwm.c b/common/led_pwm.c
index 3faa92cafe..90c22c5202 100644
--- a/common/led_pwm.c
+++ b/common/led_pwm.c
@@ -111,6 +111,12 @@ static void pulse_leds_deferred(void)
if (!led_is_pulsing) {
tick_count = 0;
+ /*
+ * Since we're not pulsing anymore, turn the colors off in case
+ * we were in the "on" time.
+ */
+ set_led_color(-1);
+ /* Then show the desired state. */
update_leds();
return;
}