diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-10-22 14:13:35 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-10-23 18:03:12 -0700 |
commit | 81d269dc004b6c7334e4e8eafbb2872e5b6fdcf1 (patch) | |
tree | 85829474533fddf3e030c2aa2c105bd621bb228d /include/lightbar.h | |
parent | 3fc374b7fd8b618d513db27d9f10c8200f603e15 (diff) | |
download | chrome-ec-81d269dc004b6c7334e4e8eafbb2872e5b6fdcf1.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
Diffstat (limited to 'include/lightbar.h')
-rw-r--r-- | include/lightbar.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/lightbar.h b/include/lightbar.h index 8648e3f3bd..61ee5a2a9d 100644 --- a/include/lightbar.h +++ b/include/lightbar.h @@ -38,17 +38,19 @@ enum lb_control { /* * For dimming the lightbar in the dark, we define an array to * describe the expected colors: - * if luminosity is more than 'lux', the color defined will be used. + * if luminosity is more than 'lux_up', the color defined will be used. + * if luminosity is more than 'lux_down', we will look at the next band. * The last entry must have lux == 0. * Defining brightness is not enough to prevent washed color in low * lux setting. */ struct lb_brightness_def { - uint16_t lux; + uint16_t lux_up; + uint16_t lux_down; struct rgb_s color[4]; }; -extern struct lb_brightness_def lb_brightness_levels[]; +extern const struct lb_brightness_def lb_brightness_levels[]; extern const unsigned lb_brightness_levels_count; #endif |