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

MichelRottleuthner notifications at github.com
Wed Jul 24 11:45:22 CEST 2019


MichelRottleuthner 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? Wouldn't that be the correct value for 0.0° C and 0.0% rH?

-- 
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_r306721827
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190724/93c7f1eb/attachment.htm>


More information about the notifications mailing list