Skip to content
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

Serial read_line behavior with multiple lines in RX buffer #87

Open
SeaTechRC opened this issue Nov 5, 2024 · 0 comments
Open

Serial read_line behavior with multiple lines in RX buffer #87

SeaTechRC opened this issue Nov 5, 2024 · 0 comments

Comments

@SeaTechRC
Copy link
Contributor

Hello,

As mentioned in #78, if I am not misunderstanding the ESP-IDF uart_driver, calling Serial::read_line() when 2 lines are in the RX buffer causes the pattern position for the second line to be incorrect.
As far as I could see, the pattern positions are not updated when the RX buffer in the uart buffer gets partly read.

As Example:
The pattern is "\n"
The uart RX buffer was empty (aswell as the pattern queue) and was filled with:
test 1\ntest2\n
without any reads inbetween.
The driver would have the following pattern positions in queue:
6, 12

When Serial::read_line() is called, it retrieves the data up to the first pattern in the queue. After read_line, the buffer and pattern pos queue should be:
test 2\n
12

If Serial::read_line() gets called again, we retrieve parts of the next message that gets put into the buffer.

Do note:
I have not yet been able to confirm that this is actually the case.

Kind regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant