Skip to content

Commit

Permalink
disconnect btn not shown upon connect error (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianignacio5 authored Jan 13, 2025
1 parent f60d42c commit 4e7f682
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This repository contains a Javascript implementation of [esptool](https://github

`yarn add --save esptool-js`

Check an example project [here](./examples/typescript).
Check an example project [here](https://github.com/espressif/esptool-js/tree/main/examples/typescript).

**Nightly builds** for <a href="https://nightly.link/espressif/esptool-js/workflows/ci/main">ESPTOOL-JS</a>

Expand Down
32 changes: 15 additions & 17 deletions examples/typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ const espLoaderTerminal = {
};

connectButton.onclick = async () => {
if (device === null) {
device = await serialLib.requestPort({});
transport = new Transport(device, true);
}

try {
if (device === null) {
device = await serialLib.requestPort({});
transport = new Transport(device, true);
}
const flashOptions = {
transport,
baudrate: parseInt(baudrates.value),
Expand All @@ -103,22 +102,21 @@ connectButton.onclick = async () => {

// Temporarily broken
// await esploader.flashId();
console.log("Settings done for :" + chip);

Check warning on line 105 in examples/typescript/src/index.ts

View workflow job for this annotation

GitHub Actions / ci

Unexpected console statement
lblBaudrate.style.display = "none";
lblConnTo.innerHTML = "Connected to device: " + chip;
lblConnTo.style.display = "block";
baudrates.style.display = "none";
connectButton.style.display = "none";
disconnectButton.style.display = "initial";
traceButton.style.display = "initial";
eraseButton.style.display = "initial";
filesDiv.style.display = "initial";
consoleDiv.style.display = "none";
} catch (e) {
console.error(e);

Check warning on line 117 in examples/typescript/src/index.ts

View workflow job for this annotation

GitHub Actions / ci

Unexpected console statement
term.writeln(`Error: ${e.message}`);
}

console.log("Settings done for :" + chip);
lblBaudrate.style.display = "none";
lblConnTo.innerHTML = "Connected to device: " + chip;
lblConnTo.style.display = "block";
baudrates.style.display = "none";
connectButton.style.display = "none";
disconnectButton.style.display = "initial";
traceButton.style.display = "initial";
eraseButton.style.display = "initial";
filesDiv.style.display = "initial";
consoleDiv.style.display = "none";
};

traceButton.onclick = async () => {
Expand Down

0 comments on commit 4e7f682

Please sign in to comment.