Skip to content

Commit 6c75f09

Browse files
author
Wilhelm Wiens
committed
Remove unused variable in paintComponent
do not modify parameter in setNewBufferCapacity
1 parent ef48f53 commit 6c75f09

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

app/src/processing/app/SerialPlotter.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ public void paintComponent(Graphics g1) {
190190

191191
g.setTransform(AffineTransform.getTranslateInstance(xOffset, 0));
192192
float xstep = (float) (bounds.width - xOffset - xPadding) / (float) buffer_capacity;
193-
int legendLength = graphs.size() * 10 + (graphs.size() - 1) * 3;
194-
193+
195194
// draw legend
196195
int legendXOffset = 0;
197196
for(int i = 0; i < graphs.size(); ++i) {
@@ -298,13 +297,16 @@ private void onSerialRateChange(ActionListener listener) {
298297

299298
private void setNewBufferCapacity(int capacity){
300299
if(buffer_capacity != capacity) {
301-
if(capacity > BUFFER_CAPACITY_MAX) capacity = BUFFER_CAPACITY_MAX;
302-
else if(capacity < BUFFER_CAPACITY_MIN) capacity = BUFFER_CAPACITY_MIN;
303-
buffer_capacity = capacity;
300+
301+
if(capacity > BUFFER_CAPACITY_MAX) buffer_capacity = BUFFER_CAPACITY_MAX;
302+
else if(capacity < BUFFER_CAPACITY_MIN) buffer_capacity = BUFFER_CAPACITY_MIN;
303+
else buffer_capacity = capacity;
304+
304305
for(int i = 0; i < graphs.size(); i++) {
305-
graphs.get(i).buffer.newCapacity(capacity);
306+
graphs.get(i).buffer.newCapacity(buffer_capacity);
306307
}
307-
xCount=0;
308+
309+
xCount = 0;
308310
}
309311
}
310312

@@ -377,7 +379,7 @@ public void message(final String s) {
377379
}
378380
if(label != null) {
379381
if(validLabels >= graphs.size()) {
380-
graphs.add(new Graph(validLabels));
382+
graphs.add(new Graph(validLabels, BUFFER_CAPACITY_DEFAULT));
381383
}
382384
graphs.get(validLabels).label = label;
383385
validLabels++;

0 commit comments

Comments
 (0)