Skip to content

Commit 324da86

Browse files
committed
Adjust api to match new micropython.js
1 parent 0ee8055 commit 324da86

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

preload.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ board.chunk_sleep = 200
88

99
const Serial = {
1010
loadPorts: async () => {
11-
let ports = await board.listPorts()
11+
let ports = await board.list_ports()
1212
return ports.filter(p => p.vendorId && p.productId)
1313
},
1414
connect: async (path) => {
@@ -21,18 +21,20 @@ const Serial = {
2121
await board.exit_raw_repl()
2222
await board.enter_raw_repl()
2323
// Prevent executing empty string
24-
let result = await board.exec_raw({ command: code || '#' })
24+
let result = await board.exec_raw(code || '#')
2525
await board.exit_raw_repl()
2626
return Promise.resolve(result)
2727
},
2828
stop: async () => {
2929
await board.stop()
30-
return board.exit_raw_repl()
30+
await board.exit_raw_repl()
31+
return Promise.resolve()
3132
},
3233
reset: async () => {
3334
await board.stop()
3435
await board.exit_raw_repl()
35-
return board.reset()
36+
await board.reset()
37+
return Promise.resolve()
3638
},
3739
eval: (d) => {
3840
return board.eval(d)
@@ -41,10 +43,10 @@ const Serial = {
4143
board.serial.on('data', fn)
4244
},
4345
listFiles: async (folder) => {
44-
return await board.fs_ls(folder)
46+
return board.fs_ls(folder)
4547
},
4648
ilistFiles: async (folder) => {
47-
return await board.fs_ils(folder)
49+
return board.fs_ils(folder)
4850
},
4951
loadFile: async (file) => {
5052
const output = await board.fs_cat(file)
@@ -75,8 +77,7 @@ const Serial = {
7577
return await board.fs_mkdir(folder)
7678
},
7779
exit_raw_repl: async () => {
78-
board.in_raw_repl = true
79-
return await board.exit_raw_repl()
80+
return board.exit_raw_repl()
8081
}
8182
}
8283

0 commit comments

Comments
 (0)