Skip to content

Commit

Permalink
Merge pull request #17 from RushikeshPatange/fix/support_esptooljs_3.0.0
Browse files Browse the repository at this point in the history
Fix : Add Support for esptool-js 3.0.0 Release in ESPLaunchpad
  • Loading branch information
RushikeshPatange authored Jul 18, 2023
2 parents b225ed6 + 9cf1b02 commit 832a4e5
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 15 deletions.
40 changes: 33 additions & 7 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,13 @@ async function connectToDevice() {
}

try {
esploader = new ESPLoader(transport, baudrates.value, espLoaderTerminal);
const loaderOptions = {
transport,
baudrate: baudrates.value,
terminal: espLoaderTerminal
};
esploader = new ESPLoader(loaderOptions);
connected = true;

chipDesc = await esploader.main_fn();
chip = esploader.chip.CHIP_NAME;

Expand Down Expand Up @@ -524,8 +528,19 @@ programButton.onclick = async () => {
fileArr.push({data:fileObj.data, address:offset});
}
$('#v-pills-console-tab').click();
await esploader.write_flash(fileArr, 'keep');
postFlashDone();
try {
const flashOptions = {
fileArray : fileArr,
flashSize: "keep",
flashMode: undefined,
flashFreq: undefined,
eraseAll: false,
compress: true,
};
await esploader.write_flash(flashOptions);
postFlashDone();
} catch (e) {
}
}

async function downloadAndFlash(fileURL) {
Expand All @@ -552,9 +567,20 @@ async function downloadAndFlash(fileURL) {
resolve(undefined);
}
});
if (data !== undefined) {
$('#v-pills-console-tab').click();
await esploader.write_flash([{data:data, address:0x0000}], 'keep');
try {
if (data !== undefined) {
$('#v-pills-console-tab').click();
const flashOptions = {
fileArray : [{data:data, address:0x0000}],
flashSize: "keep",
flashMode: undefined,
flashFreq: undefined,
eraseAll: false,
compress: true,
};
await esploader.write_flash(flashOptions);
}
} catch (e) {
}
}

Expand Down
14 changes: 7 additions & 7 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 @@ -2,7 +2,7 @@
"name": "esp-launchpad",
"dependencies": {
"crypto-js": "^4.1.1",
"esptool-js": "^0.2.2",
"esptool-js": "^0.3.0",
"toml-js": "^0.0.8",
"xterm": "^4.17.0",
"xterm-addon-fit": "^0.5.0"
Expand Down

0 comments on commit 832a4e5

Please sign in to comment.