Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 97312fc

Browse files
author
Alberto Iannaccone
committedMay 26, 2022
fix serial plotter opening
1 parent 29a4ed4 commit 97312fc

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed
 

‎arduino-ide-extension/src/browser/serial/plotter/plotter-frontend-contribution.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class PlotterFrontendContribution extends Contribution {
5757

5858
registerCommands(registry: CommandRegistry): void {
5959
registry.registerCommand(SerialPlotterContribution.Commands.OPEN, {
60-
execute: this.connect.bind(this),
60+
execute: this.startPlotter.bind(this),
6161
});
6262
}
6363

@@ -69,7 +69,20 @@ export class PlotterFrontendContribution extends Contribution {
6969
});
7070
}
7171

72-
async connect(): Promise<void> {
72+
async startPlotter(): Promise<void> {
73+
if (
74+
!this.boardsServiceProvider.boardsConfig.selectedBoard ||
75+
!this.boardsServiceProvider.boardsConfig.selectedPort
76+
) {
77+
this.messageService.error(
78+
`You need to select a connected board to start the serial plotter`
79+
);
80+
return;
81+
}
82+
await this.monitorManagerProxy.startMonitor(
83+
this.boardsServiceProvider.boardsConfig.selectedBoard,
84+
this.boardsServiceProvider.boardsConfig.selectedPort
85+
);
7386
if (!!this.window) {
7487
this.window.focus();
7588
return;
@@ -104,8 +117,8 @@ export class PlotterFrontendContribution extends Contribution {
104117
darkTheme: this.themeService.getCurrentTheme().type === 'dark',
105118
wsPort,
106119
interpolate: this.model.interpolate,
107-
connected: await this.monitorManagerProxy.isWSConnected(),
108-
serialPort: this.boardsServiceProvider.boardsConfig.selectedPort?.address,
120+
connected: this.model.connected,
121+
serialPort: this.model.serialPort,
109122
};
110123
const urlWithParams = queryString.stringifyUrl(
111124
{

0 commit comments

Comments
 (0)
Please sign in to comment.