Skip to content
Merged
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
9 changes: 8 additions & 1 deletion src/sagas/flash-firmware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function* flashFirmware(action: FlashFirmwareFlashAction): Generator {
throw Error('Missing hub type in MaxProgramFlashSize');
}

for (let offset = 0; offset < firmware.length; offset += maxDataSize) {
for (let offset = 0; ; ) {
const payload = firmware.slice(offset, offset + maxDataSize);
const programAction = (yield put(
programRequest(info[0].startAddress + offset, payload.buffer),
Expand All @@ -289,6 +289,13 @@ function* flashFirmware(action: FlashFirmwareFlashAction): Generator {

yield put(progress(offset, firmware.length));

// we don't want to request checksum if this is the last packet since
// the bootloader will send a response to the program request already.
offset += maxDataSize;
if (offset >= firmware.length) {
break;
}

if (connectResult.canWriteWithoutResponse) {
// Request checksum every 10 packets to prevent buffer overrun on
// the hub because of sending too much data at once. The actual
Expand Down