mirror of
https://github.com/crosspoint-reader/xteink-flasher.git
synced 2026-04-29 10:25:18 -07:00
Disable esptool-js transport tracing and reenable save full flash
This commit is contained in:
@@ -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
@@ -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
@@ -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'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
|
||||
|
||||
@@ -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?: (
|
||||
|
||||
@@ -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 } }),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user