mirror of
https://github.com/esphome/esp-web-tools.git
synced 2025-07-28 14:16:41 +00:00
Fix bytes written
This commit is contained in:
parent
2488ffb403
commit
7b9416bd5c
@ -148,11 +148,13 @@ export const startFlash = async (
|
|||||||
let totalWritten = 0;
|
let totalWritten = 0;
|
||||||
|
|
||||||
for (const part of build.parts) {
|
for (const part of build.parts) {
|
||||||
|
const file = files.shift()!;
|
||||||
await espStub.flashData(
|
await espStub.flashData(
|
||||||
files.shift()!,
|
file,
|
||||||
(newBytesWritten) => {
|
(bytesWritten) => {
|
||||||
totalWritten += newBytesWritten;
|
const newPct = Math.floor(
|
||||||
const newPct = Math.floor((totalWritten / totalSize) * 100);
|
((totalWritten + bytesWritten) / totalSize) * 100
|
||||||
|
);
|
||||||
if (newPct === lastPct) {
|
if (newPct === lastPct) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -164,8 +166,14 @@ export const startFlash = async (
|
|||||||
},
|
},
|
||||||
part.offset
|
part.offset
|
||||||
);
|
);
|
||||||
|
totalWritten += file.byteLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logEl.addRow({
|
||||||
|
id: "write",
|
||||||
|
content: html`Writing progress: 100%`,
|
||||||
|
});
|
||||||
|
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
await esploader.softReset();
|
await esploader.softReset();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user