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[x].flush() does not wait until transmission is finished #158

Open
TNobuhara opened this issue Oct 5, 2023 · 1 comment · May be fixed by #304 or #328
Open

Serial[x].flush() does not wait until transmission is finished #158

TNobuhara opened this issue Oct 5, 2023 · 1 comment · May be fixed by #304 or #328
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@TNobuhara
Copy link

Using Serial1.flush()
In flush() of ArduinoUnoR3 waited until the transmission was completely finished.
When I tried R4, it seemed to exit as soon as the Tx buffer was empty.

Please tell me what to do. Or is it possible to fix it?

@delta-G
Copy link
Contributor

delta-G commented May 6, 2024

Serial on the R4 doesn't currently use the txBuffer at all. Serial.write is blocking by itself which makes 'flush' redundant. I've submitted PR #304 to modify the UART class to use the buffer and not to block. This by itself restores the function of flush. It will still block until the buffer is empty, but the buffer won't be empty until the transmission end interrupt at the end of the transmission.

@per1234 per1234 changed the title Regarding Serial[x].flush() Serial[x].flush() does not wait until transmission is finished May 9, 2024
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels May 9, 2024
@per1234 per1234 linked a pull request May 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
3 participants