Skip to content

Commit f3fb7f4

Browse files
committed
Don't check whether board is on raw repl
1 parent f99c746 commit f3fb7f4

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

preload.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,21 @@ const Serial = {
1818
return await board.close()
1919
},
2020
run: async (code) => {
21-
if (board.in_raw_repl) {
22-
await board.exit_raw_repl()
23-
}
21+
await board.exit_raw_repl()
2422
await board.enter_raw_repl()
2523
// Prevent executing empty string
2624
let result = await board.exec_raw({ command: code || '#' })
2725
await board.exit_raw_repl()
2826
return Promise.resolve(result)
2927
},
3028
stop: async () => {
31-
if (board.in_raw_repl) {
32-
await board.stop()
33-
return board.exit_raw_repl()
34-
} else {
35-
return board.stop()
36-
}
29+
await board.stop()
30+
return board.exit_raw_repl()
3731
},
3832
reset: async () => {
39-
if (board.in_raw_repl) {
40-
await board.stop()
41-
await board.exit_raw_repl()
42-
return board.reset()
43-
} else {
44-
return board.reset()
45-
}
33+
await board.stop()
34+
await board.exit_raw_repl()
35+
return board.reset()
4636
},
4737
eval: (d) => {
4838
return board.eval(d)

0 commit comments

Comments
 (0)