@@ -57,7 +57,7 @@ export class PlotterFrontendContribution extends Contribution {
57
57
58
58
registerCommands ( registry : CommandRegistry ) : void {
59
59
registry . registerCommand ( SerialPlotterContribution . Commands . OPEN , {
60
- execute : this . connect . bind ( this ) ,
60
+ execute : this . startPlotter . bind ( this ) ,
61
61
} ) ;
62
62
}
63
63
@@ -69,7 +69,20 @@ export class PlotterFrontendContribution extends Contribution {
69
69
} ) ;
70
70
}
71
71
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
+ ) ;
73
86
if ( ! ! this . window ) {
74
87
this . window . focus ( ) ;
75
88
return ;
@@ -104,8 +117,8 @@ export class PlotterFrontendContribution extends Contribution {
104
117
darkTheme : this . themeService . getCurrentTheme ( ) . type === 'dark' ,
105
118
wsPort,
106
119
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 ,
109
122
} ;
110
123
const urlWithParams = queryString . stringifyUrl (
111
124
{
0 commit comments