tasmota-webserial-esptool 9.2.19 → 9.2.21

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/dist/const.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export interface Logger {
2
- log(msg: string, ...args: any[]): void;
3
- error(msg: string, ...args: any[]): void;
4
- debug(msg: string, ...args: any[]): void;
2
+ log(msg: string, ...args: unknown[]): void;
3
+ error(msg: string, ...args: unknown[]): void;
4
+ debug(msg: string, ...args: unknown[]): void;
5
5
  }
6
6
  export declare const baudRates: number[];
7
7
  export declare const FLASH_SIZES: {
@@ -56,8 +56,10 @@ export declare const ESP32_SPI_MISO_DLEN_OFFS = 44;
56
56
  export declare const ESP32_SPI_W0_OFFS = 128;
57
57
  export declare const ESP32_UART_DATE_REG_ADDR = 1610612856;
58
58
  export declare const ESP32_BOOTLOADER_FLASH_OFFSET = 4096;
59
+ export declare const ESP32_APB_CTL_DATE_ADDR: number;
59
60
  export declare const ESP32S2_SPI_REG_BASE = 1061167104;
60
61
  export declare const ESP32S2_BASEFUSEADDR = 1061265408;
62
+ export declare const ESP32S2_EFUSE_BLOCK1_ADDR: number;
61
63
  export declare const ESP32S2_MACFUSEADDR = 1061265476;
62
64
  export declare const ESP32S2_SPI_USR_OFFS = 24;
63
65
  export declare const ESP32S2_SPI_USR1_OFFS = 28;
@@ -81,6 +83,7 @@ export declare const ESP32S2_UARTDEV_BUF_NO = 1073741076;
81
83
  export declare const ESP32S2_UARTDEV_BUF_NO_USB_OTG = 2;
82
84
  export declare const ESP32S3_SPI_REG_BASE = 1610620928;
83
85
  export declare const ESP32S3_BASEFUSEADDR = 1610641408;
86
+ export declare const ESP32S3_EFUSE_BLOCK1_ADDR: number;
84
87
  export declare const ESP32S3_MACFUSEADDR: number;
85
88
  export declare const ESP32S3_SPI_USR_OFFS = 24;
86
89
  export declare const ESP32S3_SPI_USR1_OFFS = 28;
@@ -105,6 +108,7 @@ export declare const ESP32S3_UARTDEV_BUF_NO_USB_OTG = 3;
105
108
  export declare const ESP32S3_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 4;
106
109
  export declare const ESP32C2_SPI_REG_BASE = 1610620928;
107
110
  export declare const ESP32C2_BASEFUSEADDR = 1610647552;
111
+ export declare const ESP32C2_EFUSE_BLOCK2_ADDR: number;
108
112
  export declare const ESP32C2_MACFUSEADDR: number;
109
113
  export declare const ESP32C2_SPI_USR_OFFS = 24;
110
114
  export declare const ESP32C2_SPI_USR1_OFFS = 28;
@@ -146,6 +150,7 @@ export declare const ESP32C3_EFUSE_RD_MAC_SPI_SYS_3_REG = 1610647632;
146
150
  export declare const ESP32C3_EFUSE_RD_MAC_SPI_SYS_5_REG = 1610647640;
147
151
  export declare const ESP32C5_SPI_REG_BASE = 1610625024;
148
152
  export declare const ESP32C5_BASEFUSEADDR = 1611352064;
153
+ export declare const ESP32C5_EFUSE_BLOCK1_ADDR: number;
149
154
  export declare const ESP32C5_MACFUSEADDR: number;
150
155
  export declare const ESP32C5_SPI_USR_OFFS = 24;
151
156
  export declare const ESP32C5_SPI_USR1_OFFS = 28;
@@ -163,6 +168,7 @@ export declare const ESP32C5_UARTDEV_BUF_NO = 1082520852;
163
168
  export declare const ESP32C5_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3;
164
169
  export declare const ESP32C6_SPI_REG_BASE = 1610625024;
165
170
  export declare const ESP32C6_BASEFUSEADDR = 1611335680;
171
+ export declare const ESP32C6_EFUSE_BLOCK1_ADDR: number;
166
172
  export declare const ESP32C6_MACFUSEADDR: number;
167
173
  export declare const ESP32C6_SPI_USR_OFFS = 24;
168
174
  export declare const ESP32C6_SPI_USR1_OFFS = 28;
@@ -190,6 +196,7 @@ export declare const ESP32C5_C6_RTC_CNTL_SWD_AUTO_FEED_EN: number;
190
196
  export declare const ESP32C5_C6_RTC_CNTL_SWD_WPROTECT_REG: number;
191
197
  export declare const ESP32C61_SPI_REG_BASE = 1610625024;
192
198
  export declare const ESP32C61_BASEFUSEADDR = 1611352064;
199
+ export declare const ESP32C61_EFUSE_BLOCK1_ADDR: number;
193
200
  export declare const ESP32C61_MACFUSEADDR: number;
194
201
  export declare const ESP32C61_SPI_USR_OFFS = 24;
195
202
  export declare const ESP32C61_SPI_USR1_OFFS = 28;
@@ -205,6 +212,7 @@ export declare const ESP32C61_UARTDEV_BUF_NO_USB_JTAG_SERIAL_REV_LE2 = 3;
205
212
  export declare const ESP32C61_UARTDEV_BUF_NO_USB_JTAG_SERIAL_REV_GT2 = 4;
206
213
  export declare const ESP32H2_SPI_REG_BASE = 1610625024;
207
214
  export declare const ESP32H2_BASEFUSEADDR = 1611335680;
215
+ export declare const ESP32H2_EFUSE_BLOCK1_ADDR: number;
208
216
  export declare const ESP32H2_MACFUSEADDR: number;
209
217
  export declare const ESP32H2_SPI_USR_OFFS = 24;
210
218
  export declare const ESP32H2_SPI_USR1_OFFS = 28;
@@ -224,6 +232,7 @@ export declare const ESP32H2_UARTDEV_BUF_NO = 1082457852;
224
232
  export declare const ESP32H2_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3;
225
233
  export declare const ESP32H4_SPI_REG_BASE = 1611239424;
226
234
  export declare const ESP32H4_BASEFUSEADDR = 1611339776;
235
+ export declare const ESP32H4_EFUSE_BLOCK1_ADDR: number;
227
236
  export declare const ESP32H4_MACFUSEADDR: number;
228
237
  export declare const ESP32H4_SPI_USR_OFFS = 24;
229
238
  export declare const ESP32H4_SPI_USR1_OFFS = 28;
@@ -243,6 +252,7 @@ export declare const ESP32H4_UARTDEV_BUF_NO = 1082652032;
243
252
  export declare const ESP32H4_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3;
244
253
  export declare const ESP32H21_SPI_REG_BASE = 1610625024;
245
254
  export declare const ESP32H21_BASEFUSEADDR = 1611350016;
255
+ export declare const ESP32H21_EFUSE_BLOCK1_ADDR: number;
246
256
  export declare const ESP32H21_MACFUSEADDR: number;
247
257
  export declare const ESP32H21_SPI_USR_OFFS = 24;
248
258
  export declare const ESP32H21_SPI_USR1_OFFS = 28;
package/dist/const.js CHANGED
@@ -75,8 +75,10 @@ export const ESP32_SPI_MISO_DLEN_OFFS = 0x2c;
75
75
  export const ESP32_SPI_W0_OFFS = 0x80;
76
76
  export const ESP32_UART_DATE_REG_ADDR = 0x60000078;
77
77
  export const ESP32_BOOTLOADER_FLASH_OFFSET = 0x1000;
78
+ export const ESP32_APB_CTL_DATE_ADDR = 0x3ff66000 + 0x7c;
78
79
  export const ESP32S2_SPI_REG_BASE = 0x3f402000;
79
80
  export const ESP32S2_BASEFUSEADDR = 0x3f41a000;
81
+ export const ESP32S2_EFUSE_BLOCK1_ADDR = ESP32S2_BASEFUSEADDR + 0x044;
80
82
  export const ESP32S2_MACFUSEADDR = 0x3f41a044;
81
83
  export const ESP32S2_SPI_USR_OFFS = 0x18;
82
84
  export const ESP32S2_SPI_USR1_OFFS = 0x1c;
@@ -102,6 +104,7 @@ export const ESP32S2_UARTDEV_BUF_NO = 0x3ffffd14; // Variable in ROM .bss which
102
104
  export const ESP32S2_UARTDEV_BUF_NO_USB_OTG = 2; // Value of the above indicating that USB-OTG is in use
103
105
  export const ESP32S3_SPI_REG_BASE = 0x60002000;
104
106
  export const ESP32S3_BASEFUSEADDR = 0x60007000;
107
+ export const ESP32S3_EFUSE_BLOCK1_ADDR = ESP32S3_BASEFUSEADDR + 0x044;
105
108
  export const ESP32S3_MACFUSEADDR = 0x60007000 + 0x044;
106
109
  export const ESP32S3_SPI_USR_OFFS = 0x18;
107
110
  export const ESP32S3_SPI_USR1_OFFS = 0x1c;
@@ -128,6 +131,7 @@ export const ESP32S3_UARTDEV_BUF_NO_USB_OTG = 3; // The above var when USB-OTG i
128
131
  export const ESP32S3_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 4; // The above var when USB-JTAG/Serial is used
129
132
  export const ESP32C2_SPI_REG_BASE = 0x60002000;
130
133
  export const ESP32C2_BASEFUSEADDR = 0x60008800;
134
+ export const ESP32C2_EFUSE_BLOCK2_ADDR = ESP32C2_BASEFUSEADDR + 0x040;
131
135
  export const ESP32C2_MACFUSEADDR = ESP32C2_BASEFUSEADDR + 0x040;
132
136
  export const ESP32C2_SPI_USR_OFFS = 0x18;
133
137
  export const ESP32C2_SPI_USR1_OFFS = 0x1c;
@@ -174,6 +178,7 @@ export const ESP32C3_EFUSE_RD_MAC_SPI_SYS_3_REG = 0x60008850;
174
178
  export const ESP32C3_EFUSE_RD_MAC_SPI_SYS_5_REG = 0x60008858;
175
179
  export const ESP32C5_SPI_REG_BASE = 0x60003000;
176
180
  export const ESP32C5_BASEFUSEADDR = 0x600b4800;
181
+ export const ESP32C5_EFUSE_BLOCK1_ADDR = ESP32C5_BASEFUSEADDR + 0x044;
177
182
  export const ESP32C5_MACFUSEADDR = 0x600b4800 + 0x044;
178
183
  export const ESP32C5_SPI_USR_OFFS = 0x18;
179
184
  export const ESP32C5_SPI_USR1_OFFS = 0x1c;
@@ -193,6 +198,7 @@ export const ESP32C5_UARTDEV_BUF_NO = 0x4085f514; // Variable in ROM .bss which
193
198
  export const ESP32C5_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3; // The above var when USB-JTAG/Serial is used
194
199
  export const ESP32C6_SPI_REG_BASE = 0x60003000;
195
200
  export const ESP32C6_BASEFUSEADDR = 0x600b0800;
201
+ export const ESP32C6_EFUSE_BLOCK1_ADDR = ESP32C6_BASEFUSEADDR + 0x044;
196
202
  export const ESP32C6_MACFUSEADDR = 0x600b0800 + 0x044;
197
203
  export const ESP32C6_SPI_USR_OFFS = 0x18;
198
204
  export const ESP32C6_SPI_USR1_OFFS = 0x1c;
@@ -223,6 +229,7 @@ export const ESP32C5_C6_RTC_CNTL_SWD_AUTO_FEED_EN = 1 << 18;
223
229
  export const ESP32C5_C6_RTC_CNTL_SWD_WPROTECT_REG = ESP32C5_C6_DR_REG_LP_WDT_BASE + 0x0020; // LP_WDT_SWD_WPROTECT_REG
224
230
  export const ESP32C61_SPI_REG_BASE = 0x60003000;
225
231
  export const ESP32C61_BASEFUSEADDR = 0x600b4800;
232
+ export const ESP32C61_EFUSE_BLOCK1_ADDR = ESP32C61_BASEFUSEADDR + 0x044;
226
233
  export const ESP32C61_MACFUSEADDR = 0x600b4800 + 0x044;
227
234
  export const ESP32C61_SPI_USR_OFFS = 0x18;
228
235
  export const ESP32C61_SPI_USR1_OFFS = 0x1c;
@@ -239,6 +246,7 @@ export const ESP32C61_UARTDEV_BUF_NO_USB_JTAG_SERIAL_REV_LE2 = 3; // revision <=
239
246
  export const ESP32C61_UARTDEV_BUF_NO_USB_JTAG_SERIAL_REV_GT2 = 4; // revision > 2
240
247
  export const ESP32H2_SPI_REG_BASE = 0x60003000;
241
248
  export const ESP32H2_BASEFUSEADDR = 0x600b0800;
249
+ export const ESP32H2_EFUSE_BLOCK1_ADDR = ESP32H2_BASEFUSEADDR + 0x044;
242
250
  export const ESP32H2_MACFUSEADDR = 0x600b0800 + 0x044;
243
251
  export const ESP32H2_SPI_USR_OFFS = 0x18;
244
252
  export const ESP32H2_SPI_USR1_OFFS = 0x1c;
@@ -260,6 +268,7 @@ export const ESP32H2_UARTDEV_BUF_NO = 0x4084fefc; // Variable in ROM .bss which
260
268
  export const ESP32H2_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3; // The above var when USB-JTAG/Serial is used
261
269
  export const ESP32H4_SPI_REG_BASE = 0x60099000;
262
270
  export const ESP32H4_BASEFUSEADDR = 0x600b1800;
271
+ export const ESP32H4_EFUSE_BLOCK1_ADDR = ESP32H4_BASEFUSEADDR + 0x044;
263
272
  export const ESP32H4_MACFUSEADDR = 0x600b1800 + 0x044;
264
273
  export const ESP32H4_SPI_USR_OFFS = 0x18;
265
274
  export const ESP32H4_SPI_USR1_OFFS = 0x1c;
@@ -281,6 +290,7 @@ export const ESP32H4_UARTDEV_BUF_NO = 0x4087f580; // Variable in ROM .bss which
281
290
  export const ESP32H4_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3; // The above var when USB-JTAG/Serial is used
282
291
  export const ESP32H21_SPI_REG_BASE = 0x60003000;
283
292
  export const ESP32H21_BASEFUSEADDR = 0x600b4000;
293
+ export const ESP32H21_EFUSE_BLOCK1_ADDR = ESP32H21_BASEFUSEADDR + 0x044;
284
294
  export const ESP32H21_MACFUSEADDR = 0x600b4000 + 0x044;
285
295
  export const ESP32H21_SPI_USR_OFFS = 0x18;
286
296
  export const ESP32H21_SPI_USR1_OFFS = 0x1c;
@@ -84,9 +84,6 @@ export declare class ESPLoader extends EventTarget {
84
84
  * Detect chip type using GET_SECURITY_INFO (for newer chips) or magic value (for older chips)
85
85
  */
86
86
  detectChip(): Promise<void>;
87
- /**
88
- * Get chip revision for ESP32-P4
89
- */
90
87
  getChipRevision(): Promise<number>;
91
88
  /**
92
89
  * Power on the flash chip for ESP32-P4 Rev 301 (ECO6)
@@ -113,16 +110,11 @@ export declare class ESPLoader extends EventTarget {
113
110
  * Reads data from the input stream and places it in the inputBuffer
114
111
  */
115
112
  readLoop(): Promise<void>;
116
- sleep(ms?: number): Promise<unknown>;
117
113
  state_DTR: boolean;
118
114
  state_RTS: boolean;
119
115
  setRTS(state: boolean): Promise<void>;
120
116
  setDTR(state: boolean): Promise<void>;
121
117
  setDTRandRTS(dtr: boolean, rts: boolean): Promise<void>;
122
- /**
123
- * Helper function to run a sequence of signal changes
124
- * Automatically detects WebUSB vs Web Serial and calls appropriate methods
125
- */
126
118
  private runSignalSequence;
127
119
  /**
128
120
  * @name hardResetUSBJTAGSerial
@@ -190,27 +182,26 @@ export declare class ESPLoader extends EventTarget {
190
182
  connectWithResetStrategies(): Promise<void>;
191
183
  /**
192
184
  * @name watchdogReset
193
- * Watchdog reset for ESP32-S2/S3/C3 with USB-OTG or USB-JTAG/Serial
185
+ * Watchdog reset for ESP32-S2/S3/P4 with USB-OTG or USB-JTAG/Serial
194
186
  * Uses RTC watchdog timer to reset the chip - works when DTR/RTS signals are not available
195
187
  * This is an alias for rtcWdtResetChipSpecific() for backwards compatibility
188
+ * Note: ESP32-C3, ESP32-C5, ESP32-C6 do NOT boot correctly after WDT reset
196
189
  */
197
190
  watchdogReset(): Promise<void>;
198
191
  /**
199
- * Get chip revision for ESP32-C3
200
- * Reads from EFUSE registers and calculates revision
201
- */
202
- getChipRevisionC3(): Promise<number>;
203
- /**
204
- * RTC watchdog timer reset for ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C5, ESP32-C6, and ESP32-P4
192
+ * RTC watchdog timer reset for ESP32-S2, ESP32-S3, and ESP32-P4
205
193
  * Uses specific registers for each chip family
206
- * Note: ESP32-H2 does NOT support WDT reset
194
+ * Note: ESP32-C3 does NOT boot correctly after WDT reset
195
+ * Note: ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2 do NOT support WDT reset (no usable RTC WDT path)
207
196
  */
208
197
  rtcWdtResetChipSpecific(): Promise<void>;
209
198
  /**
210
- * Helper: USB-based WDT reset
211
- * Returns true if WDT reset was performed, false otherwise
199
+ * Reset device from bootloader mode to firmware mode
200
+ * Automatically selects the correct reset strategy based on USB connection type
201
+ * @param clearForceDownloadFlag - If true, clears the force download boot flag (USB-OTG only)
202
+ * @returns true if port will change (USB-OTG), false otherwise
212
203
  */
213
- private tryUsbWdtReset;
204
+ resetToFirmwareMode(clearForceDownloadFlag?: boolean): Promise<boolean>;
214
205
  hardReset(bootloader?: boolean): Promise<void>;
215
206
  /**
216
207
  * @name macAddr
@@ -258,8 +249,8 @@ export declare class ESPLoader extends EventTarget {
258
249
  checksum(data: number[], state?: number): number;
259
250
  getC5CrystalFreqRomExpect(): Promise<number>;
260
251
  getC5CrystalFreqDetected(): Promise<number>;
261
- private setBaudrateC5Rom;
262
252
  setBaudrate(baud: number): Promise<void>;
253
+ private setBaudrateC5Rom;
263
254
  reconfigurePort(baud: number): Promise<void>;
264
255
  /**
265
256
  * @name syncWithTimeout
@@ -355,10 +346,6 @@ export declare class ESPLoader extends EventTarget {
355
346
  private get _writeChain();
356
347
  private set _writeChain(value);
357
348
  writeToStream(data: number[]): Promise<void>;
358
- getUsbMode(): Promise<{
359
- mode: "uart" | "usb-jtag-serial" | "usb-otg";
360
- uartNo: number;
361
- }>;
362
349
  disconnect(): Promise<void>;
363
350
  /**
364
351
  * @name releaseReaderWriter
@@ -380,6 +367,22 @@ export declare class ESPLoader extends EventTarget {
380
367
  * @returns true if USB-JTAG or USB-OTG, false if external serial chip
381
368
  */
382
369
  detectUsbConnectionType(): Promise<boolean>;
370
+ getUsbMode(): Promise<{
371
+ mode: "uart" | "usb-jtag-serial" | "usb-otg";
372
+ uartNo: number;
373
+ }>;
374
+ /**
375
+ * Check if the current chip supports USB-JTAG or USB-OTG
376
+ * @returns true if chip has native USB support (JTAG or OTG)
377
+ */
378
+ supportsNativeUsb(): boolean;
379
+ /**
380
+ * @name _ensureStreamsReady
381
+ * After a hardware reset, ensure port streams are available.
382
+ * On WebUSB, recreates streams since they break after reset.
383
+ * On Web Serial, waits for streams to become available.
384
+ */
385
+ private _ensureStreamsReady;
383
386
  /**
384
387
  * @name enterConsoleMode
385
388
  * Prepare device for console mode by resetting to firmware
@@ -387,12 +390,6 @@ export declare class ESPLoader extends EventTarget {
387
390
  * @returns true if port was closed (USB-JTAG), false if port stays open (serial chip)
388
391
  */
389
392
  enterConsoleMode(): Promise<boolean>;
390
- /**
391
- * @name _resetToFirmwareIfNeeded
392
- * Reset device from bootloader to firmware when switching to console mode
393
- * Detects USB-JTAG/Serial and USB-OTG devices and performs appropriate reset
394
- * @returns true if reconnect was performed, false otherwise
395
- */
396
393
  /**
397
394
  * @name _clearForceDownloadBootIfNeeded
398
395
  * Read and clear the force download boot flag if it is set
@@ -401,6 +398,12 @@ export declare class ESPLoader extends EventTarget {
401
398
  * Returns true if the flag was cleared, false if it was already clear
402
399
  */
403
400
  private _clearForceDownloadBootIfNeeded;
401
+ /**
402
+ * @name _resetToFirmwareIfNeeded
403
+ * Reset device from bootloader to firmware when switching to console mode
404
+ * Detects USB-JTAG/Serial and USB-OTG devices and performs appropriate reset
405
+ * @returns true if reconnect was performed, false otherwise
406
+ */
404
407
  private _resetToFirmwareIfNeeded;
405
408
  /**
406
409
  * @name reconnectAndResume
@@ -436,6 +439,15 @@ export declare class ESPLoader extends EventTarget {
436
439
  * This is a hardware limitation - use isConsoleResetSupported() to check first.
437
440
  */
438
441
  resetInConsoleMode(): Promise<void>;
442
+ /**
443
+ * @name syncAndWdtReset
444
+ * Open a new bootloader port, sync with ROM (no stub, no reset strategies), and fire WDT reset.
445
+ * This is used for ESP32-S2 USB-OTG devices which require WDT reset to switch modes.
446
+ * After WDT reset the port will re-enumerate again.
447
+ * The user must select the new port after this method is called.
448
+ * @param newPort - The bootloader port selected by the user
449
+ */
450
+ syncAndWdtReset(newPort: SerialPort): Promise<void>;
439
451
  /**
440
452
  * @name drainInputBuffer
441
453
  * Actively drain the input buffer by reading data for a specified time.