8000 Skip trimming when extracting data from serial · arduino/micropython.js@5d8619b · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d8619b

Browse files
committed
Skip trimming when extracting data from serial
1 parent dd922a8 commit 5d8619b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

micropython.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ function fixLineBreak(str) {
1919
function extract(out) {
2020
/*
2121
* Message ($msg) will come out following this template:
22-
* "OK${msg}\x04\x04>"
22+
* "OK${msg}\x04${err}\x04>"
23+
* TODO: consider error handling
2324
*/
24-
return out.slice(2, -3).trim()
25+
return out.slice(2, -3)
2526
}
2627

2728
class MicroPythonBoard {
@@ -206,7 +207,7 @@ class MicroPythonBoard {
206207
await this.enter_raw_repl()
207208
let output = await this.exec_raw(command)
208209
await this.exit_raw_repl()
209-
const exists = extract(output) == '1'
210+
const exists = output[2] == '1'
210211
return Promise.resolve(exists)
211212
}
212213

0 commit comments

Comments
 (0)
0