@@ -87,6 +87,17 @@ export class SerialConnectionManager {
87
87
this . monitorServiceClient . onWebSocketChanged (
88
88
this . handleWebSocketChanged . bind ( this )
89
89
) ;
90
+ this . monitorServiceClient . onBaudRateChanged ( ( baudRate ) => {
91
+ if ( this . monitorModel . baudRate !== baudRate ) {
92
+ this . monitorModel . baudRate = baudRate ;
93
+ }
94
+ } ) ;
95
+ this . monitorServiceClient . onLineEndingChanged ( ( lineending ) => {
96
+ if ( this . monitorModel . lineEnding !== lineending ) {
97
+ this . monitorModel . lineEnding = lineending ;
98
+ }
99
+ } ) ;
100
+
90
101
this . monitorServiceClient . onError ( this . handleError . bind ( this ) ) ;
91
102
this . boardsServiceProvider . onBoardsConfigChanged (
92
103
this . handleBoardConfigChange . bind ( this )
@@ -100,6 +111,16 @@ export class SerialConnectionManager {
100
111
const { boardsConfig } = this . boardsServiceProvider ;
101
112
this . handleBoardConfigChange ( boardsConfig ) ;
102
113
}
114
+
115
+ // update the current values in the backend and propagate to websocket clients
116
+ this . monitorService . updateWsConfigParam ( {
117
+ ...( property === 'baudRate' && {
118
+ currentBaudrate : this . monitorModel . baudRate ,
119
+ } ) ,
120
+ ...( property === 'lineEnding' && {
121
+ currentLineEnding : this . monitorModel . lineEnding ,
122
+ } ) ,
123
+ } ) ;
103
124
} ) ;
104
125
105
126
this . themeService . onDidColorThemeChange ( ( theme ) => {
@@ -452,10 +473,6 @@ export class SerialConnectionManager {
452
473
if ( ports . some ( ( port ) => Port . equals ( port , boardsConfig . selectedPort ) ) ) {
453
474
const { selectedBoard : board , selectedPort : port } = boardsConfig ;
454
475
const { baudRate } = this . monitorModel ;
455
- // update the baudrate on the config
456
- this . monitorService . updateWsConfigParam ( {
457
- currentBaudrate : baudRate ,
458
- } ) ;
459
476
const newConfig : MonitorConfig = { board, port, baudRate } ;
460
477
this . setConfig ( newConfig ) ;
461
478
}
0 commit comments