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

Unable to send from Serial Monitor/Plotter of subsequent windows #752

Closed
per1234 opened this issue Jan 16, 2022 · 1 comment · Fixed by #982
Closed

Unable to send from Serial Monitor/Plotter of subsequent windows #752

per1234 opened this issue Jan 16, 2022 · 1 comment · Fixed by #982
Assignees
Labels
topic: code Related to content of the project itself topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Jan 16, 2022

Describe the bug

The Serial Monitor and Serial Plotter have an input field the user can use to send data over the selected port.

🐛 In all except the first Arduino IDE window of the session with a given port selected:

  • Data sent via the Serial Monitor's "Message" field is not received by the Arduino board.
  • The Serial Plotter's "Type Message" field is disabled due to the plotter being in a "disconnected" state.

To Reproduce

Preparation

Upload a sketch to your Arduino board that echos serial input as well as autonomously sending serial output:

unsigned long previousMillis;

void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    while (Serial.available() > 0) {
      Serial.write(Serial.read());
    }
    Serial.println();
  } else if (millis() - previousMillis >= 1000) {
    previousMillis = millis();
    Serial.println(random(100));
  }
}

The bug will occur regardless of which sketch is on the board. This sketch is only intended to make the behavior easier to observe.

Observe baseline working state

This procedure is not required to reproduce the bug. It is only intended to prove that the issue does not occur in the first window of the session.

  1. Open the "Serial Monitor" view (Tools > Serial Monitor).
  2. Select "9600 baud" from the "Serial Monitor" view's baud rate menu.
    🙂 Notice that random numbers are periodically printed to the Serial Monitor view's output field, as expected.
  3. Type 4242 into the the "Serial Monitor" view's "Message" field.
  4. Press Ctrl+Enter to send the text over the serial port.
    🙂 Notice that the sent text 4242 is printed to the Serial Monitor view's output field, as expected.
    image
  5. Open the "Serial Plotter" window (Tools > Serial Plotter).
    🙂 Notice that random numbers are periodically plotted in the Serial Plotter, as expected.
  6. Type 4242 into the the "Serial Plotter" window's "Type Message" field.
  7. Click the Send button to send the text over the serial port.
    🙂 Notice that the sent value 4242 is plotted in the Serial Plotter, as expected.
    image
  8. Close the "Serial Monitor" view (X icon).
    This is not mandatory to reproduce the bug. It is done so that Serial Monitor will not be open in the first window of the next session, which might give the impression that is a required condition to reproduce the bug.
  9. Select File > Quit from the Arduino IDE menus.
    This is not mandatory to reproduce the bug. It is done so that it is clear that none of the operations performed during this procedure are required conditions to reproduce the bug.

Observe bug

  1. Start the Arduino IDE.
  2. If not already selected, select your board and port from the board/port selector dropdown.
  3. Select File > New from the Arduino IDE menus.
    This loads the second window of the current IDE session.
  4. Open the "Serial Monitor" view (Tools > Serial Monitor).
  5. Select "9600 baud" from the "Serial Monitor" view's baud rate menu.
    🙂 Notice that random numbers are periodically printed to the Serial Monitor view's output field, as expected.
    🐛 Notice that there is an unexpected banner in Serial Monitor:

    Not connected. Select a board and a port to connect automatically.
    image

  6. Type 4242 into the the "Serial Monitor" view's "Message" field.
  7. Press Ctrl+Enter to send the text over the serial port.
    🐛 Notice that the sent text 4242 is not printed to the Serial Monitor view's output field.
  8. Open the "Serial Plotter" window (Tools > Serial Plotter).
    🙂 Notice that random numbers are periodically plotted in the Serial Plotter, as expected.
    🐛 Notice that the Serial Plotter window title has the "(disconnected) suffix.
    🐛 Notice that a "Board disconnected" notification is shown in the Serial Plotter window.
    🐛 Notice that Serial Plotter's "Type message" field and some other UI elements are disabled.

image

Expected behavior

Serial Monitor and Serial Plotter of subsequent IDE windows for a given port selection to allow sending data.

Desktop

  • OS: Windows 10
  • Version: 2.0.0-rc3-snapshot.35e5da5
    Date: 2022-01-13T17:15:54.562Z
    CLI Version: 0.20.2 [13783819]

Additional context

I bisected the related issue #726 to 767b09d (it does not occur at 8839793).

@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project topic: serial monitor Related to the Serial Monitor labels Jan 16, 2022
@per1234 per1234 linked a pull request Jun 8, 2022 that will close this issue
4 tasks
@per1234
Copy link
Contributor Author

per1234 commented Jun 8, 2022

Closing as fixed by #982

@per1234 per1234 closed this as completed Jun 8, 2022
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 topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants