mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-10-13 05:18:33 +00:00
ATL-469: Fixed various serial-monitor issues.
- Fixed a monitor reconnecting issue after upload. - Serial monitor connection was not disposed when the widget was closed from the toolbar with the magnifier (🔍) icon. It worked only iff the user closed the view with the `X`. - This commit also fixes a warning that was related to the incorrect focus handling of the widget. - Switched to `board list -w` instead of polling. - Added a singleton for the board discovery to spare the CPU. - Fixed DI scopes on the backend. Each frontend gets its own service. - Switched to the `20201112` nightly CLI. - Fixed the Monitor view's image when the view is on the side-bar. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
@@ -77,9 +77,14 @@ export class UploadSketch extends SketchContribution {
|
||||
if (!uri) {
|
||||
return;
|
||||
}
|
||||
let shouldAutoConnect = false;
|
||||
const monitorConfig = this.monitorConnection.monitorConfig;
|
||||
if (monitorConfig) {
|
||||
await this.monitorConnection.disconnect();
|
||||
if (this.monitorConnection.autoConnect) {
|
||||
shouldAutoConnect = true;
|
||||
}
|
||||
this.monitorConnection.autoConnect = false;
|
||||
}
|
||||
try {
|
||||
const { boardsConfig } = this.boardsServiceClientImpl;
|
||||
@@ -122,7 +127,18 @@ export class UploadSketch extends SketchContribution {
|
||||
this.messageService.error(e.toString());
|
||||
} finally {
|
||||
if (monitorConfig) {
|
||||
await this.monitorConnection.connect(monitorConfig);
|
||||
const { board, port } = monitorConfig;
|
||||
try {
|
||||
await this.boardsServiceClientImpl.waitUntilAvailable(Object.assign(board, { port }), 10_000);
|
||||
if (shouldAutoConnect) {
|
||||
// Enabling auto-connect will trigger a connect.
|
||||
this.monitorConnection.autoConnect = true;
|
||||
} else {
|
||||
await this.monitorConnection.connect(monitorConfig);
|
||||
}
|
||||
} catch (waitError) {
|
||||
this.messageService.error(`Could not reconnect to serial monitor. ${waitError.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user