From 0e2de18cf7d4a3545fdff23a32625ee2d9ca02ca Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 1 Oct 2025 14:46:35 -0700 Subject: [PATCH 1/3] Add try blocks to ble and remove debug message --- js/layout.js | 1 - js/workflows/ble.js | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/js/layout.js b/js/layout.js index bad77da..8323a67 100644 --- a/js/layout.js +++ b/js/layout.js @@ -139,7 +139,6 @@ function refitTerminal() { if (xterm_screen) { let cols = Math.floor(terminalWidth / TERMINAL_COL_WIDTH); let rows = Math.floor(terminalHeight / TERMINAL_ROW_HEIGHT); - console.log(rows, cols, terminalHeight, terminalWidth, TERMINAL_ROW_HEIGHT, TERMINAL_COL_WIDTH); if (cols < MINIMUM_COLS) { cols = MINIMUM_COLS; } diff --git a/js/workflows/ble.js b/js/workflows/ble.js index bf020fc..c2ad323 100644 --- a/js/workflows/ble.js +++ b/js/workflows/ble.js @@ -253,9 +253,14 @@ class BLEWorkflow extends Workflow { } // Is this a new connection? if (!this.bleDevice) { - let devices = await navigator.bluetooth.getDevices(); - for (const device of devices) { - await this.connectToBluetoothDevice(device); + try { + let devices = await navigator.bluetooth.getDevices(); + for (const device of devices) { + await this.connectToBluetoothDevice(device); + } + } catch (error) { + console.error(error); + this.showConnectStatus(this._suggestBLEConnectActions(error)); } } } From 2903e8561dbf6f322fd76d88e926f34d4c7ecf4b Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 10 Nov 2025 16:46:06 -0800 Subject: [PATCH 2/3] Add halt button --- index.html | 1 + js/script.js | 9 +++++++++ js/workflows/workflow.js | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index c136623..26db8e2 100644 --- a/index.html +++ b/index.html @@ -96,6 +96,7 @@
+
diff --git a/js/script.js b/js/script.js index f18886d..6b32d71 100644 --- a/js/script.js +++ b/js/script.js @@ -33,6 +33,7 @@ let unchanged = 0; let connectionPromise = null; const btnRestart = document.querySelector('.btn-restart'); +const btnHalt = document.querySelector('.btn-halt'); const btnPlotter = document.querySelector('.btn-plotter'); const btnClear = document.querySelector('.btn-clear'); const btnConnect = document.querySelectorAll('.btn-connect'); @@ -130,6 +131,14 @@ btnRestart.addEventListener('click', async function(e) { } }); +// Halt Button +btnHalt.addEventListener('click', async function(e) { + if (await checkConnected()) { + // Perform a device soft halt + await workflow.haltScript(); + } +}); + // Clear Button btnClear.addEventListener('click', async function(e) { if (workflow.plotterChart){ diff --git a/js/workflows/workflow.js b/js/workflows/workflow.js index 30bf7e1..33c7ada 100644 --- a/js/workflows/workflow.js +++ b/js/workflows/workflow.js @@ -91,7 +91,11 @@ class Workflow { } async restartDevice() { - this.repl.softRestart(); + await this.repl.softRestart(); + } + + async haltScript() { + await this.repl.interruptCode(); } makeDocState(document, docChangePos) { From f28235aaeeddc1e57094985563eafd64bd82c22e Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Thu, 20 Nov 2025 14:14:56 -0800 Subject: [PATCH 3/3] Fix file selection --- js/common/file_dialog.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/common/file_dialog.js b/js/common/file_dialog.js index 319247f..3e05266 100644 --- a/js/common/file_dialog.js +++ b/js/common/file_dialog.js @@ -291,8 +291,9 @@ class FileDialog extends GenericModal { } else if (clickedItem.getAttribute("data-type") != "folder") { this._getElement('fileNameField').value = clickedItem.querySelector("span").innerHTML; } - - this._lastSelectedNode = clickedItem; + if (this._lastSelectedNode == null || !modifierKeys.includes(MODIFIER_SHIFT)) { + this._lastSelectedNode = clickedItem; + } this._setElementEnabled('okButton', !this._multipleItemsSelected() && clickedItem.getAttribute("data-type") != "bin"); this._updateToolbar(); }