summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-02-23 14:24:36 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-25 03:32:56 +0000
commit301be83e339f0ec191c1751c650f0f25918afd10 (patch)
treeaf34c5b7bb8785edb8775591a0cb4b561b3d577b
parentf6cff1fa6bead660a12222615f84f3f930a5e6f2 (diff)
downloadchrome-ec-301be83e339f0ec191c1751c650f0f25918afd10.tar.gz
lightbar: make tap red threshold match low battery threshold
Make tap for battery red threshold match the low battery red threshold. BUG=chrome-os-partner:36811 BRANCH=samus TEST=use a fake battery console command to change battery percentage on samus and make sure that the same level at which lightbar turns red in S0 is the same level at which tap for battery shows red. Change-Id: I084c8412beac4f5b311eb30f46f4f3273e9f2456 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/252351 Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--common/lightbar.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/lightbar.c b/common/lightbar.c
index 662c75a787..f99e87f589 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -84,6 +84,7 @@ static const struct lightbar_params_v1 default_params = {
.tap_gate_delay = 200 * MSEC, /* segment gating delay */
.tap_display_time = 3 * SECOND, /* total sequence time */
+ /* TODO (crosbug.com/p/36996): remove unused tap_pct_red */
.tap_pct_red = 14, /* below this is red */
.tap_pct_green = 94, /* above this is green */
.tap_seg_min_on = 35, /* min intensity (%) for "on" */
@@ -903,7 +904,7 @@ static uint32_t sequence_TAP_inner(int dir)
while (1) {
get_battery_level();
- if (st.battery_percent < st.p.tap_pct_red)
+ if (st.battery_level == 0)
base_color = RED;
else if (st.battery_percent > st.p.tap_pct_green)
base_color = GREEN;
@@ -931,7 +932,7 @@ static uint32_t sequence_TAP_inner(int dir)
switch (base_color) {
case RED:
f_power = range(st.battery_percent, 0,
- st.p.tap_pct_red - 1);
+ st.p.battery_threshold[0] - 1);
break;
case YELLOW:
f_power = range(st.battery_percent,