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

Support a comment character to ignore incoming text lines #28

Open
AESilky opened this issue Nov 24, 2019 · 7 comments
Open

Support a comment character to ignore incoming text lines #28

AESilky opened this issue Nov 24, 2019 · 7 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@AESilky
Copy link

AESilky commented Nov 24, 2019

Serial Plotter added the ability to supply labels for the data as a comma/tab/space separated line of text. The ability to indicate that a text line should be ignored (not interpreted as labels) would help keep labels from being added when not wanted while being able to print debugging information to the Serial Monitor.

Something like a leading '!' or some other character:
! This will not be interpreted as data labels, even though it has spaces and a comma.

@madsdyd
Copy link

madsdyd commented Apr 7, 2020

AFAICT, it is trivial to add something hardcoded to the Serial Plotter, as it is. This patch makes the Serial Plotter ignore lines starting with #:

diff --git a/app/src/processing/app/SerialPlotter.java b/app/src/processing/app/SerialPlotter.java
index 035005a..366bc57 100644
--- a/app/src/processing/app/SerialPlotter.java
+++ b/app/src/processing/app/SerialPlotter.java
@@ -401,8 +401,8 @@ public class SerialPlotter extends AbstractMonitor {
       messageBuffer.delete(0, linebreak + 1);
 
       line = line.trim();
-      if (line.length() == 0) {
-        // the line only contained trimmable characters
+      if (line.length() == 0 || line.startsWith("#")) {
+        // the line only contained trimmable characters or should be ignored
         continue;
       }
       String[] parts = line.split("[, \t]+");

However, I would suggest adding a regular expression to the GUI instead: Any lines matching a specific regular expression gets interprented by the Serial Plotter. Default value: "^.+$".
This would allow the user to filter lines based on need.

I am sorely lacking in Swing experience though, otherwise I would not mind giving the implementation a try.

A question: Is there any canonical documentation for the Serial Plotter? I had a look through the source code yesterday to use it correctly, and would not mind documenting the existing performance. Guides on the net are inadequate.

@per1234
Copy link
Contributor

per1234 commented Apr 7, 2020

Is there any canonical documentation for the Serial Plotter?

There is this: https://github.com/arduino/Arduino/blob/master/build/shared/ArduinoSerialPlotterProtocol.md

The only documentation other than that is the demonstration of using Serial Plotter in some of the tutorials related to the example sketches, as listed here: arduino/Arduino#7453 (comment)

@madsdyd
Copy link

madsdyd commented Apr 7, 2020

Is there any canonical documentation for the Serial Plotter?

There is this: https://github.com/arduino/Arduino/blob/master/build/shared/ArduinoSerialPlotterProtocol.md

Ah, thanks! I was completely unable to locate this information. My google-foo was inadequate.

And thank you for pointing me to some of the discussion about the Serial Plotter. Hugely useful tool, that could be even more useful with just a few additions. Do you think a PR adding a "selector" based on regular expressions to the GUI would be accepted?

@rnestler
Copy link

AFAICT, it is trivial to add something hardcoded to the Serial Plotter, as it is. This patch makes the Serial Plotter ignore lines starting with #:

For most use cases this would probably be enough. It is easy to just prefix log messages with #.

@Batwam
Copy link

Batwam commented Mar 6, 2021

hi everyone, has anyone found a solution to exclude some outputs from the Serial plotter without having to patch the java file?

@stefan123t
Copy link

stefan123t commented May 6, 2021

@per1234 the other issue in #21 can be marked as duplicate.

please double read the explanation of @madsdyd here:

However, I would suggest adding a regular expression to the GUI instead:
Any lines matching a specific regular expression gets interpreted by the Serial Plotter.
Default value: "^.+$".
This would allow the user to filter lines based on need.

@per1234 per1234 transferred this issue from arduino/Arduino Nov 18, 2022
@per1234 per1234 changed the title Serial Plotter - support a comment character to ignore incoming text lines Support a comment character to ignore incoming text lines Nov 18, 2022
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Nov 18, 2022
@navdotnetreqs
Copy link

Still not done?

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 type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

7 participants