File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ button.small .icon {
131131
132132# tabs {
133133 display : flex;
134- padding : 10px 10px 0px 40 px ;
134+ padding : 10px 10px 0px 60 px ;
135135 align-items : center;
136136 gap : 10px ;
137137 align-self : stretch;
@@ -231,7 +231,7 @@ button.small .icon {
231231# code-editor .cm-gutters {
232232 background-color : # ECF1F1 ;
233233 border-right : none;
234- width : 40 px ;
234+ width : 60 px ;
235235 font-size : 14px ;
236236}
237237
Original file line number Diff line number Diff line change @@ -122,14 +122,28 @@ async function store(state, emitter) {
122122 state . isConnecting = true
123123 emitter . emit ( 'render' )
124124
125- let timeout_id = setTimeout ( ( ) => emitter . emit ( 'connection-timeout' ) , 5000 )
126- await serial . connect ( path )
127- clearTimeout ( timeout_id )
128-
125+ // The following Timeout operation will be cleared after a succesful getPrompt()
126+ // If a board has crashed and/or cannot return a REPL prompt, the connection will fail
127+ // and the user will be prompted to reset the device and try again.
128+ let timeout_id = setTimeout ( ( ) => {
129+ let response = win . openDialog ( {
130+ type : 'question' ,
131+ buttons : [ 'OK' ] ,
132+ cancelId : 0 ,
133+ message : "Could not connect to the board. Reset it and try again."
134+ } )
135+ console . log ( 'Reset request acknowledged' , response )
136+ emitter . emit ( 'connection-timeout' )
137+ } , 3500 )
138+ try {
139+ await serial . connect ( path )
140+ } catch ( e ) {
141+ console . error ( e )
142+ }
129143 // Stop whatever is going on
130144 // Recover from getting stuck in raw repl
131145 await serial . getPrompt ( )
132-
146+ clearTimeout ( timeout_id )
133147 // Connected and ready
134148 state . isConnecting = false
135149 state . isConnected = true
You can’t perform that action at this time.
0 commit comments