-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Comments
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: "^.+$". 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. |
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) |
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? |
For most use cases this would probably be enough. It is easy to just prefix log messages with |
hi everyone, has anyone found a solution to exclude some outputs from the Serial plotter without having to patch the java file? |
@per1234 the other issue in #21 can be marked as duplicate. please double read the explanation of @madsdyd here:
|
Still not done? |
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.
The text was updated successfully, but these errors were encountered: