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

arduino-cli monitor does not flush characters until \n is typed #2251

Closed
3 tasks done
cshamis opened this issue Jul 25, 2023 · 1 comment · Fixed by #2291
Closed
3 tasks done

arduino-cli monitor does not flush characters until \n is typed #2251

cshamis opened this issue Jul 25, 2023 · 1 comment · Fixed by #2291
Assignees
Labels
type: imperfection Perceived defect in any part of project

Comments

@cshamis
Copy link

cshamis commented Jul 25, 2023

Describe the problem

I was trying to debug my Serial.read() routines and couldn't figure out what I was doing wrong. None of my keypresses were getting through to my program. Then I hit enter ... and they ALL came through.

After much reading about line endings in the terminal (not applicable here) I tried using screen to directly connect to the serial port. Screen sends the characters as they are typed, and my program works fine.

Is the arduino-cli monitor buffering until a newline intentional? Or a bug? Or just not well documented? Or... maybe something else.

To reproduce

void hardwareUART() {
int charIn = Serial.read();
if (charIn == -1) {
return;
}
Serial.print(charIn);
}

Expected behavior

When typing in a bidirectional terminal, characters are sent as typed. Not buffered until newline.

Arduino CLI version

0.33.1

Operating system

macOS

Operating system version

Ventura 13.4

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details
@cshamis cshamis added the type: imperfection Perceived defect in any part of project label Jul 25, 2023
@cshamis cshamis changed the title arduino-cli monitor does not "send" characters until \n is typed arduino-cli monitor does not flush characters until \n is typed Jul 25, 2023
@cmaglie
Copy link
Member

cmaglie commented Sep 1, 2023

Turns out to be quite challenging to get out of this "line buffering" mode, because it's something that is enforced at the terminal level.

I tried a possible solution here: #2291 I tested it on Linux but it should work as well on MacOS. Don't know if it works on Windows at all...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants