Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disconnect btn not shown upon connect error #176

Merged
merged 1 commit into from
Jan 13, 2025
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
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 @@
};

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 @@

// 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 All @@ -140,7 +138,7 @@
try {
await esploader.eraseFlash();
} catch (e) {
console.error(e);

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

View workflow job for this annotation

GitHub Actions / ci

Unexpected console statement
term.writeln(`Error: ${e.message}`);
} finally {
eraseButton.disabled = false;
Expand Down Expand Up @@ -259,7 +257,7 @@
}
term.write(value);
}
console.log("quitting console");

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

View workflow job for this annotation

GitHub Actions / ci

Unexpected console statement
};

consoleStopButton.onclick = async () => {
Expand Down Expand Up @@ -358,7 +356,7 @@
} as FlashOptions;
await esploader.writeFlash(flashOptions);
} catch (e) {
console.error(e);

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

View workflow job for this annotation

GitHub Actions / ci

Unexpected console statement
term.writeln(`Error: ${e.message}`);
} finally {
// Hide progress bars and show erase buttons
Expand Down
Loading