Skip to content

Commit 3141fb6

Browse files
committed
Limit the SerialPlotter to max 20 graphs
1 parent 378736e commit 3141fb6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/src/processing/app/SerialPlotter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class SerialPlotter extends AbstractMonitor {
4242

4343
private ArrayList<Graph> graphs;
4444
private final static int BUFFER_CAPACITY = 500;
45+
private final static int MAX_GRAPH_COUNT = 20;
4546

4647
private static class Graph {
4748
public CircularBuffer buffer;
@@ -282,7 +283,7 @@ public void message(final String s) {
282283
}
283284

284285
int validParts = 0;
285-
for(int i = 0; i < parts.length; ++i) {
286+
for(int i = 0; i < parts.length && validParts < MAX_GRAPH_COUNT; ++i) {
286287
try {
287288
double value = Double.valueOf(parts[i]);
288289
if(validParts >= graphs.size()) {

0 commit comments

Comments
 (0)