Skip to content

Commit

Permalink
Missing DFU manifest code added
Browse files Browse the repository at this point in the history
  • Loading branch information
kglovern committed Jan 31, 2024
1 parent 27b2faf commit e830920
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/server/lib/Firmware/Flashing/DFUFlasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,24 @@ class DFUFlasher extends events.EventEmitter {
await this.dfu.open();
this.map = this.parseHex(this.hex);
let startAddress = null;


for (let [address, dataBlock] of this.map) {
this.emit('info', `Writing block of size ${dataBlock.byteLength} at address 0x${address.toString(16)}`);
if (!startAddress) {
startAddress = address;
}
await this.download(address, this.XFER_SIZE, dataBlock);
}
log.info(`Jumping back to start address ${startAddress}`);

log.info(`Jumping back to start address ${startAddress} to manifest`);
await this.sendDFUCommand(this.SET_ADDRESS, startAddress, 4);
await this.dfu.download(new ArrayBuffer(0), 0);
try {
await this.dfu.pollUntil(state => (state === this.dfu.dfuMANIFEST));
} catch (error) {
this.emit('error', error);
}

await this.dfu.close();
this.emit('end');
Expand Down

0 comments on commit e830920

Please sign in to comment.