-
Notifications
You must be signed in to change notification settings - Fork 413
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
Is there a way to flush an open gpioSerialRead buffer? #596
Comments
Things you may have already thought about:
Other ideas:
|
I implemented a "flush" by setting the Haven't had any issues with it that I can recall. |
I'll try that! Do you have a guess on how much time expires between a close and reopen?
I tried doing a read and discarding the data--but maybe not ALL of it. Maybe there's more in the buffer than I expect, need to check my math or just do a quick experiment
_. You mean external hardware? There are several things I could try if I wanted to add just a bit of hardware, but I haven't given up on trying to do it in code. You mentioned that in the other thread and maybe I'm not "getting it". But, I don't see how to make it work. The beginning of a valid message is indicated by a period of 1.06 msec. And, the serial read needs to start right when that 1.06 msec ends. So, by the time the 1.06 msec is detected, it's already to late to start the serial read. So, the implementation I have now reads all the time, but discards unneeded data. Discarding extra transitions "works", but slows down how fast the receiver can scan multiple channels. For some reason, when the receiver starts back up after a frequency change, I'm getting many more "false triggers"--the receiver is outputting logic ones for relatively long periods of time. Thanks for your suggestions! A couple of paths to experiment with. |
That sounds like what I need. How did you do it, by adding a function to the pigpio library? |
What causes gpioSerialRead to return when less characters are in the internal buffer than the specified size of the external buffer? Is it a timeout? Can it be configured? (It stays in the read too long if I try doing a read then discarding as a way to do the flush). |
Also, closing and reopening seems to take too long, unless doing that introduces something else that breaks things. Same symptom as doing a dummy serialread than discarding--the entire message is missed. |
Yes https://github.com/jw3/j1708-pi/blob/master/pigpio-sys/lib/pigpio.c#L9776 |
Thanks! Trying it now... |
Works great! Thanks! |
Or, better yet, a way to "pause" the accumulation of timestamped edges that are being accumulated in the circular buffer?
I'm using serial read to get data from an RF receiver. I'm adding functionality for the RF receiver to scan multiple channels. Whenever the frequency is changed, the serial data being read will be invalid for at least a known period of time.
I'd like a way to "flush" the read buffer (quickly) and/or the ability to stop/start edge acquistion.
I'm already using a "hacked" version of gpioSerialRead to return the timestamp data. So, maybe I can modify that to get what I want. But, maybe there's a "built-in" way to get what I need?
The text was updated successfully, but these errors were encountered: