diff options
author | Yojiro Uo <yuo@cvs.openbsd.org> | 2010-02-17 14:06:11 +0000 |
---|---|---|
committer | Yojiro Uo <yuo@cvs.openbsd.org> | 2010-02-17 14:06:11 +0000 |
commit | f4191bcb029cf68048ab9e461b1c2811d68b6ce5 (patch) | |
tree | 44c1bf298da1a1b83ce56db5a1abd2272a64106d /sys | |
parent | 316ac1abd4f2cabe81f2fc2ffdb214a73e2826c7 (diff) |
change constant of convert formulra of SHT1X sensor to fit
TEMPerHUM hardware. (It uses 3.38-3.48V as SHT1X's VDD).
mentiond by Michael Fuckner
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/uthum.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sys/dev/usb/uthum.c b/sys/dev/usb/uthum.c index 76712826de9..1e677919f52 100644 --- a/sys/dev/usb/uthum.c +++ b/sys/dev/usb/uthum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthum.c,v 1.6 2010/01/03 18:43:02 deraadt Exp $ */ +/* $OpenBSD: uthum.c,v 1.7 2010/02/17 14:06:10 yuo Exp $ */ /* * Copyright (c) 2009 Yojiro UO <yuo@nui.org> @@ -204,7 +204,7 @@ uthum_attach(struct device *parent, struct device *self, void *aux) } if (sc->sc_num_sensors > 0) { - sc->sc_sensortask = sensor_task_register(sc, uthum_refresh, 6); + sc->sc_sensortask = sensor_task_register(sc, uthum_refresh, 20); if (sc->sc_sensortask == NULL) { printf(", unable to register update task\n"); return; @@ -370,7 +370,20 @@ uthum_refresh(void *arg) int uthum_sht1x_temp(unsigned int ticks) { - return (ticks - 4010); + /* + * VDD constant + *----------------------- + * 5.0V -4010 + * 4.0V -3980 + * 3.5V -3970 + * 3.0V -3960 + * 2.5V -3940 + */ + /* + * as the VDD of the SHT10 on my TEMPerHUM is 3.43V +/- 0.05V, + * I choose -3970 as the constant of this formula. + */ + return (ticks - 3970); } /* return %RH * 1000 */ |