Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions app/src/processing/app/SerialPlotter.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class SerialPlotter extends AbstractMonitor {

private ArrayList<Graph> graphs;
private final static int BUFFER_CAPACITY = 500;
private final static int MAX_GRAPH_COUNT = 20;

private static class Graph {
public CircularBuffer buffer;
Expand Down Expand Up @@ -412,26 +413,26 @@ public void message(final String s) {

int validParts = 0;
int validLabels = 0;
for(int i = 0; i < parts.length; ++i) {
for(int i = 0; i < parts.length && validParts < MAX_GRAPH_COUNT; ++i) {
Double value = null;
String label = null;

// column formated name value pair
if(parts[i].contains(":")) {
// get label
String[] subString = parts[i].split("[:]+");

if(subString.length > 0) {
int labelLength = subString[0].length();

if(labelLength > 32) {
labelLength = 32;
}
label = subString[0].substring(0, labelLength);
} else {
label = "";
}

if(subString.length > 1) {
parts[i] = subString[1];
} else {
Expand All @@ -448,7 +449,7 @@ public void message(final String s) {
if(label == null && value == null) {
label = parts[i];
}

if(value != null) {
if(validParts >= graphs.size()) {
graphs.add(new Graph(validParts));
Expand Down