@@ -9,6 +9,8 @@ const DEFAULT_PORT = "noselection";
99const DEFAULT_BAUDS = 115200 ;
1010
1111const PortHandler = new ( function ( ) {
12+ this . logHead = "[PORTHANDLER]" ;
13+
1214 this . currentSerialPorts = [ ] ;
1315 this . currentUsbPorts = [ ] ;
1416 this . currentBluetoothPorts = [ ] ;
@@ -118,15 +120,15 @@ PortHandler.updateCurrentSerialPortsList = async function () {
118120 const ports = await serial . getDevices ( ) ;
119121 const orderedPorts = this . sortPorts ( ports ) ;
120122 this . portAvailable = orderedPorts . length > 0 ;
121-
123+ console . log ( ` ${ this . logHead } Found serial port` , orderedPorts ) ;
122124 this . currentSerialPorts = [ ...orderedPorts ] ;
123125} ;
124126
125127PortHandler . updateCurrentUsbPortsList = async function ( ) {
126128 const ports = await usb . getDevices ( ) ;
127129 const orderedPorts = this . sortPorts ( ports ) ;
128130 this . dfuAvailable = orderedPorts . length > 0 ;
129-
131+ console . log ( ` ${ this . logHead } Found DFU port` , orderedPorts ) ;
130132 this . currentUsbPorts = [ ...orderedPorts ] ;
131133} ;
132134
@@ -135,7 +137,7 @@ PortHandler.updateCurrentBluetoothPortsList = async function () {
135137 const ports = await BT . getDevices ( ) ;
136138 const orderedPorts = this . sortPorts ( ports ) ;
137139 this . bluetoothAvailable = orderedPorts . length > 0 ;
138-
140+ console . log ( ` ${ this . logHead } Found bluetooth port` , orderedPorts ) ;
139141 this . currentBluetoothPorts = [ ...orderedPorts ] ;
140142 }
141143} ;
@@ -236,11 +238,10 @@ PortHandler.selectActivePort = function (suggestedDevice) {
236238 // Return the default port if no other port was selected
237239 this . portPicker . selectedPort = selectedPort || DEFAULT_PORT ;
238240
239- console . log ( `[PORTHANDLER] automatically selected device is '${ this . portPicker . selectedPort } '` ) ;
240-
241- // hack to update Vue component
242- const p = document . getElementById ( "port" ) ;
243- p . value = this . portPicker . selectedPort ;
241+ console . log (
242+ `${ this . logHead } Automatically selected device is '${ this . portPicker . selectedPort } ' - suggested:` ,
243+ suggestedDevice ,
244+ ) ;
244245
245246 return selectedPort ;
246247} ;
0 commit comments