driver: als_bh1730: Set last_value
|last_value| was never set, so sensor would send same data and never
send measurement of 0 lux.
BRANCH=many
TEST=compile
Fixes: ("motion: Add bh1730 as a motion sensor")
@@ -80,11 +80,13 @@ 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(struct motion_sensor_t *s, int range,
int rnd)
@@ -177,4 +179,3 @@ const struct accelgyro_drv bh1730_drv = {
.set_data_rate = bh1730_set_data_rate,
.get_data_rate = bh1730_get_data_rate,
};
-
