Merge pull request #297 from mikeysklar/noReset

adding noReset() button
pull/300/head
Dan Halbert 4 months ago committed by GitHub
commit 8c09cd3cca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -62,6 +62,20 @@
<div class="subheader">
<div class="title left">Adafruit ESPTool</div>
<div class="right">
<label for="noReset"> Turn on for Passthrough updates</label>
<div class="onoffswitch" style="margin-right: 30px;">
<input
type="checkbox"
name="noReset"
class="onoffswitch-checkbox"
id="noReset"
checked="false"
/>
<label class="onoffswitch-label" for="noReset">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<label for="darkmode"> Dark Mode </label>
<div class="onoffswitch">
<input
@ -76,6 +90,7 @@
</label>
</div>
</div>
</div>
</div>
<div id="app">
<div id="commands">
@ -199,4 +214,4 @@
</div>
</footer>
</body>
</html>
</html>

@ -21,6 +21,7 @@ const firmware = document.querySelectorAll(".upload .firmware input");
const progress = document.querySelectorAll(".upload .progress-bar");
const offsets = document.querySelectorAll(".upload .offset");
const appDiv = document.getElementById("app");
const noReset = document.getElementById("noReset");
document.addEventListener("DOMContentLoaded", () => {
butConnect.addEventListener("click", () => {
@ -45,6 +46,7 @@ document.addEventListener("DOMContentLoaded", () => {
autoscroll.addEventListener("click", clickAutoscroll);
baudRate.addEventListener("change", changeBaudRate);
darkMode.addEventListener("click", clickDarkMode);
noReset.addEventListener("click", clickNoReset);
window.addEventListener("error", function (event) {
console.log("Got an uncaught error: ", event.error);
});
@ -241,6 +243,22 @@ async function clickDarkMode() {
saveSetting("darkmode", darkMode.checked);
}
/**
* @name clickNoReset
* Change handler for ESP32 co-processor boards
*/
async function clickNoReset() {
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);
}
}
}
/**
* @name clickErase
* Click handler for the erase button.
@ -421,6 +439,7 @@ function loadAllSettings() {
autoscroll.checked = loadSetting("autoscroll", true);
baudRate.value = loadSetting("baudrate", 115200);
darkMode.checked = loadSetting("darkmode", false);
noReset.checked = loadSetting("noReset", false);
}
function loadSetting(setting, defaultValue) {

@ -165,6 +165,18 @@ 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
}
if (bootloader) {
// enter flash mode
if (this.port.getInfo().usbProductId === USB_JTAG_SERIAL_PID) {
@ -182,13 +194,12 @@ export class ESPLoader extends EventTarget {
await this.setRTS(true);
await this.setDTR(false);
await this.setRTS(true);
await this.sleep(100);
await this.setDTR(false);
await this.setRTS(false);
} else {
// otherwise, esp chip should be connected to computer via usb-serial
// bridge chip like ch340,CP2102 etc.
// bridge chip like ch340, CP2102 etc.
// use normal way to enter flash mode.
await this.setDTR(false);
await this.setRTS(true);

Loading…
Cancel
Save