-
Notifications
You must be signed in to change notification settings - Fork 13
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
WaitForEdge generated unexpected results #37
Comments
The problem with WaitForEdge() is that the implementation in https://github.com/periph/host/blob/main/sysfs/gpio.go is dependent on sysfs which is sensitive to timing issues from linux. |
So for my problem, I can only use polling instead of WaitForEdge, right? Or is there any way to avoid this timing-sensitive problem? |
@zombie-k A new implementation of GPIO has been created that uses ioctl() interface, and not sysfs. You might try re-testing your code with the HEAD of periph.io/x/host. You can clone the repo, and in your go.mod file put: replace periph.io/x/host/v3 v3.8.2 => path to cloned repo and rebuild it. Note that you'll need to remove any references to sysfs from your code. |
Simpler, you can do the following:
No need for a replace statement or checking out locally. |
Describe the bug
WaitForEdge generated unexpected results,Problems arise when using edge detection for ultrasonic ranging,When the sensor is stationary, the calculated values deviate significantly
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The expected result is 180+-cm, but the actual value will be 180+-cm at one time and 8+-cm at another time, and the two will alternate repeatedly. (180+- is the current true value)
Platform (please complete the following information):
Additional context
I have used polling to verify and can get the expected results
The text was updated successfully, but these errors were encountered: