arduino / arduino-serial-plotter-webapp

arduino-serial-plotter-webapp
GNU Affero General Public License v3.0
4 stars 8 forks source link

Non-comma separator not working in labeled data sets #15

Closed per1234 closed 2 years ago

per1234 commented 2 years ago

Describe the problem

The official Arduino Serial Plotter protocol specification documents three supported data point separator characters:

πŸ› Separators other than commas are not working in data sets that are labeled

To reproduce

Equipment

Steps

  1. Upload the following sketch to your Arduino board:
    void setup() {
     Serial.begin(9600);
    }
    void loop() {
     for (byte value = 0; value < 4; value++) {
       for (byte variableOffset = 0; variableOffset < 3; variableOffset++) {
         Serial.print("label");
         Serial.print(variableOffset);
         Serial.print(':');
         Serial.print(value + variableOffset);
         Serial.print("\t");
       }
       Serial.println();
     }
     delay(100);
    }
  2. Open "Serial Plotter"
  3. Select "9600 baud" from the dropdown baud rate menu at the bottom right corner of the "Serial Plotter" window.

πŸ› Only a single variable is plotted:

image

Expected behavior

serial-plotter-labeled

OR

Version

https://github.com/arduino/arduino-serial-plotter-webapp/commit/eac6d39f3f5156390bc4f9e09cafcccc121248c9

Operating system

Windows

Operating system version

10

Additional context

The demo works as expected when using the Arduino IDE 1.8.19 Serial Plotter.


Examples of existing programs broken by this bug:

nmzaheer commented 2 years ago

I think conforming to the protocol would be a better option. I think the second proposal would involve a lot more effort and unnecessary since it is also a part of legacy Arduino.

I'd like to take a stab at it

nmzaheer commented 2 years ago

Looks like the relevant code is here https://github.com/arduino/Arduino/blob/69e91cab5cc6e0ee9280a1b8a3399d1b634a9eef/app/src/processing/app/SerialPlotter.java#L408

A regex expression is being used to include Space, Tab and Comma as delimiter values. I will try to replicate the same in React