Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<div id="serial-page" class="">
<div id="serial-bar">
<button class="purple-button btn-restart">Restart<i class="fa-solid fa-redo"></i></button>
<button class="purple-button btn-halt">Halt<i class="fa-solid fa-hand"></i></button>
<button class="purple-button btn-clear">Clear<i class="fa-solid fa-broom"></i></button>
<button class="purple-button btn-plotter">Plotter<i class="fa-solid fa-chart-line"></i></button>
<div id="terminal-title"></div>
Expand Down
5 changes: 3 additions & 2 deletions js/common/file_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
1 change: 0 additions & 1 deletion js/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 9 additions & 0 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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){
Expand Down
11 changes: 8 additions & 3 deletions js/workflows/ble.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion js/workflows/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ class Workflow {
}

async restartDevice() {
this.repl.softRestart();
await this.repl.softRestart();
}

async haltScript() {
await this.repl.interruptCode();
}

makeDocState(document, docChangePos) {
Expand Down