Skip to content

Commit f66b83d

Browse files
committed
Revert "close SerialMonitor when port goes away suddenly (as when user presses Leonardo reset button)"
This reverts commit e9a00eb.
1 parent 202bb10 commit f66b83d

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

Diff for: app/src/processing/app/SerialMonitor.java

+1-28
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@
2828
import javax.swing.border.*;
2929
import javax.swing.event.*;
3030
import javax.swing.text.*;
31-
import gnu.io.CommPortIdentifier;
32-
import java.util.Enumeration;
3331

34-
public class SerialMonitor extends JFrame implements MessageConsumer, Runnable {
32+
public class SerialMonitor extends JFrame implements MessageConsumer {
3533
private Serial serial;
3634
private String port;
3735
private JTextArea textArea;
@@ -173,9 +171,6 @@ public void actionPerformed(ActionEvent event) {
173171
}
174172
}
175173
}
176-
177-
Thread thread = new Thread(this);
178-
thread.start();
179174
}
180175

181176
protected void setPlacement(int[] location) {
@@ -233,26 +228,4 @@ public void run() {
233228
}
234229
}});
235230
}
236-
237-
public void run() {
238-
while (!Thread.interrupted()) {
239-
if (serial != null) {
240-
Enumeration portList = CommPortIdentifier.getPortIdentifiers();
241-
boolean portStillHere = false;
242-
while (portList.hasMoreElements()) {
243-
CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement();
244-
if (portId.getName().equals(port)) {
245-
portStillHere = true;
246-
}
247-
}
248-
if (!portStillHere) {
249-
closeSerialPort();
250-
setVisible(false);
251-
}
252-
try {
253-
Thread.sleep(100);
254-
} catch (InterruptedException ex) { }
255-
}
256-
}
257-
}
258231
}

0 commit comments

Comments
 (0)