Make no_reset work consistently

pull/322/head
Melissa LeBlanc-Williams 2 months ago
parent b98a904be3
commit 0ac5125f3f

@ -52,7 +52,7 @@
<div class="subheader">
<div class="title left">Adafruit ESPTool</div>
<div class="right">
<label for="noReset"> Turn on for Passthrough updates</label>
<label for="noReset"> No reset for Passthrough updates</label>
<div class="onoffswitch" style="margin-right: 30px;">
<input
type="checkbox"

@ -135,25 +135,34 @@ function enableStyleSheet(node, enabled) {
* Click handler for the connect/disconnect button.
*/
async function clickConnect() {
// Disconnect if connected
if (transport !== null) {
await transport.disconnect();
await transport.waitForUnlock(1500);
toggleUIConnected(false);
transport = null;
if (device !== null) {
await device.close();
device = null;
}
chip = null;
return;
}
// Set up device and transport
if (device === null) {
device = await serialLib.requestPort({});
}
if (transport === null) {
transport = new Transport(device, true);
}
try {
const romBaudrate = parseInt(baudRate.value);
const loaderOptions = {
transport: transport,
baudrate: parseInt(baudRate.value),
baudrate: romBaudrate,
terminal: espLoaderTerminal,
debugLogging: false,
};
@ -163,7 +172,15 @@ async function clickConnect() {
let resetMode = "default_reset";
if (noReset.checked) {
resetMode = "no_reset";
try {
// Initiate passthrough serial setup
await transport.connect(romBaudrate);
await transport.disconnect();
await sleep(350);
} catch (e) {
}
}
chip = await esploader.main(resetMode);
// Temporarily broken
@ -171,7 +188,6 @@ async function clickConnect() {
toggleUIConnected(true);
toggleUIToolbar(true);
} catch (e) {
console.error(e);
errorMsg(e.message);

Loading…
Cancel
Save