Skip to content

Commit 2ac238c

Browse files
sasodomajhedberg
authored andcommitted
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 <[email protected]>
1 parent f56f196 commit 2ac238c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/sensor/maxim/ds18b20/ds18b20.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static inline void ds18b20_temperature_from_raw(const struct device *dev,
8989

9090
if (cfg->chip == type_ds18s20) {
9191
val->val1 = temp / 2;
92-
val->val2 = (temp % 2) * 5000000;
92+
val->val2 = (temp % 2) * 500000;
9393
} else {
9494
val->val1 = temp / 16;
9595
val->val2 = (temp % 16) * 1000000 / 16;

0 commit comments

Comments
 (0)