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