Skip to content

Commit

Permalink
Merge pull request #215 from makermelissa/serial-file-transfer
Browse files Browse the repository at this point in the history
Use newest REPL JS Library
  • Loading branch information
dhalbert authored Jul 17, 2024
2 parents f9228ce + abcf5a9 commit 5065085
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 23 deletions.
7 changes: 5 additions & 2 deletions js/workflows/usb.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ class USBWorkflow extends Workflow {
// Workflow specific Functions
async _switchToDevice(device) {
device.addEventListener("message", this.onSerialReceive.bind(this));
device.addEventListener("disconnect", async (e) => {
await this.onDisconnected(e, false);
});

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

await this.showBusy(this._getDeviceUid());

this.updateConnected(CONNSTATE.connected);

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

// Show the last step
Expand Down
3 changes: 2 additions & 1 deletion js/workflows/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Workflow {
this._showSerial = params.showSerialFunc;

this.repl.setTitle = this.setTerminalTitle.bind(this);
this.repl.writeToTerminal = this.writeToTerminal.bind(this);
this.repl.serialTransmit = this.serialTransmit.bind(this);
}

Expand Down Expand Up @@ -115,7 +116,7 @@ class Workflow {
}

async onSerialReceive(e) {
this.writeToTerminal(await this.repl.onSerialReceive(e));
await this.repl.onSerialReceive(e);
}

connectionStatus(partialConnectionsAllowed = false) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"@adafruit/ble-file-transfer-js": "adafruit/ble-file-transfer-js#1.0.2",
"@adafruit/circuitpython-repl-js": "adafruit/circuitpython-repl-js#2.1.1",
"@adafruit/circuitpython-repl-js": "adafruit/circuitpython-repl-js#3.0.0",
"@codemirror/lang-python": "^6.1.6",
"@fortawesome/fontawesome-free": "^6.5.2",
"@xterm/addon-fit": "^0.10.0",
Expand Down
5 changes: 2 additions & 3 deletions sass/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ h5 {
border: none;
background-color: $purple;
margin: 10px 0 10px 10px;
cursor: pointer;
white-space: nowrap;

i {
padding-left: 10px;
}

cursor: pointer;
white-space: nowrap;

&:first-of-type, &.first-item {
margin-left: 0;
}
Expand Down
13 changes: 7 additions & 6 deletions sass/layout/_grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
counter-increment: step;

.step-number {
&::before {
content: counter(step);
}
width: 75px;
height: 75px;
color: #333;
Expand All @@ -49,6 +46,10 @@
border: solid 5px #333;
border-radius: 100%;
min-width: 75px;

&::before {
content: counter(step);
}
}

&.hidden {
Expand All @@ -59,6 +60,9 @@

@media (max-width: $screen-xs-max) {
.connection-layout {
max-height: calc(100vh - 100px);
padding: 20px;

.step {
.step-number {
width: 50px;
Expand All @@ -68,8 +72,5 @@
min-width: 50px;
}
}

max-height: calc(100vh - 100px);
padding: 20px;
}
}
6 changes: 4 additions & 2 deletions sass/layout/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@

button {
@include rounded-button;
background-color: transparent;
margin: 0;
& {
background-color: transparent;
margin: 0;
}
}
}

Expand Down
12 changes: 6 additions & 6 deletions sass/layout/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@
border: 1px solid #888;

a {
padding-left: 5px;
display: grid;
grid-template-columns: 30px minmax(60px, 1fr) 60px 1fr;
grid-gap: 10px;
cursor: default;

&.hidden-file {

i,
Expand All @@ -363,12 +369,6 @@
}
}

padding-left: 5px;
display: grid;
grid-template-columns: 30px minmax(60px, 1fr) 60px 1fr;
grid-gap: 10px;
cursor: default;

&.selected {
background-color: $light-purple;
}
Expand Down

0 comments on commit 5065085

Please sign in to comment.