Skip to content

Commit 66117a5

Browse files
author
Federico Fissore
committed
Burn Bootloader was run in the UI thread, avoiding intermediate messages to be printed to IDE console
1 parent 91245e2 commit 66117a5

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

app/src/processing/app/Editor.java

+20-20
Original file line numberDiff line numberDiff line change
@@ -2748,28 +2748,28 @@ public void handlePlotter() {
27482748
private void handleBurnBootloader() {
27492749
console.clear();
27502750
statusNotice(tr("Burning bootloader to I/O Board (this may take a minute)..."));
2751-
SwingUtilities.invokeLater(new Runnable() {
2752-
public void run() {
2753-
try {
2754-
Uploader uploader = new SerialUploader();
2755-
if (uploader.burnBootloader()) {
2756-
statusNotice(tr("Done burning bootloader."));
2757-
} else {
2758-
statusError(tr("Error while burning bootloader."));
2759-
// error message will already be visible
2760-
}
2761-
} catch (PreferencesMapException e) {
2762-
statusError(I18n.format(
2763-
tr("Error while burning bootloader: missing '{0}' configuration parameter"),
2764-
e.getMessage()));
2765-
} catch (RunnerException e) {
2766-
statusError(e.getMessage());
2767-
} catch (Exception e) {
2768-
statusError(tr("Error while burning bootloader."));
2769-
e.printStackTrace();
2751+
new Thread(() -> {
2752+
try {
2753+
Uploader uploader = new SerialUploader();
2754+
if (uploader.burnBootloader()) {
2755+
SwingUtilities.invokeLater(() -> statusNotice(tr("Done burning bootloader.")));
2756+
} else {
2757+
SwingUtilities.invokeLater(() -> statusError(tr("Error while burning bootloader.")));
2758+
// error message will already be visible
27702759
}
2760+
} catch (PreferencesMapException e) {
2761+
SwingUtilities.invokeLater(() -> {
2762+
statusError(I18n.format(
2763+
tr("Error while burning bootloader: missing '{0}' configuration parameter"),
2764+
e.getMessage()));
2765+
});
2766+
} catch (RunnerException e) {
2767+
SwingUtilities.invokeLater(() -> statusError(e.getMessage()));
2768+
} catch (Exception e) {
2769+
SwingUtilities.invokeLater(() -> statusError(tr("Error while burning bootloader.")));
2770+
e.printStackTrace();
27712771
}
2772-
});
2772+
}).start();
27732773
}
27742774

27752775

0 commit comments

Comments
 (0)