Skip to content

Commit adfef3a

Browse files
authored
Merge pull request #151 from arduino/development
Development to main
2 parents 7da32ee + 9f56d75 commit adfef3a

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

Diff for: ui/arduino/main.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ button.small .icon {
131131

132132
#tabs {
133133
display: flex;
134-
padding: 10px 10px 0px 40px;
134+
padding: 10px 10px 0px 60px;
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: 40px;
234+
width: 60px;
235235
font-size: 14px;
236236
}
237237

Diff for: ui/arduino/store.js

+19-5
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)