sensor: si7006: fixed temperature conversion

The driver was incorrectly converting the temperature samples. According
to Si7006-A20 rev. 1.2 datasheet, section 5.1.2. Measuring Temperature,
the offset -46.85 must be applied.

Signed-off-by: Max Payne <forgge@gmail.com>
Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
This commit is contained in:
Max Payne 2019-10-18 21:19:33 +03:00 committed by Maureen Helm
commit 0bc4370689

View file

@ -105,8 +105,8 @@ static int si7006_channel_get(struct device *dev, enum sensor_channel chan,
if (chan == SENSOR_CHAN_AMBIENT_TEMP) {
s32_t temp_ucelcius = ((17572 * (s32_t)si_data->temperature)
/ 65536) * 10000;
s32_t temp_ucelcius = (((17572 * (s32_t)si_data->temperature)
/ 65536) - 4685) * 10000;
val->val1 = temp_ucelcius / 1000000;
val->val2 = temp_ucelcius % 1000000;