summaryrefslogtreecommitdiff
path: root/include/motion_sense.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-10-22 14:13:35 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-23 18:03:12 -0700
commit81d269dc004b6c7334e4e8eafbb2872e5b6fdcf1 (patch)
tree85829474533fddf3e030c2aa2c105bd621bb228d /include/motion_sense.h
parent3fc374b7fd8b618d513db27d9f10c8200f603e15 (diff)
downloadchrome-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/motion_sense.h')
-rw-r--r--include/motion_sense.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h
index ed24f232fd..aa4170b722 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -187,6 +187,11 @@ void motion_sense_fifo_add_unit(struct ec_response_motion_sensor_data *data,
#endif
#ifdef CONFIG_ALS_LIGHTBAR_DIMMING
+#ifdef TEST_BUILD
+#define MOTION_SENSE_LUX 0
+#else
#define MOTION_SENSE_LUX motion_sensors[CONFIG_ALS_LIGHTBAR_DIMMING].raw_xyz[0]
#endif
+#endif
+
#endif /* __CROS_EC_MOTION_SENSE_H */