Skip to content

Commit 1b3cd80

Browse files
committed
driver cm32183 fix int rounding error
Previously the als output values at low lux levels would be rounded by the intermediate calculations eg output values at low lux were 0, 3, 7.... now, we will get lux values correctly reported to the nearest lux. Signed-off-by: Kieran Levin <ktl@frame.work>
1 parent 85fdf34 commit 1b3cd80

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

driver/als_cm32183.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ int cm32183_read_lux(int *lux, int af)
2727

2828
/*
2929
* lux = data * 0.016
30+
* lux = (data * 16 / 1000) * af / 10;
3031
*/
31-
*lux = (data * 16 / 1000) * af / 10;
32+
*lux = data * af * 16 / 10000;
3233

3334
return EC_SUCCESS;
3435
}

0 commit comments

Comments
 (0)