[riot-notifications] [RIOT-OS/RIOT] drivers/dht: Bugfixes (#11876)

Marian Buschsieweke notifications at github.com
Wed Jul 24 12:07:15 CEST 2019


maribu commented on this pull request.



> +            _reset(dev);
+            return DHT_TIMEOUT;
+        }
+
+        if (_read(&csum, dev->params.pin, 8)) {
+            _reset(dev);
+            return DHT_TIMEOUT;
+        }
+
+        /* Bring device back to defined state - so we can trigger the next reading
+         * by pulling the data pin low again */
+        _reset(dev);
+
+        /* validate the checksum */
+        sum = (raw_temp >> 8) + (raw_temp & 0xff) + (raw_hum >> 8) + (raw_hum & 0xff);
+        if ((sum != csum) || (csum == 0)) {

> Also, why is `csum == 0` treated as invalid?

Good question. I didn't author the code, I just changed the indent  level ;-)

> Wouldn't that be the correct value for 0.0° C and 0.0% rH?

According to the data sheet: Yes. And also whenever the sum of the data bytes happen to be zero. I'll fix it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11876#discussion_r306731721
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190724/fd8543c0/attachment.htm>


More information about the notifications mailing list