From: Jonathan Cameron <jic23@kernel.org>
To: Harald Geyer <harald@ccbib.org>
Cc: linux-iio@vger.kernel.org, Edward Attfield <edward@attfield.ca>
Subject: Re: [PATCH] iio: dht11: Improve detection of sensor type
Date: Sat, 17 Feb 2018 12:06:26 +0000 [thread overview]
Message-ID: <20180217120626.728c3aaa@archlinux> (raw)
In-Reply-To: <1518347380-9624-1-git-send-email-harald@ccbib.org>
On Sun, 11 Feb 2018 11:09:40 +0000
Harald Geyer <harald@ccbib.org> wrote:
> The old code was based on a DHT11 datasheet which specifies a measurement
> range of 20%-90% RH. Turns out the sensor actually reports values outside
> this range, so we should support it as far as possible.
>
> Reported-by: Edward Attfield <edward@attfield.ca>
> Signed-off-by: Harald Geyer <harald@ccbib.org>
Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/humidity/dht11.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c
> index df6bab4..1a9f8f4 100644
> --- a/drivers/iio/humidity/dht11.c
> +++ b/drivers/iio/humidity/dht11.c
> @@ -159,7 +159,7 @@ static int dht11_decode(struct dht11 *dht11, int offset)
> }
>
> dht11->timestamp = ktime_get_boot_ns();
> - if (hum_int < 20) { /* DHT22 */
> + if (hum_int < 4) { /* DHT22: 100000 = (3*256+232)*100 */
> dht11->temperature = (((temp_int & 0x7f) << 8) + temp_dec) *
> ((temp_int & 0x80) ? -100 : 100);
> dht11->humidity = ((hum_int << 8) + hum_dec) * 100;
prev parent reply other threads:[~2018-02-17 12:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-11 11:09 [PATCH] iio: dht11: Improve detection of sensor type Harald Geyer
2018-02-17 12:06 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180217120626.728c3aaa@archlinux \
--to=jic23@kernel.org \
--cc=edward@attfield.ca \
--cc=harald@ccbib.org \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.