Skip to content

Commit 7ae8f20

Browse files
authored
Merge pull request #418 from makermelissa/beta
Merge Beta
2 parents bffc98c + f28235a commit 7ae8f20

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
<div id="serial-page" class="">
9797
<div id="serial-bar">
9898
<button class="purple-button btn-restart">Restart<i class="fa-solid fa-redo"></i></button>
99+
<button class="purple-button btn-halt">Halt<i class="fa-solid fa-hand"></i></button>
99100
<button class="purple-button btn-clear">Clear<i class="fa-solid fa-broom"></i></button>
100101
<button class="purple-button btn-plotter">Plotter<i class="fa-solid fa-chart-line"></i></button>
101102
<div id="terminal-title"></div>

js/common/file_dialog.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,9 @@ class FileDialog extends GenericModal {
291291
} else if (clickedItem.getAttribute("data-type") != "folder") {
292292
this._getElement('fileNameField').value = clickedItem.querySelector("span").innerHTML;
293293
}
294-
295-
this._lastSelectedNode = clickedItem;
294+
if (this._lastSelectedNode == null || !modifierKeys.includes(MODIFIER_SHIFT)) {
295+
this._lastSelectedNode = clickedItem;
296+
}
296297
this._setElementEnabled('okButton', !this._multipleItemsSelected() && clickedItem.getAttribute("data-type") != "bin");
297298
this._updateToolbar();
298299
}

js/layout.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ function refitTerminal() {
139139
if (xterm_screen) {
140140
let cols = Math.floor(terminalWidth / TERMINAL_COL_WIDTH);
141141
let rows = Math.floor(terminalHeight / TERMINAL_ROW_HEIGHT);
142-
console.log(rows, cols, terminalHeight, terminalWidth, TERMINAL_ROW_HEIGHT, TERMINAL_COL_WIDTH);
143142
if (cols < MINIMUM_COLS) {
144143
cols = MINIMUM_COLS;
145144
}

js/script.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ let unchanged = 0;
3333
let connectionPromise = null;
3434

3535
const btnRestart = document.querySelector('.btn-restart');
36+
const btnHalt = document.querySelector('.btn-halt');
3637
const btnPlotter = document.querySelector('.btn-plotter');
3738
const btnClear = document.querySelector('.btn-clear');
3839
const btnConnect = document.querySelectorAll('.btn-connect');
@@ -130,6 +131,14 @@ btnRestart.addEventListener('click', async function(e) {
130131
}
131132
});
132133

134+
// Halt Button
135+
btnHalt.addEventListener('click', async function(e) {
136+
if (await checkConnected()) {
137+
// Perform a device soft halt
138+
await workflow.haltScript();
139+
}
140+
});
141+
133142
// Clear Button
134143
btnClear.addEventListener('click', async function(e) {
135144
if (workflow.plotterChart){

js/workflows/ble.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,14 @@ class BLEWorkflow extends Workflow {
253253
}
254254
// Is this a new connection?
255255
if (!this.bleDevice) {
256-
let devices = await navigator.bluetooth.getDevices();
257-
for (const device of devices) {
258-
await this.connectToBluetoothDevice(device);
256+
try {
257+
let devices = await navigator.bluetooth.getDevices();
258+
for (const device of devices) {
259+
await this.connectToBluetoothDevice(device);
260+
}
261+
} catch (error) {
262+
console.error(error);
263+
this.showConnectStatus(this._suggestBLEConnectActions(error));
259264
}
260265
}
261266
}

js/workflows/workflow.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ class Workflow {
9191
}
9292

9393
async restartDevice() {
94-
this.repl.softRestart();
94+
await this.repl.softRestart();
95+
}
96+
97+
async haltScript() {
98+
await this.repl.interruptCode();
9599
}
96100

97101
makeDocState(document, docChangePos) {

0 commit comments

Comments
 (0)