Module Name: src
Committed By: jakllsch
Date: Tue Aug 16 23:47:45 UTC 2016
Modified Files:
src/sys/dev/i2c: titemp.c
Log Message:
Fix fractional temperature conversion.
Previously 0 to 15 whole degrees were added for each 1/16th degree fraction.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/titemp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/i2c/titemp.c
diff -u src/sys/dev/i2c/titemp.c:1.2 src/sys/dev/i2c/titemp.c:1.3
--- src/sys/dev/i2c/titemp.c:1.2 Sun Dec 13 17:15:06 2015
+++ src/sys/dev/i2c/titemp.c Tue Aug 16 23:47:45 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: titemp.c,v 1.2 2015/12/13 17:15:06 jmcneill Exp $ */
+/* $NetBSD: titemp.c,v 1.3 2016/08/16 23:47:45 jakllsch Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: titemp.c,v 1.2 2015/12/13 17:15:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: titemp.c,v 1.3 2016/08/16 23:47:45 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -176,7 +176,7 @@ done:
} else {
edata->value_cur =
((uint64_t)temp[0] * 1000000) +
- ((uint64_t)temp[1] * 62500) +
+ ((uint64_t)(temp[1]>>4) * 62500) +
+ 273150000;
edata->state = ENVSYS_SVALID;
}