tasmota-esp-web-tools 10.0.0 → 10.0.2
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/components/ewt-littlefs-manager.d.ts +1 -0
- package/dist/components/ewt-littlefs-manager.js +40 -8
- package/dist/install-dialog.js +11 -0
- package/dist/web/install-button.js +1 -1
- package/dist/web/{install-dialog-CVebVk1R.js → install-dialog-YU_01OO8.js} +14 -12
- package/dist/web/wasm/littlefs/index.d.ts +19 -1
- package/dist/web/wasm/littlefs/index.js +0 -10
- package/js/modules/install-button.js +1 -1
- package/js/modules/{install-dialog-CVebVk1R.js → install-dialog-YU_01OO8.js} +14 -12
- package/js/modules/wasm/littlefs/index.d.ts +19 -1
- package/js/modules/wasm/littlefs/index.js +0 -10
- package/package.json +2 -2
|
@@ -17,6 +17,7 @@ export declare class EwtLittleFSManager extends LitElement {
|
|
|
17
17
|
private _selectedFile;
|
|
18
18
|
private _flashProgress;
|
|
19
19
|
private _isFlashing;
|
|
20
|
+
private _flashOperation;
|
|
20
21
|
connectedCallback(): Promise<void>;
|
|
21
22
|
disconnectedCallback(): void;
|
|
22
23
|
private _openFilesystem;
|
|
@@ -50,11 +50,13 @@ let EwtLittleFSManager = class EwtLittleFSManager extends LitElement {
|
|
|
50
50
|
this._diskVersion = "";
|
|
51
51
|
this._busy = false;
|
|
52
52
|
this._selectedFile = null;
|
|
53
|
-
this._flashProgress = 0; // 0-100 for flash progress
|
|
53
|
+
this._flashProgress = 0; // 0-100 for flash progress
|
|
54
54
|
this._isFlashing = false;
|
|
55
|
+
this._flashOperation = null; // Track operation type
|
|
55
56
|
}
|
|
56
57
|
async connectedCallback() {
|
|
57
58
|
super.connectedCallback();
|
|
59
|
+
this.logger.log("LittleFS Manager: connectedCallback called");
|
|
58
60
|
await this._openFilesystem();
|
|
59
61
|
}
|
|
60
62
|
disconnectedCallback() {
|
|
@@ -64,9 +66,21 @@ let EwtLittleFSManager = class EwtLittleFSManager extends LitElement {
|
|
|
64
66
|
async _openFilesystem() {
|
|
65
67
|
try {
|
|
66
68
|
this._busy = true;
|
|
69
|
+
this._isFlashing = true;
|
|
70
|
+
this._flashProgress = 0;
|
|
71
|
+
this._flashOperation = "reading";
|
|
67
72
|
this.logger.log(`Reading LittleFS partition "${this.partition.name}" (${this._formatSize(this.partition.size)})...`);
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
if (!this.espStub.IS_STUB) {
|
|
74
|
+
throw new Error("ESP stub loader is not running. Cannot read flash.");
|
|
75
|
+
}
|
|
76
|
+
// Read entire partition with progress callback
|
|
77
|
+
const data = await this.espStub.readFlash(this.partition.offset, this.partition.size, (_packet, progress, totalSize) => {
|
|
78
|
+
const progressPercent = Math.floor((progress / totalSize) * 100);
|
|
79
|
+
this._flashProgress = progressPercent;
|
|
80
|
+
});
|
|
81
|
+
if (data.length === 0) {
|
|
82
|
+
throw new Error("Read 0 bytes from partition");
|
|
83
|
+
}
|
|
70
84
|
this.logger.log("Mounting LittleFS filesystem...");
|
|
71
85
|
// Load LittleFS module dynamically
|
|
72
86
|
const { createLittleFSFromImage, formatDiskVersion } = await loadLittleFS();
|
|
@@ -105,10 +119,15 @@ let EwtLittleFSManager = class EwtLittleFSManager extends LitElement {
|
|
|
105
119
|
// Get disk version
|
|
106
120
|
try {
|
|
107
121
|
const diskVer = fs.getDiskVersion();
|
|
108
|
-
|
|
122
|
+
if (diskVer && diskVer !== 0) {
|
|
123
|
+
this._diskVersion = formatDiskVersion(diskVer);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
this._diskVersion = "Unknown";
|
|
127
|
+
}
|
|
109
128
|
}
|
|
110
129
|
catch (e) {
|
|
111
|
-
this._diskVersion = "";
|
|
130
|
+
this._diskVersion = "Unknown";
|
|
112
131
|
}
|
|
113
132
|
this._refreshFiles();
|
|
114
133
|
this.logger.log("LittleFS filesystem opened successfully");
|
|
@@ -121,11 +140,15 @@ let EwtLittleFSManager = class EwtLittleFSManager extends LitElement {
|
|
|
121
140
|
}
|
|
122
141
|
finally {
|
|
123
142
|
this._busy = false;
|
|
143
|
+
this._isFlashing = false;
|
|
144
|
+
this._flashProgress = 0;
|
|
145
|
+
this._flashOperation = null;
|
|
124
146
|
}
|
|
125
147
|
}
|
|
126
148
|
_refreshFiles() {
|
|
127
|
-
if (!this._fs)
|
|
149
|
+
if (!this._fs) {
|
|
128
150
|
return;
|
|
151
|
+
}
|
|
129
152
|
try {
|
|
130
153
|
// Calculate usage
|
|
131
154
|
const allFiles = this._fs.list("/");
|
|
@@ -150,6 +173,7 @@ let EwtLittleFSManager = class EwtLittleFSManager extends LitElement {
|
|
|
150
173
|
}
|
|
151
174
|
catch (e) {
|
|
152
175
|
this.logger.error(`Failed to refresh file list: ${e.message || e}`);
|
|
176
|
+
this._files = [];
|
|
153
177
|
}
|
|
154
178
|
}
|
|
155
179
|
_estimateUsage(entries) {
|
|
@@ -343,6 +367,7 @@ let EwtLittleFSManager = class EwtLittleFSManager extends LitElement {
|
|
|
343
367
|
this._busy = true;
|
|
344
368
|
this._isFlashing = true;
|
|
345
369
|
this._flashProgress = 0;
|
|
370
|
+
this._flashOperation = "writing"; // Set operation type
|
|
346
371
|
this.logger.log("Creating LittleFS image...");
|
|
347
372
|
const image = this._fs.toImage();
|
|
348
373
|
this.logger.log(`Image created: ${this._formatSize(image.length)}`);
|
|
@@ -357,7 +382,6 @@ let EwtLittleFSManager = class EwtLittleFSManager extends LitElement {
|
|
|
357
382
|
await this.espStub.flashData(imageBuffer, (bytesWritten, totalBytes) => {
|
|
358
383
|
const percent = Math.floor((bytesWritten / totalBytes) * 100);
|
|
359
384
|
this._flashProgress = percent;
|
|
360
|
-
this.logger.log(`Writing: ${percent}%`);
|
|
361
385
|
}, this.partition.offset);
|
|
362
386
|
this.logger.log(`✓ LittleFS successfully written to flash!`);
|
|
363
387
|
this.logger.log(`To use the new filesystem, reset your device.`);
|
|
@@ -369,6 +393,7 @@ let EwtLittleFSManager = class EwtLittleFSManager extends LitElement {
|
|
|
369
393
|
this._busy = false;
|
|
370
394
|
this._isFlashing = false;
|
|
371
395
|
this._flashProgress = 0;
|
|
396
|
+
this._flashOperation = null;
|
|
372
397
|
}
|
|
373
398
|
}
|
|
374
399
|
_cleanup() {
|
|
@@ -412,7 +437,11 @@ let EwtLittleFSManager = class EwtLittleFSManager extends LitElement {
|
|
|
412
437
|
<div class="usage-text">
|
|
413
438
|
${this._isFlashing
|
|
414
439
|
? html `<span class="flash-status">
|
|
415
|
-
⚡
|
|
440
|
+
⚡
|
|
441
|
+
${this._flashOperation === "reading"
|
|
442
|
+
? "Reading from"
|
|
443
|
+
: "Writing to"}
|
|
444
|
+
flash: ${this._flashProgress}%
|
|
416
445
|
</span>`
|
|
417
446
|
: html `<span
|
|
418
447
|
>Used: ${this._formatSize(this._usage.usedBytes)} /
|
|
@@ -813,6 +842,9 @@ __decorate([
|
|
|
813
842
|
__decorate([
|
|
814
843
|
state()
|
|
815
844
|
], EwtLittleFSManager.prototype, "_isFlashing", void 0);
|
|
845
|
+
__decorate([
|
|
846
|
+
state()
|
|
847
|
+
], EwtLittleFSManager.prototype, "_flashOperation", void 0);
|
|
816
848
|
EwtLittleFSManager = __decorate([
|
|
817
849
|
customElement("ewt-littlefs-manager")
|
|
818
850
|
], EwtLittleFSManager);
|
package/dist/install-dialog.js
CHANGED
|
@@ -867,6 +867,17 @@ export class EwtInstallDialog extends LitElement {
|
|
|
867
867
|
this.logger.log("Running stub...");
|
|
868
868
|
const espStub = await esploader.runStub();
|
|
869
869
|
this._espStub = espStub;
|
|
870
|
+
// Set baudrate for reading flash (use user-selected baudrate if available)
|
|
871
|
+
if (this.baudRate) {
|
|
872
|
+
this.logger.log(`Setting baudrate to ${this.baudRate} for flash reading...`);
|
|
873
|
+
try {
|
|
874
|
+
await espStub.setBaudrate(this.baudRate);
|
|
875
|
+
this.logger.log(`Baudrate set to ${this.baudRate}`);
|
|
876
|
+
}
|
|
877
|
+
catch (baudErr) {
|
|
878
|
+
this.logger.log(`Failed to set baudrate: ${baudErr.message}, continuing with default`);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
870
881
|
// Add a small delay after stub is running
|
|
871
882
|
await sleep(500);
|
|
872
883
|
this.logger.log("Reading flash data...");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=async t=>{let n;import("./install-dialog-
|
|
1
|
+
const e=async t=>{let n;import("./install-dialog-YU_01OO8.js");try{n=await navigator.serial.requestPort()}catch(n){return"NotFoundError"===n.name?void import("./index-t2Vsxqjj.js").then(n=>n.openNoPortPickedDialog(()=>e(t))):void alert(`Error: ${n.message}`)}if(!n)return;try{await n.open({baudRate:115200})}catch(e){return void alert(e.message)}const o=document.createElement("ewt-install-dialog");o.port=n,o.manifestPath=t.manifest||t.getAttribute("manifest"),o.overrides=t.overrides,o.firmwareFile=t.firmwareFile;const r=t.getAttribute("baud-rate");if(r){const e=parseInt(r,10);isNaN(e)||(o.baudRate=e)}else void 0!==t.baudRate&&(o.baudRate=t.baudRate);o.addEventListener("closed",()=>{n.close()},{once:!0}),document.body.appendChild(o)};class t extends HTMLElement{connectedCallback(){if(this.renderRoot)return;if(this.renderRoot=this.attachShadow({mode:"open"}),!t.isSupported||!t.isAllowed)return this.toggleAttribute("install-unsupported",!0),void(this.renderRoot.innerHTML=t.isAllowed?"<slot name='unsupported'>Your browser does not support installing things on ESP devices. Use Google Chrome or Microsoft Edge.</slot>":"<slot name='not-allowed'>You can only install ESP devices on HTTPS websites or on the localhost.</slot>");this.toggleAttribute("install-supported",!0);const n=document.createElement("slot");n.addEventListener("click",async t=>{t.preventDefault(),e(this)}),n.name="activate";const o=document.createElement("button");if(o.innerText="CONNECT",n.append(o),"adoptedStyleSheets"in Document.prototype&&"replaceSync"in CSSStyleSheet.prototype){const e=new CSSStyleSheet;e.replaceSync(t.style),this.renderRoot.adoptedStyleSheets=[e]}else{const e=document.createElement("style");e.innerText=t.style,this.renderRoot.append(e)}this.renderRoot.append(n)}}t.isSupported="serial"in navigator,t.isAllowed=window.isSecureContext,t.style='\n button {\n position: relative;\n cursor: pointer;\n font-size: 14px;\n padding: 8px 28px;\n color: var(--esp-tools-button-text-color, #fff);\n background-color: var(--esp-tools-button-color, #03a9f4);\n border: none;\n border-radius: 4px;\n box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.12), 0 1px 5px 0 rgba(0,0,0,.2);\n }\n button::before {\n content: " ";\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n opacity: 0.2;\n border-radius: 4px;\n }\n button:hover {\n box-shadow: 0 4px 8px 0 rgba(0,0,0,.14), 0 1px 7px 0 rgba(0,0,0,.12), 0 3px 1px -1px rgba(0,0,0,.2);\n }\n button:hover::before {\n background-color: rgba(255,255,255,.8);\n }\n button:focus {\n outline: none;\n }\n button:focus::before {\n background-color: white;\n }\n button:active::before {\n background-color: grey;\n }\n :host([active]) button {\n color: rgba(0, 0, 0, 0.38);\n background-color: rgba(0, 0, 0, 0.12);\n box-shadow: none;\n cursor: unset;\n pointer-events: none;\n }\n improv-wifi-launch-button {\n display: block;\n margin-top: 16px;\n }\n .hidden {\n display: none;\n }',customElements.define("esp-web-install-button",t);
|