Closed michaellass closed 4 years ago
hmm! nice idea - would you mind pylinting? you probably just need to add a '# pylint: disable' line
We can actually reduce the number of branches by checking for any missing bits first. Then the main decoding logic does not need to be wrapped by an if len(pulses) >= 80
. Pylint seems to be happy now.
ok and ya tested on a pi? which ones? we'll test too :)
It's running here (in combination with https://github.com/adafruit/libgpiod_pulsein/pull/1) on a Raspberry Pi 4B and taking one measurement each minute. Looks good so far. Of course the most recent version now only runs for an hour or so but I will continue observing it over the next days.
Just a quick follow-up: The most recent version has been running here for more than three days now, taking over 4000 successful measurements without returning any garbage. Of course it can still return garbage if just the wrong two bits flip in the communication. There's nothing we can do about that.
thanks, we're a little swamped, but not forgotten!
@ladyada Could you please merge the fix.
I tested this with a Trinket M0 and a DHT11. Ran for about an hour taking readings every 2 seconds. I did see the bogus data error a few times. But I think it was my fault in those cases the sensor was not connected properly yet. Since getting connected correctly it's run successfully and been reporting temperature and humidity.
It does need to have some merge conflicts resolved now though. @michaellass if you are able to you can make a new commit here to resolve them.
If not, no worries I will try to work on getting it resolved later this week.
Thanks for testing! I just rebased the changes onto master.
Thank you michaellass this contribution and for rebasing.
Following up on testing, my Trinket M0 + DHT11 continued to run all night over night with no serious issues.
It looks like this was originally made to resolve an issue when running under Pi / Blinka. I will try to get it tested that way later this week.
https://github.com/adafruit/Adafruit_Blinka/issues/210 demonstrated erroneous readings that can easily be avoided: