From f4191bcb029cf68048ab9e461b1c2811d68b6ce5 Mon Sep 17 00:00:00 2001 From: Yojiro Uo Date: Wed, 17 Feb 2010 14:06:11 +0000 Subject: 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 --- sys/dev/usb/uthum.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'sys/dev/usb') 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 @@ -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 */ -- cgit v1.2.3