diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2021-09-30 20:19:16 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-07 18:33:44 +0000 |
commit | bbbea469ac3c39c2386b45996dd9b406031ffc7a (patch) | |
tree | ce6e799dba30399c33cee520f9ff08db09811d99 | |
parent | 250df165737c43506b74cbe18e5a88416a2a8302 (diff) | |
download | chrome-ec-bbbea469ac3c39c2386b45996dd9b406031ffc7a.tar.gz |
driver: als_bh1730: Set last_value
|last_value| was never set, so sensor would send same data and never
send measurement of 0 lux.
BUG=b:201719476
BRANCH=many
TEST=compile
Fixes: 47a6acca3a41 ("motion: Add bh1730 as a motion sensor")
Change-Id: Ib201db8809cd50b717c37e2f717a1b7ea0dcf312
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198678
Reviewed-by: Cheng-Hao Yang <chenghaoyang@chromium.org>
(cherry picked from commit 2e570139cfc803e0740655cc3da768df4dd716d3)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200051
-rw-r--r-- | driver/als_bh1730.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/driver/als_bh1730.c b/driver/als_bh1730.c index 872fdaa012..37e4da0e21 100644 --- a/driver/als_bh1730.c +++ b/driver/als_bh1730.c @@ -80,10 +80,12 @@ static int bh1730_read_lux(const struct motion_sensor_t *s, intv3_t v) * Return an error when nothing change to prevent filling the * fifo with useless data. */ - if (v[0] == drv_data->last_value) + if (v[0] == drv_data->last_value) { return EC_ERROR_UNCHANGED; - else + } else { + drv_data->last_value = v[0]; return EC_SUCCESS; + } } static int bh1730_set_range(const struct motion_sensor_t *s, int range, @@ -178,4 +180,3 @@ const struct accelgyro_drv bh1730_drv = { .set_data_rate = bh1730_set_data_rate, .get_data_rate = bh1730_get_data_rate, }; - |