esp32tool 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apple-touch-icon.png +0 -0
- package/dist/console.js +18 -7
- package/dist/const.d.ts +6 -0
- package/dist/const.js +8 -0
- package/dist/esp_loader.d.ts +37 -30
- package/dist/esp_loader.js +502 -367
- package/dist/web/index.js +1 -1
- package/icons/icon-128.png +0 -0
- package/icons/icon-144.png +0 -0
- package/icons/icon-152.png +0 -0
- package/icons/icon-192.png +0 -0
- package/icons/icon-384.png +0 -0
- package/icons/icon-512.png +0 -0
- package/icons/icon-72.png +0 -0
- package/icons/icon-96.png +0 -0
- package/js/console.js +60 -0
- package/js/modules/esptool.js +1 -1
- package/js/script.js +156 -113
- package/package.json +1 -1
- package/screenshots/desktop.png +0 -0
- package/screenshots/mobile.png +0 -0
- package/src/console.ts +28 -11
- package/src/const.ts +8 -0
- package/src/esp_loader.ts +610 -399
- package/sw.js +1 -1
package/icons/icon-152.png
CHANGED
|
Binary file
|
package/icons/icon-192.png
CHANGED
|
Binary file
|
package/icons/icon-384.png
CHANGED
|
Binary file
|
package/icons/icon-512.png
CHANGED
|
Binary file
|
package/icons/icon-72.png
CHANGED
|
Binary file
|
package/icons/icon-96.png
CHANGED
|
Binary file
|
package/js/console.js
CHANGED
|
@@ -2,6 +2,13 @@ import { ColoredConsole, coloredConsoleStyles } from "./util/console-color.js";
|
|
|
2
2
|
import { LineBreakTransformer } from "./util/line-break-transformer.js";
|
|
3
3
|
|
|
4
4
|
export class ESP32ToolConsole {
|
|
5
|
+
// Bootloader detection patterns
|
|
6
|
+
static BOOTLOADER_PATTERNS = [
|
|
7
|
+
/waiting for download/i,
|
|
8
|
+
/DOWNLOAD\(/i,
|
|
9
|
+
/download[_ ]mode/i,
|
|
10
|
+
];
|
|
11
|
+
|
|
5
12
|
constructor(port, containerElement, allowInput = true) {
|
|
6
13
|
this.port = port;
|
|
7
14
|
this.containerElement = containerElement;
|
|
@@ -195,6 +202,11 @@ export class ESP32ToolConsole {
|
|
|
195
202
|
return;
|
|
196
203
|
}
|
|
197
204
|
|
|
205
|
+
// Use static BOOTLOADER_PATTERNS defined at class level
|
|
206
|
+
const BOOTLOADER_PATTERNS = ESP32ToolConsole.BOOTLOADER_PATTERNS;
|
|
207
|
+
let bootloaderDetected = false;
|
|
208
|
+
let lineCount = 0;
|
|
209
|
+
|
|
198
210
|
try {
|
|
199
211
|
await this.port.readable
|
|
200
212
|
.pipeThrough(new TextDecoderStream(), {
|
|
@@ -206,6 +218,19 @@ export class ESP32ToolConsole {
|
|
|
206
218
|
write: (chunk) => {
|
|
207
219
|
const cleaned = chunk.replace(/\r\n$/, "\n");
|
|
208
220
|
this.console.addLine(cleaned);
|
|
221
|
+
|
|
222
|
+
if (!bootloaderDetected && lineCount < 30) {
|
|
223
|
+
lineCount++;
|
|
224
|
+
for (const pat of BOOTLOADER_PATTERNS) {
|
|
225
|
+
if (pat.test(cleaned)) {
|
|
226
|
+
bootloaderDetected = true;
|
|
227
|
+
this.containerElement.dispatchEvent(
|
|
228
|
+
new CustomEvent("console-bootloader", { bubbles: true })
|
|
229
|
+
);
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
209
234
|
},
|
|
210
235
|
})
|
|
211
236
|
);
|
|
@@ -255,6 +280,29 @@ export class ESP32ToolConsole {
|
|
|
255
280
|
input.focus();
|
|
256
281
|
}
|
|
257
282
|
|
|
283
|
+
checkOutputState() {
|
|
284
|
+
const text = this.logs();
|
|
285
|
+
if (!text || text.trim().length === 0) {
|
|
286
|
+
return "silent";
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Use static BOOTLOADER_PATTERNS defined at class level
|
|
290
|
+
const BOOTLOADER_PATTERNS = ESP32ToolConsole.BOOTLOADER_PATTERNS;
|
|
291
|
+
|
|
292
|
+
// Only check the first 30 lines (same as _connect) to avoid false positives
|
|
293
|
+
// from bootloader patterns appearing later in normal firmware output
|
|
294
|
+
const lines = text.split('\n');
|
|
295
|
+
const firstLines = lines.slice(0, 30).join('\n');
|
|
296
|
+
|
|
297
|
+
for (const pat of BOOTLOADER_PATTERNS) {
|
|
298
|
+
if (pat.test(firstLines)) {
|
|
299
|
+
return "bootloader";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return "output";
|
|
304
|
+
}
|
|
305
|
+
|
|
258
306
|
clear() {
|
|
259
307
|
const logElement = this.containerElement.querySelector(".log");
|
|
260
308
|
if (logElement) {
|
|
@@ -276,4 +324,16 @@ export class ESP32ToolConsole {
|
|
|
276
324
|
this.cancelConnection = null;
|
|
277
325
|
}
|
|
278
326
|
}
|
|
327
|
+
|
|
328
|
+
async reconnect(newPort) {
|
|
329
|
+
await this.disconnect();
|
|
330
|
+
this.port = newPort;
|
|
331
|
+
|
|
332
|
+
const abortController = new AbortController();
|
|
333
|
+
const connection = this._connect(abortController.signal);
|
|
334
|
+
this.cancelConnection = () => {
|
|
335
|
+
abortController.abort();
|
|
336
|
+
return connection;
|
|
337
|
+
};
|
|
338
|
+
}
|
|
279
339
|
}
|