-
Notifications
You must be signed in to change notification settings - Fork 26
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
Reading from serial port always takes the full timeout of 1000 ms #12
Comments
I'm sorry I don't really know what you are talking about. I'm not sure that message was supposed to get to me.
…Sent from my iPhone
On Jan 25, 2018, at 13:06, madMAx43v3r <notifications@github.com<mailto:notifications@github.com>> wrote:
https://github.com/GAVLab/ublox/blob/22de15b9ca240b4c60495388b292bbecc7a4c601/src/ublox.cpp#L431
What the hell dude? This line waits for 5000 frickin bytes to be read before processing the data!!! No wonder there is always a huge delay, it always hits the timeout of 1000 ms!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#12>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABx_pRvXVH5otBRLaZW-twWAXCj0H_Wkks5tOMKUgaJpZM4RtQgv>.
|
Not necessarily. The serial_port is initialized with the inter-byte timeout set to 100ms, so you'll be waiting up to, but not always 1000ms. Line 240 in 22de15b
As long as there is no traffic on the serial port for at least the inter-byte timeout value, the function will return. This is typically the case as long as your baud rate is substantially high enough to accommodate a 100ms delay between u-blox serial message bursts. If you're running a fast position update rate, you could reduce the 100ms inter-byte timeout to a smaller value if there's not at least 100ms between fix updates (if you're running at 10Hz, for example). |
I'm running at 1 Hz, even at 10 Hz I got all 10 messages at the same time. This is a serious design flaw in the serial library, why would you ever want to read a specific number of bytes? Just take what's there and process it, there's no need for any timeouts whatsoever. |
Besides, looking at the code you can see that the inter-byte timeout has no effect whatsoever: |
ublox/src/ublox.cpp
Line 431 in 22de15b
What the hell dude? This line waits for 5000 frickin bytes to be read before processing the data!!! No wonder there is always a huge delay, it always hits the timeout of 1000 ms!
The text was updated successfully, but these errors were encountered: