drivers: sensor: ds18b20: Fix temperature calculation for ds18s20
The millionths value is calculated incorrectly.
The sensor has a precision of 0.5 which is 500000 millionths, but
there is an extra zero in the code. This fix removes the extra zero.
Signed-off-by: Sašo Domadenik <saso.doma@gmail.com>
diff --git a/drivers/sensor/maxim/ds18b20/ds18b20.c b/drivers/sensor/maxim/ds18b20/ds18b20.c
index b546bfa..4d72f68 100644
--- a/drivers/sensor/maxim/ds18b20/ds18b20.c
+++ b/drivers/sensor/maxim/ds18b20/ds18b20.c
@@ -89,7 +89,7 @@
if (cfg->chip == type_ds18s20) {
val->val1 = temp / 2;
- val->val2 = (temp % 2) * 5000000;
+ val->val2 = (temp % 2) * 500000;
} else {
val->val1 = temp / 16;
val->val2 = (temp % 16) * 1000000 / 16;