Skip to content

Commit

Permalink
fix: Ember: Fix launch bootloader command (#1118)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerivec authored Jul 17, 2024
1 parent ca1dd1f commit 276359e
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/adapter/ember/ezsp/ezsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7683,27 +7683,23 @@ export class Ezsp extends EventEmitter<EzspEventMap> {
//-----------------------------------------------------------------------------

/**
* Quits the current application and launches the standalone bootloader (if
* installed) The function returns an error if the standalone bootloader is not
* present
* @param mode uint8_t Controls the mode in which the standalone bootloader will run. See the app. note for full details.
* Options are: STANDALONE_BOOTLOADER_NORMAL_MODE: Will listen for an over-the-air image transfer on the current
* channel with current power settings. STANDALONE_BOOTLOADER_RECOVERY_MODE: Will listen for an over-the-air image
* transfer on the default channel with default power settings. Both modes also allow an image transfer to begin
* with XMODEM over the serial protocol's Bootloader Frame.
* Quits the current application and launches the standalone bootloader (if installed).
* The function returns an error if the standalone bootloader is not present.
* @param enabled If true, launch the standalone bootloader. If false, do nothing.
* @returns An SLStatus value indicating success or the reason for failure.
*/
async ezspLaunchStandaloneBootloader(mode: number): Promise<SLStatus> {
async ezspLaunchStandaloneBootloader(enabled: boolean): Promise<SLStatus> {
const sendBuffalo = this.startCommand(EzspFrameID.LAUNCH_STANDALONE_BOOTLOADER);
sendBuffalo.writeUInt8(mode);
sendBuffalo.writeUInt8(enabled ? 1 : 0);

const sendStatus = await this.sendCommand(sendBuffalo);

if (sendStatus !== EzspStatus.SUCCESS) {
throw new EzspError(sendStatus);
}

const status = this.buffalo.readStatus(this.version);
// XXX: SDK says this is SLStatus, but received frame has just 1 byte, so, still EmberStatus
const status = this.buffalo.readStatus(0);

return status;
}
Expand Down

0 comments on commit 276359e

Please sign in to comment.