File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -1021,22 +1021,20 @@ private void selectSerialPort(String name) {
10211021 //System.out.println(item.getLabel());
10221022
10231023 BaseNoGui .selectSerialPort (name );
1024- if (serialMonitor != null ) {
1025- try {
1024+ try {
1025+ boolean reopenMonitor = ((serialMonitor != null && serialMonitor .isVisible ()) ||
1026+ serialPlotter != null && serialPlotter .isVisible ());
1027+ if (serialMonitor != null ) {
10261028 serialMonitor .close ();
1027- serialMonitor .setVisible (false );
1028- } catch (Exception e ) {
1029- // ignore
10301029 }
1031- }
1032-
1033- if (serialPlotter != null ) {
1034- try {
1030+ if (serialPlotter != null ) {
10351031 serialPlotter .close ();
1036- serialPlotter .setVisible (false );
1037- } catch (Exception e ) {
1038- // ignore
10391032 }
1033+ if (reopenMonitor ) {
1034+ handleSerial ();
1035+ }
1036+ } catch (Exception e ) {
1037+ // ignore
10401038 }
10411039
10421040 onBoardOrPortChange ();
You can’t perform that action at this time.
0 commit comments