Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c Fix fractional temperature conversion.



details:   https://anonhg.NetBSD.org/src/rev/e5d655eb4a0c
branches:  trunk
changeset: 347184:e5d655eb4a0c
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Tue Aug 16 23:47:45 2016 +0000

description:
Fix fractional temperature conversion.

Previously 0 to 15 whole degrees were added for each 1/16th degree fraction.

diffstat:

 sys/dev/i2c/titemp.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r ed59e78d964a -r e5d655eb4a0c sys/dev/i2c/titemp.c
--- a/sys/dev/i2c/titemp.c      Tue Aug 16 21:05:14 2016 +0000
+++ b/sys/dev/i2c/titemp.c      Tue Aug 16 23:47:45 2016 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
        } 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;
        }



Home | Main Index | Thread Index | Old Index