Make no_reset work consistently
This commit is contained in:
parent
b98a904be3
commit
0ac5125f3f
2 changed files with 20 additions and 4 deletions
|
|
@ -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"
|
||||
|
|
|
|||
22
js/script.js
22
js/script.js
|
|
@ -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;
|
||||
device = 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…
Reference in a new issue