Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8139e85

Browse files
author
Federico Fissore
committed
On some OSs, some boards may take time before reappearing. Better wait for them 5 reasonable seconds
1 parent c138628 commit 8139e85

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎app/src/processing/app/Editor.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
@SuppressWarnings("serial")
7171
public 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();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /