-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
519 lines (503 loc) · 19.4 KB
/
index.html
File metadata and controls
519 lines (503 loc) · 19.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
<!doctype html>
<html lang="en">
<head>
<title>ESP32Tool</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Flash & Read ESP devices using WebSerial and WebUSB" />
<meta name="theme-color" content="#1a1a1a" />
<link rel="manifest" href="manifest.json" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="ESP32Tool" />
<link rel="apple-touch-icon" href="icons/icon-192.png" />
<script>
// Redirect to HTTPS if HTTP is requested.
if (
window.location.hostname !== "localhost" &&
window.location.protocol === "http:"
) {
window.location.href = "https:" + window.location.href.substring(5);
}
</script>
<!-- import the web page's stylesheets along with the themes -->
<link rel="stylesheet" href="css/style.css" />
<link
rel="stylesheet"
href="css/light.css"
id="light"
class="alternate"
disabled
/>
<link
rel="stylesheet"
href="css/dark.css"
id="dark"
class="alternate"
disabled
/>
<!-- import the webpage's javascript file -->
<script type="module">
window.esptoolPackage = import(
"./js/modules/esptool.js"
);
</script>
<script src="js/script.js" type="module" defer></script>
<script>
// Service Worker for PWA functionality
// Derive base path from current document URL (more robust than repo-name regex)
const basePath = new URL(".", window.location.href).pathname;
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register(basePath + 'sw.js', { scope: basePath })
.then((registration) => {
console.log('[PWA] Service Worker registered:', registration.scope);
// Check for updates
registration.addEventListener('updatefound', () => {
const newWorker = registration.installing;
newWorker.addEventListener('statechange', () => {
if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {
console.log('[PWA] New version available! Reload to update.');
}
});
});
})
.catch((error) => {
console.log('[PWA] Service Worker registration failed:', error);
});
});
}
</script>
</head>
<body>
<header class="header">
<div class="header-content">
<button id="butConnect" type="button">Connect</button>
<label for="baudRate">Baud</label>
<select id="baudRate"></select>
<label for="advanced">Advanced</label>
<div class="onoffswitch">
<input
type="checkbox"
name="advanced"
class="onoffswitch-checkbox"
id="advanced"
/>
<label class="onoffswitch-label" for="advanced">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<label for="showlog">Show Log</label>
<div class="onoffswitch">
<input
type="checkbox"
name="showlog"
class="onoffswitch-checkbox"
id="showlog"
/>
<label class="onoffswitch-label" for="showlog">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<span class="log-controls">
<button id="butClear" type="button" class="small-btn">
Clear
</button>
</span>
<label for="darkmode">Dark</label>
<div class="onoffswitch">
<input
type="checkbox"
name="darkmode"
class="onoffswitch-checkbox"
id="darkmode"
/>
<label class="onoffswitch-label" for="darkmode">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<label for="autoscroll">Autoscroll</label>
<div class="onoffswitch">
<input
type="checkbox"
name="autoscroll"
class="onoffswitch-checkbox"
id="autoscroll"
checked
/>
<label class="onoffswitch-label" for="autoscroll">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
<div class="header-content advanced-row" style="display: none;">
<label for="chunkSize">Chunk</label>
<select id="chunkSize"></select>
<label for="blockSize">Block</label>
<select id="blockSize"></select>
<label for="maxInFlight">MaxInFlight</label>
<select id="maxInFlight"></select>
<label for="console">Console</label>
<div class="onoffswitch">
<input
type="checkbox"
name="console"
class="onoffswitch-checkbox"
id="console"
/>
<label class="onoffswitch-label" for="console">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<label for="debugmode">Debug</label>
<div class="onoffswitch">
<input
type="checkbox"
name="debugmode"
class="onoffswitch-checkbox"
id="debugmode"
/>
<label class="onoffswitch-label" for="debugmode">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</header>
<main class="main">
<div id="notSupported" class="notSupported">
Sorry, <b>Web Serial</b> or <b>WebUSB</b> is not supported on this device.
Make sure you're running Chrome 89 or later (Desktop) or Chrome 61+ (Android with USB OTG).
</div>
<div id="app">
<div id="console-container" class="console-container hidden"></div>
<div id="hexeditor-container" class="hexeditor-container hidden"></div>
<div id="nvseditor-container" class="nvseditor-container hidden"></div>
<div id="commands">
<div class="upload">
<label
>Offset: 0x
<input class="offset" type="text" value="0" />
</label>
<label class="firmware">
<input type="file" accept=".bin" />
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="17"
viewbox="0 0 20 17"
>
<path
d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"
/>
</svg>
<span>Choose a file…</span>
</label>
<div class="progress-bar hidden"><div></div></div>
</div>
<div class="upload">
<label
>Offset: 0x
<input class="offset" type="text" value="0" />
</label>
<label class="firmware">
<input type="file" accept=".bin" />
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="17"
viewbox="0 0 20 17"
>
<path
d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"
/>
</svg>
<span>Choose a file…</span>
</label>
<div class="progress-bar hidden"><div></div></div>
</div>
<div class="upload">
<label
>Offset: 0x
<input class="offset" type="text" value="0" />
</label>
<label class="firmware">
<input type="file" accept=".bin" />
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="17"
viewbox="0 0 20 17"
>
<path
d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"
/>
</svg>
<span>Choose a file…</span>
</label>
<div class="progress-bar hidden"><div></div></div>
</div>
<div class="upload">
<label
>Offset: 0x
<input class="offset" type="text" value="0" />
</label>
<label class="firmware">
<input type="file" accept=".bin" />
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="17"
viewbox="0 0 20 17"
>
<path
d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"
/>
</svg>
<span>Choose a file…</span>
</label>
<div class="progress-bar hidden"><div></div></div>
</div>
<div class="upload">
<label
>Offset: 0x
<input class="offset" type="text" value="0" />
</label>
<label class="firmware">
<input type="file" accept=".bin" />
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="17"
viewbox="0 0 20 17"
>
<path
d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"
/>
</svg>
<span>Choose a file…</span>
</label>
<div class="progress-bar hidden"><div></div></div>
</div>
<div class="upload">
<label
>Offset: 0x
<input class="offset" type="text" value="0" />
</label>
<label class="firmware">
<input type="file" accept=".bin" />
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="17"
viewbox="0 0 20 17"
>
<path
d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"
/>
</svg>
<span>Choose a file…</span>
</label>
<div class="progress-bar hidden"><div></div></div>
</div>
<div class="upload">
<label
>Offset: 0x
<input class="offset" type="text" value="0" />
</label>
<label class="firmware">
<input type="file" accept=".bin" />
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="17"
viewbox="0 0 20 17"
>
<path
d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"
/>
</svg>
<span>Choose a file…</span>
</label>
<div class="progress-bar hidden"><div></div></div>
</div>
<div class="upload">
<label
>Offset: 0x
<input class="offset" type="text" value="0" />
</label>
<label class="firmware">
<input type="file" accept=".bin" />
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="17"
viewbox="0 0 20 17"
>
<path
d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"
/>
</svg>
<span>Choose a file…</span>
</label>
<div class="progress-bar hidden"><div></div></div>
</div>
<div class="buttons">
<button id="butErase" type="button" disabled="disabled">
Erase
</button>
<button id="butProgram" type="button" disabled="disabled">
Program
</button>
</div>
<div class="progress-bar hidden indeterminate" id="eraseProgress"><div></div></div>
<div class="partition-table">
<button id="butReadPartitions" type="button" disabled="disabled">
Read Partition Table
</button>
<button id="butHexEditor" type="button" disabled="disabled">
Hex Editor
</button>
<button id="butNVSEditor" type="button" disabled="disabled">
NVS Parser
</button>
<button id="butDetectFS" type="button" class="hidden">
Detect FS and Open Manager
</button>
<button id="butOpenFSManager" type="button" class="hidden">
Open FS Manager
</button>
<div class="progress-bar hidden" id="partitionProgress">
<div></div>
</div>
<div id="partitionList" class="hidden"></div>
</div>
<div class="read-flash">
<div class="progress-bar hidden" id="readProgress"><div></div></div>
<div class="read-flash-inputs">
<label>
Address: 0x
<input id="readOffset" type="text" value="0" />
</label>
<label>
Size: 0x
<input id="readSize" type="text" value="1000" />
</label>
<button id="butReadFlash" type="button" disabled="disabled">
Read Flash
</button>
</div>
</div>
</div>
<div id="littlefsManager" class="littlefs-manager hidden">
<h3>Filesystem Manager</h3>
<div class="littlefs-info">
<div class="littlefs-partition-info">
<strong>Partition:</strong> <span id="littlefsPartitionName">-</span>
<span class="littlefs-size">(<span id="littlefsPartitionSize">-</span>)</span>
</div>
<div class="littlefs-usage">
<div class="usage-bar">
<div id="littlefsUsageBar" class="usage-fill" style="width: 0%"></div>
</div>
<div class="usage-text">
<span id="littlefsUsageText">Used: 0 B / 0 B (0%)</span>
<span id="littlefsDiskVersion" class="disk-version"></span>
</div>
</div>
</div>
<div class="littlefs-controls">
<button id="butLittlefsRefresh" type="button">
Refresh
</button>
<button id="butLittlefsBackup" type="button">
Backup Image
</button>
<button id="butLittlefsWrite" type="button">
Write to Flash
</button>
<button id="butLittlefsClose" type="button">
Close
</button>
</div>
<div class="littlefs-breadcrumb">
<button id="butLittlefsUp" type="button" disabled="disabled">
↑ Up
</button>
<span id="littlefsBreadcrumb">/</span>
</div>
<div class="littlefs-file-upload">
<input type="file" id="littlefsFileInput" />
<button id="butLittlefsUpload" type="button" disabled="disabled">
Upload File
</button>
<button id="butLittlefsMkdir" type="button">
New Folder
</button>
</div>
<div class="littlefs-files">
<table id="littlefsFileTable" class="file-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Size</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="littlefsFileList">
<tr>
<td colspan="4" class="empty-state">No files loaded</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="log"></div>
</div>
</main>
<!-- ESP32-S2 Reconnect Modal -->
<div id="esp32s2Modal" class="modal hidden">
<div class="modal-content">
<h2>ESP32-S2 has switched to USB CDC mode</h2>
<p>Please click the button below to select the new serial port.</p>
<button id="butReconnectS2" type="button" class="modal-button">
Select New Port
</button>
</div>
</div>
<!-- File Viewer Modal -->
<div id="fileViewerModal" class="modal hidden">
<div class="modal-content file-viewer-content">
<div class="file-viewer-header">
<h2 id="fileViewerTitle">File Viewer</h2>
<button id="butCloseFileViewer" type="button" class="close-button">✕</button>
</div>
<div class="file-viewer-info">
<span id="fileViewerPath"></span>
<span id="fileViewerSize"></span>
</div>
<div class="file-viewer-tabs">
<button id="tabText" class="tab-button active" type="button">Text</button>
<button id="tabHex" class="tab-button" type="button">Hex</button>
</div>
<div id="fileViewerContent" class="file-viewer-body">
<pre id="fileViewerText"></pre>
</div>
<div class="file-viewer-footer">
<button id="butDownloadFromViewer" type="button" class="modal-button">
Download
</button>
</div>
</div>
</div>
<footer class="footer"></footer>
</body>
</html>