8000 Merge pull request #12 from arduino/bugfix/trimmed-files · arduino/micropython.js@c44ffe6 · GitHub
[go: up one dir, main page]

Skip to content

Commit c44ffe6

Browse files
authored
Merge pull request #12 from arduino/bugfix/trimmed-files
Bugfix/trimmed files
2 parents 4648998 + 1aaaf5d commit c44ffe6

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

micropython.js

Lines changed: 7 additions & 6 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 {
@@ -114,9 +115,9 @@ class MicroPythonBoard {
114115
}
115116

116117
async get_prompt() {
117-
await sleep(100)
118+
await sleep(150)
118119
await this.stop()
119-
await sleep(100)
120+
await sleep(150)
120121
const out = await this.write_and_read_until(`\r\x03\x02`, '\r\n>>>')
121122
return Promise.resolve(out)
122123
}
@@ -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

@@ -257,7 +258,7 @@ class MicroPythonBoard {
257258
)
258259
await this.exit_raw_repl()
259260
output = extract(output)
260-
return Promise.resolve(output)
261+
return Promise.resolve(fixLineBreak(output))
261262
}
262263
return Promise.reject(new Error(`Path to file was not specified`))
263264
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "micropython.js",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"description": "Interpretation of pyboard.py in javascript",
55
"main": "micropython.js",
66
"scripts": {

0 commit comments

Comments
 (0)
0