Disable esptool-js transport tracing and reenable save full flash

This commit is contained in:
Dave Allie
2025-11-22 19:50:54 +11:00
parent 5ebbb328c3
commit 20fb862dc4
6 changed files with 21 additions and 58 deletions
@@ -0,0 +1,16 @@
diff --git a/lib/webserial.js b/lib/webserial.js
index 568e22b52bb61078bab9f20784925d51798e76d6..586401fdf7a4b5b0440b6063647a6b21908f33a8 100644
--- a/lib/webserial.js
+++ b/lib/webserial.js
@@ -45,11 +45,6 @@ class Transport {
* @param {string} message Message to format as trace line.
*/
trace(message) {
- const delta = Date.now() - this.lastTraceTime;
- const prefix = `TRACE ${delta.toFixed(3)}`;
- const traceMessage = `${prefix} ${message}`;
- console.log(traceMessage);
- this.traceLog += traceMessage + "\n";
}
async returnTrace() {
try {
+1 -1
View File
@@ -12,7 +12,7 @@
"dependencies": {
"@chakra-ui/react": "^3.29.0",
"@emotion/react": "^11.14.0",
"esptool-js": "^0.5.7",
"esptool-js": "patch:esptool-js@npm%3A0.5.7#~/.yarn/patches/esptool-js-npm-0.5.7-bd6223d76a.patch",
"next": "16.0.3",
"next-themes": "^0.4.6",
"react": "^19.2.0",
+1 -21
View File
@@ -12,13 +12,11 @@ import {
Container,
Stack,
Flex,
Link,
} from '@chakra-ui/react';
import FileUpload, { FileUploadHandle } from '@/components/FileUpload';
import Steps from '@/components/Steps';
import { useEspOperations } from '@/esp/useEspOperations';
import HeaderBar from '@/components/HeaderBar/HeaderBar';
import { toaster } from '@/components/ui/toaster';
export default function Home() {
const { actions, stepData, isRunning } = useEspOperations();
@@ -80,25 +78,7 @@ export default function Home() {
<Stack gap="4px" as="section">
<Button
variant="subtle"
onClick={() =>
toaster.create({
title: 'Sorry, this is broken right now',
description: (
<Text>
I&apos;m waiting on a fix from esptool-js, see
<Link
href="https://github.com/espressif/esptool-js/issues/218"
target="_blank"
color="white"
>
https://github.com/espressif/esptool-js/issues/218
</Link>
</Text>
),
type: 'error',
})
}
// onClick={actions.saveFullFlash}
onClick={actions.saveFullFlash}
disabled={isRunning}
>
Save full flash
-33
View File
@@ -40,7 +40,6 @@ export default class EspController {
await this.espLoader.after(skipReset ? 'no_reset' : undefined);
}
// Warning: Do not use until https://github.com/espressif/esptool-js/issues/218 is addressed
async readFullFlash(
onPacketReceived?: (
packet: Uint8Array,
@@ -51,38 +50,6 @@ export default class EspController {
return this.espLoader.readFlash(0, 0x1000000, onPacketReceived);
}
// Due to https://github.com/espressif/esptool-js/issues/218, we need to read
// out the full flash in chunks
async readFullFlashInChunks(
onPacketReceived?: (
packet: Uint8Array,
progress: number,
totalSize: number,
) => void,
) {
const chunks = 0x100;
const totalSize = 0x1000000;
const chunkSize = totalSize / chunks;
const response = new Uint8Array(totalSize);
for (let chunk = 0; chunk < chunks; chunk += 1) {
const offset = chunk * chunkSize;
// eslint-disable-next-line no-await-in-loop
const chunkContents = await this.espLoader.readFlash(
offset,
chunkSize,
onPacketReceived
? (packet: Uint8Array, pSize: number, _tSize: number) =>
onPacketReceived(packet, offset + pSize, totalSize)
: undefined,
);
response.set(chunkContents, offset);
}
return response;
}
async writeFullFlash(
data: Uint8Array,
reportProgress?: (
+1 -1
View File
@@ -100,7 +100,7 @@ export function useEspOperations() {
});
const firmwareFile = await wrapWithStep('Read flash', () =>
espController.readFullFlashInChunks((_, p, t) =>
espController.readFullFlash((_, p, t) =>
updateStepData('Read flash', { progress: { current: p, total: t } }),
),
);
+2 -2
View File
@@ -3446,7 +3446,7 @@ __metadata:
languageName: node
linkType: hard
"esptool-js@npm:^0.5.7":
"esptool-js@npm:0.5.7":
version: 0.5.7
resolution: "esptool-js@npm:0.5.7"
dependencies:
@@ -5793,7 +5793,7 @@ __metadata:
eslint-plugin-prettier: "npm:^5.5.4"
eslint-plugin-react: "npm:^7.37.5"
eslint-plugin-react-hooks: "npm:^7.0.1"
esptool-js: "npm:^0.5.7"
esptool-js: "npm:0.5.7"
globals: "npm:^16.5.0"
next: "npm:16.0.3"
next-themes: "npm:^0.4.6"