Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/esploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@
const imageObject = await loadFirmwareImage(this.chip, image);
imageObject.verify();
} catch (error) {
console.log(

Check warning on line 1383 in src/esploader.ts

View workflow job for this annotation

GitHub Actions / ci

Unexpected console statement
`Warning: Image file at 0x${address.toString(16)} is not a valid ${
this.chip.CHIP_NAME
} image, so not changing any flash settings.`,
Expand Down Expand Up @@ -1652,8 +1652,9 @@
* Execute this function to execute after operation reset functions.
* @param {After} mode After operation mode. Default is 'hard_reset'.
* @param { boolean } usingUsbOtg For 'hard_reset' to specify if using USB-OTG
* @param {string} sequenceString For 'custom_reset' to specify the custom reset sequence string
*/
async after(mode: After = "hard_reset", usingUsbOtg?: boolean) {
async after(mode: After = "hard_reset", usingUsbOtg?: boolean, sequenceString?: string) {
switch (mode) {
case "hard_reset":
if (this.resetConstructors.hardReset) {
Expand All @@ -1669,6 +1670,19 @@
case "no_reset_stub":
this.info("Staying in flasher stub.");
break;
case "custom_reset":
if (!sequenceString) {
this.info("Custom reset sequence not provided, doing nothing.");
}
if (!this.resetConstructors.customReset) {
this.info("Custom reset constructor not available, doing nothing.");
}
if (this.resetConstructors.customReset && sequenceString) {
this.info("Custom resetting using sequence " + sequenceString);
const customReset = this.resetConstructors.customReset(this.transport, sequenceString);
await customReset.reset();
}
break;
default:
this.info("Staying in bootloader.");
if (this.IS_STUB) {
Expand Down
2 changes: 1 addition & 1 deletion src/image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
/**
* Function to load a firmware image from a string (from FileReader)
* @param {ROM} rom - The ROM object representing the target device
* @param imageData Image data as a string
* @param {string} imageData Image data as a string
* @returns {Promise<BaseFirmwareImage>} - A promise that resolves to the loaded firmware image
*/
export async function loadFirmwareImage(rom: ROM, imageData: string): Promise<BaseFirmwareImage> {
Expand Down
2 changes: 1 addition & 1 deletion src/types/resetModes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export type Before = "default_reset" | "usb_reset" | "no_reset" | "no_reset_no_s
/**
* Reset modes that can be used after operation is finished.
*/
export type After = "hard_reset" | "soft_reset" | "no_reset" | "no_reset_stub";
export type After = "hard_reset" | "soft_reset" | "no_reset" | "no_reset_stub" | "custom_reset";
Loading