From 6d755943e050d2129042e820994c4d0f8c7f2ba0 Mon Sep 17 00:00:00 2001 From: David Dix Date: Fri, 29 Nov 2019 08:38:51 +0000 Subject: [PATCH] Fix si7021 temperature/humidity sensor reading Raw reading modified according to the Silicon Labs sample code for the Si7021 sensor --- extras/dht/dht.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/dht/dht.c b/extras/dht/dht.c index 34e7a07..0a2affa 100644 --- a/extras/dht/dht.c +++ b/extras/dht/dht.c @@ -139,6 +139,9 @@ static inline int16_t dht_convert_data(dht_sensor_type_t sensor_type, uint8_t ms data = 0 - data; // convert it to negative } } + else if (sensor_type == DHT_TYPE_SI7021) { + data = msb * 256 + (lsb & ~0x3); + } else { data = msb * 10; }