Skip to content

Commit b70a767

Browse files
committed
Make sure to get a clean repl before performing actions
1 parent 79b754e commit b70a767

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ui/arduino/store.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,14 @@ function store(state, emitter) {
135135
if (!state.isTerminalOpen) emitter.emit('show-terminal')
136136
let editor = state.cache(AceEditor, 'editor').editor
137137
let code = editor.getValue()
138+
await serial.stop()
138139
await serial.run(code)
139140
emitter.emit('render')
140141
})
141142
emitter.on('stop', async () => {
142143
log('stop')
143144
await serial.stop()
145+
await serial.exit_raw_repl()
144146
emitter.emit('render')
145147
})
146148
emitter.on('reset', async () => {
@@ -173,6 +175,7 @@ function store(state, emitter) {
173175
emitter.emit('message', `Saving ${filename} on ${deviceName}.`)
174176

175177
if (state.selectedDevice === 'serial') {
178+
await serial.stop()
176179
await serial.saveFileContent(
177180
serial.getFullPath(
178181
state.serialPath,
@@ -213,6 +216,7 @@ function store(state, emitter) {
213216

214217
if (confirm(`Do you want to remove ${state.selectedFile} from ${deviceName}?`)) {
215218
if (state.selectedDevice === 'serial') {
219+
await serial.stop()
216220
await serial.removeFile(state.serialNavigation + '/' + state.selectedFile)
217221
emitter.emit('new-file', 'serial')
218222
}
@@ -253,6 +257,7 @@ function store(state, emitter) {
253257

254258
let content = ''
255259
if (state.selectedDevice === 'serial') {
260+
await serial.stop()
256261
content = await serial.loadFile(
257262
serial.getFullPath(
258263
state.serialPath,
@@ -417,6 +422,7 @@ function store(state, emitter) {
417422
let contents = cleanCharacters(editor.getValue())
418423
editor.setValue(contents)
419424
if (state.unsavedChanges) {
425+
await serial.stop()
420426
await serial.saveFileContent(
421427
serial.getFullPath(
422428
state.serialPath,
@@ -527,6 +533,7 @@ function store(state, emitter) {
527533
editor.setValue(contents)
528534

529535
if (state.isConnected && state.selectedDevice === 'serial') {
536+
await serial.stop()
530537
// Ask for confirmation to overwrite existing file
531538
let confirmation = true
532539
if (state.serialFiles.find(f => f.path === filename)) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy