Skip to content

Add support for LF line breaks on records #8

Closed
@per1234

Description

@per1234

Describe the current behavior

The Arduino IDE Serial Plotter accepts data in a delimiter-separated format. Each record is terminated by a line break.

Currently, the only line break recognized by the Arduino IDE 2.x Serial Plotter is CRLF (\r\n).

The LF line ending is supported and officially specified as the line break character for the classic Arduino IDE Serial Plotter protocol:

https://github.com/arduino/Arduino/blob/master/build/shared/ArduinoSerialPlotterProtocol.md#serialplotter-protocol

End of message symbol \n

To reproduce

  1. Upload the following sketch to an Arduino board
    void setup() {
      Serial.begin(9600);
    }
    void loop() {
      Serial.print(random(10));
      Serial.print('\n');
    }
  2. Open the Arduino IDE 2.x Serial Plotter.
  3. Select "9600 baud" from the dropdown baud rate menu at the bottom right corner of the "Serial Plotter" window.
    😢 the data are not plotted.
    image
  4. Close the Arduino IDE 2.x Serial Plotter.
  5. Open the classic Arduino IDE Serial Plotter.
  6. Select "9600 baud" from the dropdown baud rate menu at the bottom left corner of the "Serial Plotter" window.
    🙂 the data are plotted.
    image

Describe the request

Support LF in addition to CRLF line breaks in data sent to Serial Plotter.

Desktop

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

Additional context

In addition to providing compatibility with the original protocol, there are several other reasons for supporting LF line breaks:

  • "New Line" is the default line ending setting in the Arduino IDE Serial Monitor and Serial Plotter.
  • A single character line break is more efficient, which can be an important consideration for resource constrained microcontrollers.
  • Users may find LF line endings most intuitive since this is the standard line ending on both Linux and macOS, and even increasingly prevalent in code applications on Windows.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions