diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-10-22 14:13:35 -0700 |
---|---|---|
committer | ChromeOS bot <3su6n15k.default@developer.gserviceaccount.com> | 2015-10-29 06:21:35 +0000 |
commit | 544abdf839481599e7ab728d3eecd7c6d6738b35 (patch) | |
tree | c2e34c33b295685d6132ab4002092594edb7c020 /board | |
parent | 0329ccef7a20d2a2389262e01a6bf7fce961234e (diff) | |
download | chrome-ec-544abdf839481599e7ab728d3eecd7c6d6738b35.tar.gz |
common: lightbar: Add histeresis to prevent flickering
When ALS is enabled, if light is around one threshold (say 40 lux),
the lightbar will flicker between readings.
Add a histeresis to prevent the flickering.
The current setting is:
setting ^
(dim) 2 | ------+---->---+
1 | +----<---+--->---+
(bright) 0 | +---<---+---------
+-------+--------+-------+--------> lux
20 40 60
BRANCH=smaug
BUG=chrome-os-partner:44400
TEST=check in a dark room (30~40 lux) there is no flickering.
Add unit test.
Change-Id: I4018e2c2ed764abf9c9ed28e2d50a3e94a7d5f75
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308205
(cherry picked from commit 81d269dc004b6c7334e4e8eafbb2872e5b6fdcf1)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309594
Diffstat (limited to 'board')
-rw-r--r-- | board/ryu/board.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c index 29fe64b580..9265abdf62 100644 --- a/board/ryu/board.c +++ b/board/ryu/board.c @@ -674,10 +674,11 @@ struct motion_sensor_t motion_sensors[] = { }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); -struct lb_brightness_def lb_brightness_levels[] = { +const struct lb_brightness_def lb_brightness_levels[] = { { /* regular brightness */ - .lux = 40, + .lux_up = 60, + .lux_down = 40, .color = { {0x74, 0x58, 0xb4}, /* Segment0: Google blue */ {0xd6, 0x40, 0x20}, /* Segment1: Google red */ @@ -687,7 +688,8 @@ struct lb_brightness_def lb_brightness_levels[] = { }, { /* 25 - 50% brightness */ - .lux = 20, + .lux_up = 40, + .lux_down = 20, .color = { {0x51, 0x38, 0x7d}, {0x99, 0x28, 0x15}, @@ -697,7 +699,8 @@ struct lb_brightness_def lb_brightness_levels[] = { }, { /* 0 .. 25% brightness */ - .lux = 0, + .lux_up = 0, + .lux_down = 0, .color = { {0x3d, 0x28, 0x5c}, {0x71, 0x28, 0x10}, |