Description
Describe the bug
I wrote a simple sketch to output so many lines to the terminal monitor as fast as possible. I am curious to see if the new monitor can keep up with a T4.x which runs at full speed USB...
The sketch is nothing special, but loops waiting for input data to allow me to type in how many lines to output.
I then start up the sketch and do what is necessary to get it back to comm port (more later), and then it shows up my first prompt, I type in lets say 100 in what I am pretty sure is the input window for it and hit enter and the sketch does not receive any data and as such does not run any farther.
@PaulStoffregen - not sure if any of this touches the Teensy integration code or not. It should be using the default Serial monitor?
Again secondary issue: I believe that with earlier versions of Arduino like 1.8.19, if you chose to use the default Arduino monitor code, versus the Teensy updated monitor code, that the user choice was preserved between builds.
To Reproduce
Steps to reproduce the behavior:
- Install the Teensy boards see https://forum.pjrc.com/threads/53548-Arduino-CLI-Alpha-Release-Teensy-Support?p=298914&viewfull=1#post298914 for board manager string
- start up the sketch... It is shown at the end
- Build and download it. Note: this one used the default USB type of Serial, default CPU speed...
- connect the Serial monitor and try to type in something.
Expected behavior
A clear and concise description of what you expected to happen.
I expected it in this case to output 100 lines plus summary to the serial monitor
Side note: At least on windows, when I now rebuild the sketch it switches the Serial port setting and terminal monitor will not work until I reset it.
That is I am trying the sketch: and the top shows I am on COM115
I then do a sketch upload and notice it changed what the active Serial is:
It then does not allow me to use Serial monitor:
so I go back to tools ports and switch back (Probably should have done screen shot after I selected the COM line.
And then we are back to:
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Windows 10
- Nightly build 20210201
Additional context
void setup() {
// put your setup code here, to run once:
while (!Serial && millis() < 5000);
Serial.begin(115200);
}
void loop() {
while (Serial.read() != -1); // remove any thing still on queue
Serial.println("\nEnter number of lines to output");
uint32_t count_of_lines = 0;
for(;;) {
int ch;
while ((ch = Serial.read()) == -1 ) ;
Serial.write(ch);
if ((ch >= '0') && (ch <= '9')) count_of_lines = count_of_lines * 10 + ch - '0';
else break;
}
elapsedMillis em = 0;
for (uint32_t line_num = 0; line_num < count_of_lines; line_num++) Serial.printf("Line %u\n", line_num);
uint32_t delta_time = em;
Serial.printf("*** Output %u lines in %u millis\n", count_of_lines, delta_time);
}
Activity
KurtE commentedon Feb 4, 2022
Quick update: the not getting input appears to happen with Arduino Uno as well...
I had to modify the sketch some to remove printf and elapsedMillis...
PaulStoffregen commentedon Feb 4, 2022
Tried it here with Linux. Seems to work better.
KurtE commentedon Feb 4, 2022
Another quick update. I then closed serial monitor and reopened it a couple of times on the UNO and now it is showing:

That you are supposed to hit CTRL+enter to send message...
I will see if that works on Teensy as well.
Two things:
PaulStoffregen commentedon Feb 4, 2022
But even on Linux, I'm seeing signs of "buffer bloat" issues....
PaulStoffregen commentedon Feb 4, 2022
And yeah, the ctrl-enter thing is really weird.
KurtE commentedon Feb 4, 2022
Thanks Paul, I verified it worked as well...
Again to developers - unclear why I did not see the CTRL+enter on it earlier... Maybe again me having to switch back from USB, I do see it did show up after I switched back... but probably by then eyes skipped over it.
Side note: maybe it was also some frustration from trying to type that sketch in on Ubuntu... Maybe something is screwy with my machine,
But: I had the IDE running
And want to create the sketch so hit ctrl+n
new window opens up,
I move the cursor to the end of the line put your setup... and hit enter
It first moves cursor to under the comment and then magically moves it back to column one... I type a new line in:
It stays in column 1 so I hit tab key and it moves out and it moves back to Col 1, hit tab again it moves to the next line before the }... Maybe something strange with machine, I did reboot and still the same... What the heck is going on.
I finished typing it, in and built the sketch, ran it... then I clicked the close button on the window and window was closed and the program was lost without ever being prompted to save it...
So the one I posted was the second attempt which I did on windows and it did not have the ghost moving the text cursor
per1234 commentedon Feb 5, 2022
I am able to reproduce this with nightly build 20210201, but not with the latest nightly, so I think it must have been fixed by #792
This is being tracked at #572
Likely because in addition to the new trigger being unintuitive and non-standard, the message that explains it to you disappears as soon as you start typing text in the field. I pointed that poor user experience out in #572
Tracked here: #348
There were some previous reports of poor Serial Monitor performance at #79 and #519, but those were closed as fixed by #524
So please open a new issue to track this bug @PaulStoffregen.
Tracked here: #595
I think it must be this bug: #437
This high quality feedback is very valuable, but please try to make a dedicated issue report for each distinct bug or feature request. When many separate things are reported in the same issue it makes it very difficult to effectively and efficiently track them and we risk accidentally missing one.
KurtE commentedon Feb 5, 2022
Thanks,
I was actually in the middle of summarizing the stuff like you mentioned. Had found 572 and 595 (and maybe 677) and was going to suggest maybe close as most of it covered by other things.
quick update, the original thing I saw when I was starting this report was after a build I saw the not connected, which I see on the 0201 build will try with new one...

I can type 100 and even 100 + ctrl+enter and nothing happens yet it is showing the output from the sketch in the window...
Actually in this case it is showing/scrolling the text in both IDE2 windows I have open.
Thanks again,
Update: As you mentioned, the later build, in my case 0205 appears to solve the first part. thanks
per1234 commentedon Feb 5, 2022
677 is another thing that can cause loss of unsaved work, but that one is related to the design of the save on exit dialog (which is presented if you have auto-save disabled in File > Preferences and exit with a sketch in a "dirty" state), while the problem you described was about no prompt at all on exit, indicating the sketch was not in a "dirty" state (#595)
It is probably this one: #753
This is #752, which is another symptom of the same bug that causes #753
Yay! I was very happy to discover it fixed when I gave it a try with my Teensy 4.0.
PaulStoffregen commentedon Feb 6, 2022
I'm going to wait until #769 is fixed. Then I'll investigate by creating a pluggable monitor to serve as a reliable test case without depending on hardware specifics.