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="subheader">
<div class="title left">Adafruit ESPTool</div> <div class="title left">Adafruit ESPTool</div>
<div class="right"> <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;"> <div class="onoffswitch" style="margin-right: 30px;">
<input <input
type="checkbox" type="checkbox"

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

Loading…
Cancel
Save