New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NewPing] Use Direct GPIO access to reduce jitter on ultrasonic sensors #4166
[NewPing] Use Direct GPIO access to reduce jitter on ultrasonic sensors #4166
Conversation
Now the bits are read and an average low duration is computed. The "high" state duration should differ significant from the "low" state. Thus if the "high" state duration was longer than the average "low" state, it was a logic "1".
Would be really nice if someone could test these plugins. The P005 DHT plugin should now (finally) no longer be dependent on those awfully critical timings as reported by some users. |
Based on the information gathered in this issue: pstolarz/OneWireNg#38
Apparently if you never explicitly set the registers for pull-up or pull-down resistors, these registers may contain random values at boot. No matter if it is a warm or cold boot.
I have issues with couple sensors on my ESP32, I'm willing to give this a try however, I was not able to find a nightly build or simple instructions to build it. If you can point me to one of these, I'd like to test my SR04 and DHT11. Both are acting with recent espeasy and tasmota builds. |
Both should be in the "normal" build |
By the way, which other sensors are having issues on ESP32 lately? |
I can confirm same here. Also this change made a huge difference on my DHT11 - it was receiving alot of invalid data before now it seems to be perfect again. |
Have you also tried the Dallas sensors? |
Ok so it is not totally resolved... I tested two different SR04 sensors and same result. I'm getting quite a bit of these errors. On older ESP8266, ESPEasy + SR04, I was getting proper measurements - aka 2+ meters but with this new version I'm only getting readings under 2m. Also it would be nice if we could get a null or -1 for errors instead of 0. 500536: EVENT: GarageDoor#Distance=0.00 |
Hmm will check the differences among library versions as I did not change anything related to the max. distance. |
See: #4165
Also added fix for timing critical issues for the P005 DHT sensors.
The P005 DHT plugin should now (finally) no longer be dependent on those awfully critical timings as reported by some users.
Those DHT sensors may have some drift in timings based on temperature (for a temperature sensor....)
Now the timings are all relative, so any drift among sensors should no longer matter.
Still to do:
The new license of NewPing states:
This is a reasonable requests from the author, but merging this PR will be halted until official permission has been given or suggested changes to the library may have been merged via some pull request to the original library.
Edit:
Permission has been granted via email (within 2 hours :) )
Fixes: #4026
Fixes: #3494