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

fix : Passthrough logic inside hardReset() #304

Merged
merged 2 commits into from
Nov 15, 2024
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
14 changes: 5 additions & 9 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ document.addEventListener("DOMContentLoaded", () => {
autoscroll.addEventListener("click", clickAutoscroll);
baudRate.addEventListener("change", changeBaudRate);
darkMode.addEventListener("click", clickDarkMode);
noReset.addEventListener("click", clickNoReset);
noReset.addEventListener("change", () => {
console.log("Checkbox changed:", noReset.checked); // Log checkbox state changes
});

window.addEventListener("error", function (event) {
console.log("Got an uncaught error: ", event.error);
});
Expand Down Expand Up @@ -248,15 +251,8 @@ async function clickDarkMode() {
* Change handler for ESP32 co-processor boards
*/
async function clickNoReset() {
console.log("Checkbox state:", noReset.checked); // Debugging output
saveSetting("noReset", noReset.checked);
if (espStub) {
try {
// Assuming espStub has a setNoReset method, similar to setBaudrate
await espStub.setNoReset(noReset.checked);
} catch (error) {
console.error("Failed to set noReset:", error);
}
}
}

/**
Expand Down
20 changes: 9 additions & 11 deletions src/esp_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,15 @@ export class ESPLoader extends EventTarget {
}

async hardReset(bootloader = false) {
this.logger.log("Try hard reset.");

// Check for noReset toggle
const noResetCheckbox = document.getElementById("noReset");
const noResetEnabled = noResetCheckbox
? (noResetCheckbox as HTMLInputElement).checked
: false;

if (noResetEnabled) {
this.logger.log("No reset requested; skipping hard reset.");
return; // Skip reset if noReset is enabled
// Passthrough mode defaults to "off"
// Passthrough checkbox is "on" will prevent a controller reset
const noResetCheckbox = document.getElementById(
"noReset",
) as HTMLInputElement;
const noReset = noResetCheckbox ? noResetCheckbox.checked : false;

if (noReset) {
return; // Skip reset if noReset is true
}

if (bootloader) {
Expand Down