Skip to content

Commit

Permalink
Bump ESPTool-JS to 0.3.0 (esphome#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob authored Jul 8, 2023
1 parent ddda8cc commit cf4fc18
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 40 deletions.
41 changes: 16 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@mdi/js": "^7.2.96",
"@polymer/paper-tooltip": "^3.0.1",
"@types/w3c-web-serial": "^1.0.3",
"esptool-js": "^0.2.1",
"esptool-js": "^0.3.0",
"improv-wifi-serial-sdk": "^2.5.0",
"lit": "^2.7.5",
"tslib": "^2.5.0",
Expand Down
9 changes: 4 additions & 5 deletions src/web-serial/create-esploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { Transport, ESPLoader } from "esptool-js";

export const createESPLoader = (port: SerialPort) => {
const transport = new Transport(port);
return new ESPLoader(
return new ESPLoader({
transport,
115200,
// Wrong type, fixed in https://github.com/espressif/esptool-js/pull/75/files
undefined as any
);
baudrate: 115200,
romBaudrate: 115200,
});
};
18 changes: 9 additions & 9 deletions src/web-serial/flash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ export const flashFiles = async (
let totalWritten = 0;
writeProgress(0);

await esploader.write_flash(
await esploader.write_flash({
fileArray,
"keep",
"keep",
"keep",
false,
true,
flashSize: "keep",
flashMode: "keep",
flashFreq: "keep",
eraseAll: false,
compress: true,
// report progress
(fileIndex: number, written: number, total: number) => {
reportProgress: (fileIndex: number, written: number, total: number) => {
const uncompressedWritten =
(written / total) * fileArray[fileIndex].data.length;

Expand All @@ -76,8 +76,8 @@ export const flashFiles = async (
}

writeProgress(newPct);
}
);
},
});

writeProgress(100);
};

0 comments on commit cf4fc18

Please sign in to comment.