1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-31 20:52:13 +01:00

Reopen serial monitor on correct port if changed from menu

This commit is contained in:
Martino Facchin 2018-10-01 13:26:06 +02:00
parent 465c766efb
commit e7d85d8b6d

View File

@ -1015,22 +1015,20 @@ public class Editor extends JFrame implements RunnerListener {
//System.out.println(item.getLabel()); //System.out.println(item.getLabel());
BaseNoGui.selectSerialPort(name); BaseNoGui.selectSerialPort(name);
if (serialMonitor != null) { try {
try { boolean reopenMonitor = ((serialMonitor != null && serialMonitor.isVisible()) ||
serialPlotter != null && serialPlotter.isVisible());
if (serialMonitor != null) {
serialMonitor.close(); serialMonitor.close();
serialMonitor.setVisible(false);
} catch (Exception e) {
// ignore
} }
} if (serialPlotter != null) {
if (serialPlotter != null) {
try {
serialPlotter.close(); serialPlotter.close();
serialPlotter.setVisible(false);
} catch (Exception e) {
// ignore
} }
if (reopenMonitor) {
handleSerial();
}
} catch (Exception e) {
// ignore
} }
onBoardOrPortChange(); onBoardOrPortChange();