|
|
@ -1,4 +1,5 @@
|
|
|
|
import { ESPLoader, Transport } from "https://unpkg.com/esptool-js@0.5.3/bundle.js";
|
|
|
|
import { ESPLoader, Transport } from "https://unpkg.com/esptool-js@0.5.4/bundle.js";
|
|
|
|
|
|
|
|
//import { ESPLoader, Transport } from "./esptool-js/bundle.js";
|
|
|
|
|
|
|
|
|
|
|
|
const baudRates = [921600, 115200, 230400, 460800];
|
|
|
|
const baudRates = [921600, 115200, 230400, 460800];
|
|
|
|
|
|
|
|
|
|
|
@ -135,25 +136,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 +173,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 +189,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);
|
|
|
|