mirror of
https://github.com/esphome/esp-web-tools.git
synced 2025-07-28 14:16:41 +00:00
Update esptool-js to 0.2.0 (#317)
This commit is contained in:
parent
f1fb9a2733
commit
d09d54be4b
36
package-lock.json
generated
36
package-lock.json
generated
@ -17,7 +17,7 @@
|
|||||||
"@material/mwc-formfield": "^0.27.0",
|
"@material/mwc-formfield": "^0.27.0",
|
||||||
"@material/mwc-icon-button": "^0.27.0",
|
"@material/mwc-icon-button": "^0.27.0",
|
||||||
"@material/mwc-textfield": "^0.27.0",
|
"@material/mwc-textfield": "^0.27.0",
|
||||||
"esptool-js": "github:espressif/esptool-js#076af269f44daa5b7823031221f39bf22124c129",
|
"esptool-js": "^0.2.0",
|
||||||
"improv-wifi-serial-sdk": "^2.4.0",
|
"improv-wifi-serial-sdk": "^2.4.0",
|
||||||
"lit": "^2.5.0",
|
"lit": "^2.5.0",
|
||||||
"pako": "^2.1.0",
|
"pako": "^2.1.0",
|
||||||
@ -1857,10 +1857,6 @@
|
|||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/crypto-js": {
|
|
||||||
"version": "4.1.1",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "2.6.9",
|
"version": "2.6.9",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||||
@ -1926,12 +1922,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/esptool-js": {
|
"node_modules/esptool-js": {
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"resolved": "git+ssh://git@github.com/espressif/esptool-js.git#076af269f44daa5b7823031221f39bf22124c129",
|
"resolved": "https://registry.npmjs.org/esptool-js/-/esptool-js-0.2.0.tgz",
|
||||||
"integrity": "sha512-zHc9T4qC2j8EZ+1YaFRZILXxk7T1R7eA2Z2Lx1KPxgce1XbFwCsJxp4CpntytGoIDf0ax6/vbb4YArLaehVHOQ==",
|
"integrity": "sha512-TZehTn14FJ6YLfKc+YJlZxhcs5XZasE+85LFbju+TGtb/vb7bXUEkioCkVRUfSnmGBP3uZqAmd2/m7jpoSwOPg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"crypto-js": "^4.0.0",
|
"pako": "^2.1.0",
|
||||||
"xterm": "^4.13.0"
|
"tslib": "^2.4.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/estree-walker": {
|
"node_modules/estree-walker": {
|
||||||
@ -2929,10 +2925,6 @@
|
|||||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/xterm": {
|
|
||||||
"version": "4.19.0",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/yallist": {
|
"node_modules/yallist": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||||
@ -4389,9 +4381,6 @@
|
|||||||
"which": "^2.0.1"
|
"which": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"crypto-js": {
|
|
||||||
"version": "4.1.1"
|
|
||||||
},
|
|
||||||
"debug": {
|
"debug": {
|
||||||
"version": "2.6.9",
|
"version": "2.6.9",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||||
@ -4444,12 +4433,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"esptool-js": {
|
"esptool-js": {
|
||||||
"version": "git+ssh://git@github.com/espressif/esptool-js.git#076af269f44daa5b7823031221f39bf22124c129",
|
"version": "0.2.0",
|
||||||
"integrity": "sha512-zHc9T4qC2j8EZ+1YaFRZILXxk7T1R7eA2Z2Lx1KPxgce1XbFwCsJxp4CpntytGoIDf0ax6/vbb4YArLaehVHOQ==",
|
"resolved": "https://registry.npmjs.org/esptool-js/-/esptool-js-0.2.0.tgz",
|
||||||
"from": "esptool-js@github:espressif/esptool-js#076af269f44daa5b7823031221f39bf22124c129",
|
"integrity": "sha512-TZehTn14FJ6YLfKc+YJlZxhcs5XZasE+85LFbju+TGtb/vb7bXUEkioCkVRUfSnmGBP3uZqAmd2/m7jpoSwOPg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"crypto-js": "^4.0.0",
|
"pako": "^2.1.0",
|
||||||
"xterm": "^4.13.0"
|
"tslib": "^2.4.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"estree-walker": {
|
"estree-walker": {
|
||||||
@ -5162,9 +5151,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"xterm": {
|
|
||||||
"version": "4.19.0"
|
|
||||||
},
|
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublishOnly": "script/build",
|
"prepublishOnly": "script/build",
|
||||||
"postinstall": "patch -Ntu node_modules/esptool-js/ESPLoader.js -i patches/0001-import-pako-and-not-change-baud.patch || true"
|
"postinstall": "patch -Ntu node_modules/esptool-js/lib/esploader.js -i patches/0001-not-change-baud.patch || true"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||||
@ -31,7 +31,7 @@
|
|||||||
"@material/mwc-formfield": "^0.27.0",
|
"@material/mwc-formfield": "^0.27.0",
|
||||||
"@material/mwc-icon-button": "^0.27.0",
|
"@material/mwc-icon-button": "^0.27.0",
|
||||||
"@material/mwc-textfield": "^0.27.0",
|
"@material/mwc-textfield": "^0.27.0",
|
||||||
"esptool-js": "github:espressif/esptool-js#076af269f44daa5b7823031221f39bf22124c129",
|
"esptool-js": "^0.2.0",
|
||||||
"improv-wifi-serial-sdk": "^2.4.0",
|
"improv-wifi-serial-sdk": "^2.4.0",
|
||||||
"lit": "^2.5.0",
|
"lit": "^2.5.0",
|
||||||
"pako": "^2.1.0",
|
"pako": "^2.1.0",
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
--- node_modules/esptool-js/ESPLoader.js 2022-07-19 09:17:05.000000000 -0700
|
|
||||||
+++ node_modules/esptool-js/ESPLoader.fixed.js 2022-07-19 09:19:04.000000000 -0700
|
|
||||||
@@ -1,3 +1,4 @@
|
|
||||||
+import pako from 'pako';
|
|
||||||
import {ESPError, TimeoutError} from "./error.js";
|
|
||||||
|
|
||||||
const MAGIC_TO_CHIP = {
|
|
||||||
@@ -680,7 +681,7 @@
|
|
||||||
|
|
||||||
await this.run_stub();
|
|
||||||
|
|
||||||
- await this.change_baud();
|
|
||||||
+ // await this.change_baud();
|
|
||||||
return chip;
|
|
||||||
}
|
|
||||||
|
|
11
patches/0001-not-change-baud.patch
Normal file
11
patches/0001-not-change-baud.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- node_modules/esptool-js/lib/esploader.js 2023-01-18 15:30:02
|
||||||
|
+++ node_modules/esptool-js/lib/esploader.fixed.js 2023-01-18 15:31:47
|
||||||
|
@@ -677,7 +677,7 @@
|
||||||
|
await this.chip._post_connect(this);
|
||||||
|
}
|
||||||
|
await this.run_stub();
|
||||||
|
- await this.change_baud();
|
||||||
|
+ // await this.change_baud();
|
||||||
|
return chip;
|
||||||
|
}
|
||||||
|
parse_flash_size_arg(flsz) {
|
28
src/flash.ts
28
src/flash.ts
@ -1,7 +1,4 @@
|
|||||||
// @ts-ignore-next-line
|
import { Transport, ESPLoader } from "esptool-js";
|
||||||
import { Transport } from "esptool-js/webserial.js";
|
|
||||||
// @ts-ignore-next-line
|
|
||||||
import { ESPLoader } from "esptool-js/ESPLoader.js";
|
|
||||||
import {
|
import {
|
||||||
Build,
|
Build,
|
||||||
FlashError,
|
FlashError,
|
||||||
@ -41,7 +38,12 @@ export const flash = async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
const transport = new Transport(port);
|
const transport = new Transport(port);
|
||||||
const esploader = new ESPLoader(transport, 115200);
|
const esploader = new ESPLoader(
|
||||||
|
transport,
|
||||||
|
115200,
|
||||||
|
// Wrong type, fixed in https://github.com/espressif/esptool-js/pull/75/files
|
||||||
|
undefined as any
|
||||||
|
);
|
||||||
|
|
||||||
// For debugging
|
// For debugging
|
||||||
(window as any).esploader = esploader;
|
(window as any).esploader = esploader;
|
||||||
@ -68,7 +70,7 @@ export const flash = async (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
chipFamily = await esploader.chip.CHIP_NAME;
|
chipFamily = esploader.chip.CHIP_NAME as any;
|
||||||
|
|
||||||
if (!esploader.chip.ROM_TEXT) {
|
if (!esploader.chip.ROM_TEXT) {
|
||||||
fireStateEvent({
|
fireStateEvent({
|
||||||
@ -184,9 +186,15 @@ export const flash = async (
|
|||||||
let totalWritten = 0;
|
let totalWritten = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await esploader.write_flash({
|
await esploader.write_flash(
|
||||||
fileArray,
|
fileArray,
|
||||||
reportProgress(fileIndex: number, written: number, total: number) {
|
"keep",
|
||||||
|
"keep",
|
||||||
|
"keep",
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
// report progress
|
||||||
|
(fileIndex: number, written: number, total: number) => {
|
||||||
const uncompressedWritten =
|
const uncompressedWritten =
|
||||||
(written / total) * fileArray[fileIndex].data.length;
|
(written / total) * fileArray[fileIndex].data.length;
|
||||||
|
|
||||||
@ -209,8 +217,8 @@ export const flash = async (
|
|||||||
percentage: newPct,
|
percentage: newPct,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
fireStateEvent({
|
fireStateEvent({
|
||||||
state: FlashStateType.ERROR,
|
state: FlashStateType.ERROR,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user