Skip to content

Commit 5065085

Browse files
authored
Merge pull request #215 from makermelissa/serial-file-transfer
Use newest REPL JS Library
2 parents f9228ce + abcf5a9 commit 5065085

File tree

8 files changed

+29
-23
lines changed

8 files changed

+29
-23
lines changed

js/workflows/usb.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ class USBWorkflow extends Workflow {
236236
// Workflow specific Functions
237237
async _switchToDevice(device) {
238238
device.addEventListener("message", this.onSerialReceive.bind(this));
239+
device.addEventListener("disconnect", async (e) => {
240+
await this.onDisconnected(e, false);
241+
});
239242

240243
this._serialDevice = device;
241244
console.log("switch to", this._serialDevice);
@@ -253,13 +256,13 @@ class USBWorkflow extends Workflow {
253256
await this.writer.ready;
254257
}
255258

256-
await this.showBusy(this._getDeviceUid());
257-
258259
this.updateConnected(CONNSTATE.connected);
259260

260261
// At this point we should see if we should init the file client and check if have a saved dir handle
261262
let fileops = new FileOps(this.repl, false);
262263
if (await fileops.isReadOnly()) {
264+
// UID Only needed for matching the CIRCUITPY drive with the Serial Terminal
265+
await this.showBusy(this._getDeviceUid());
263266
let modal = this.connectDialog.getModal();
264267

265268
// Show the last step

js/workflows/workflow.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class Workflow {
6666
this._showSerial = params.showSerialFunc;
6767

6868
this.repl.setTitle = this.setTerminalTitle.bind(this);
69+
this.repl.writeToTerminal = this.writeToTerminal.bind(this);
6970
this.repl.serialTransmit = this.serialTransmit.bind(this);
7071
}
7172

@@ -115,7 +116,7 @@ class Workflow {
115116
}
116117

117118
async onSerialReceive(e) {
118-
this.writeToTerminal(await this.repl.onSerialReceive(e));
119+
await this.repl.onSerialReceive(e);
119120
}
120121

121122
connectionStatus(partialConnectionsAllowed = false) {

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
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"@adafruit/ble-file-transfer-js": "adafruit/ble-file-transfer-js#1.0.2",
17-
"@adafruit/circuitpython-repl-js": "adafruit/circuitpython-repl-js#2.1.1",
17+
"@adafruit/circuitpython-repl-js": "adafruit/circuitpython-repl-js#3.0.0",
1818
"@codemirror/lang-python": "^6.1.6",
1919
"@fortawesome/fontawesome-free": "^6.5.2",
2020
"@xterm/addon-fit": "^0.10.0",

sass/base/_base.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,13 @@ h5 {
4848
border: none;
4949
background-color: $purple;
5050
margin: 10px 0 10px 10px;
51+
cursor: pointer;
52+
white-space: nowrap;
5153

5254
i {
5355
padding-left: 10px;
5456
}
5557

56-
cursor: pointer;
57-
white-space: nowrap;
58-
5958
&:first-of-type, &.first-item {
6059
margin-left: 0;
6160
}

sass/layout/_grid.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
counter-increment: step;
3636

3737
.step-number {
38-
&::before {
39-
content: counter(step);
40-
}
4138
width: 75px;
4239
height: 75px;
4340
color: #333;
@@ -49,6 +46,10 @@
4946
border: solid 5px #333;
5047
border-radius: 100%;
5148
min-width: 75px;
49+
50+
&::before {
51+
content: counter(step);
52+
}
5253
}
5354

5455
&.hidden {
@@ -59,6 +60,9 @@
5960

6061
@media (max-width: $screen-xs-max) {
6162
.connection-layout {
63+
max-height: calc(100vh - 100px);
64+
padding: 20px;
65+
6266
.step {
6367
.step-number {
6468
width: 50px;
@@ -68,8 +72,5 @@
6872
min-width: 50px;
6973
}
7074
}
71-
72-
max-height: calc(100vh - 100px);
73-
padding: 20px;
7475
}
7576
}

sass/layout/_header.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@
101101

102102
button {
103103
@include rounded-button;
104-
background-color: transparent;
105-
margin: 0;
104+
& {
105+
background-color: transparent;
106+
margin: 0;
107+
}
106108
}
107109
}
108110

sass/layout/_layout.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@
355355
border: 1px solid #888;
356356

357357
a {
358+
padding-left: 5px;
359+
display: grid;
360+
grid-template-columns: 30px minmax(60px, 1fr) 60px 1fr;
361+
grid-gap: 10px;
362+
cursor: default;
363+
358364
&.hidden-file {
359365

360366
i,
@@ -363,12 +369,6 @@
363369
}
364370
}
365371

366-
padding-left: 5px;
367-
display: grid;
368-
grid-template-columns: 30px minmax(60px, 1fr) 60px 1fr;
369-
grid-gap: 10px;
370-
cursor: default;
371-
372372
&.selected {
373373
background-color: $light-purple;
374374
}

0 commit comments

Comments
 (0)