File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,6 +236,9 @@ class USBWorkflow extends Workflow {
236236 // Workflow specific Functions
237237 async _switchToDevice ( device ) {
238238 device . addEventListener ( "message" , this . onSerialReceive . bind ( this ) ) ;
239+ device . addEventListener ( "disconnect" , async ( e ) => {
240+ await this . onDisconnected ( e , false ) ;
241+ } ) ;
239242
240243 this . _serialDevice = device ;
241244 console . log ( "switch to" , this . _serialDevice ) ;
@@ -253,13 +256,13 @@ class USBWorkflow extends Workflow {
253256 await this . writer . ready ;
254257 }
255258
256- await this . showBusy ( this . _getDeviceUid ( ) ) ;
257-
258259 this . updateConnected ( CONNSTATE . connected ) ;
259260
260261 // At this point we should see if we should init the file client and check if have a saved dir handle
261262 let fileops = new FileOps ( this . repl , false ) ;
262263 if ( await fileops . isReadOnly ( ) ) {
264+ // UID Only needed for matching the CIRCUITPY drive with the Serial Terminal
265+ await this . showBusy ( this . _getDeviceUid ( ) ) ;
263266 let modal = this . connectDialog . getModal ( ) ;
264267
265268 // Show the last step
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ class Workflow {
6666 this . _showSerial = params . showSerialFunc ;
6767
6868 this . repl . setTitle = this . setTerminalTitle . bind ( this ) ;
69+ this . repl . writeToTerminal = this . writeToTerminal . bind ( this ) ;
6970 this . repl . serialTransmit = this . serialTransmit . bind ( this ) ;
7071 }
7172
@@ -115,7 +116,7 @@ class Workflow {
115116 }
116117
117118 async onSerialReceive ( e ) {
118- this . writeToTerminal ( await this . repl . onSerialReceive ( e ) ) ;
119+ await this . repl . onSerialReceive ( e ) ;
119120 }
120121
121122 connectionStatus ( partialConnectionsAllowed = false ) {
Original file line number Diff line number Diff line change 1414 },
1515 "dependencies" : {
1616 "@adafruit/ble-file-transfer-js" : " adafruit/ble-file-transfer-js#1.0.2" ,
17- "@adafruit/circuitpython-repl-js" : " adafruit/circuitpython-repl-js#2.1.1 " ,
17+ "@adafruit/circuitpython-repl-js" : " adafruit/circuitpython-repl-js#3.0.0 " ,
1818 "@codemirror/lang-python" : " ^6.1.6" ,
1919 "@fortawesome/fontawesome-free" : " ^6.5.2" ,
2020 "@xterm/addon-fit" : " ^0.10.0" ,
You can’t perform that action at this time.
0 commit comments