Open madMAx43v3r opened 6 years ago
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 GitHubhttps://github.com/GAVLab/ublox/issues/12, or mute the threadhttps://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. https://github.com/GAVLab/ublox/blob/22de15b9ca240b4c60495388b292bbecc7a4c601/src/ublox.cpp#L240
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. I got a little angry yesterday because I've been battling this issue for weeks now. I've just set MAX_NOUT_SIZE to 1 now and it works like a charm, ~60 ms delay instead of randomly between 0 and 1000 ms, depending on when you start your program. And who cares about performance, it's still less than 1% on a 1 GHz ARM.
Besides, looking at the code you can see that the inter-byte timeout has no effect whatsoever:
Serial::SerialImpl::read (uint8_t *buf, size_t size) { while (bytes_read < size) { if (waitReadable(timeout)) { ... } } }
It will just keep looping until bytes_read >= size or timeout_remaining_ms <= 0.
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!