File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 7070@ SuppressWarnings ("serial" )
7171public class Editor extends JFrame implements RunnerListener {
7272
73+ public static final int MAX_TIME_AWAITING_FOR_RESUMING_SERIAL_MONITOR = 5000 ;
74+
7375 private final Platform platform ;
7476 private JMenu recentSketchesMenu ;
7577
@@ -2411,6 +2413,16 @@ private void resumeOrCloseSerialMonitor() {
24112413 // Return the serial monitor window to its initial state
24122414 if (serialMonitor != null ) {
24132415 BoardPort boardPort = BaseNoGui .getDiscoveryManager ().find (PreferencesData .get ("serial.port" ));
2416+ long sleptFor = 0 ;
2417+ while (boardPort == null && sleptFor < MAX_TIME_AWAITING_FOR_RESUMING_SERIAL_MONITOR ) {
2418+ try {
2419+ Thread .sleep (100 );
2420+ sleptFor += 100 ;
2421+ boardPort = BaseNoGui .getDiscoveryManager ().find (PreferencesData .get ("serial.port" ));
2422+ } catch (InterruptedException e ) {
2423+ // noop
2424+ }
2425+ }
24142426 try {
24152427 if (boardPort == null ) {
24162428 serialMonitor .close ();
You can’t perform that action at this time.
0 commit comments