wire up firmware flash progress

Also turn off logging and longer checksum interval to improve performance

94K movehub fw flashes in about 1:45
This commit is contained in:
David Lechner
2020-05-20 19:57:23 -05:00
committed by David Lechner
parent 7ba99d62bb
commit 3ae2fb2eef
8 changed files with 81 additions and 39 deletions
+6 -3
View File
@@ -41,6 +41,7 @@ import {
initResponse,
programRequest,
programResponse,
progress,
rebootRequest,
send,
stateResponse,
@@ -305,11 +306,11 @@ function* flashFirmware(action: BootloaderFlashFirmwareAction): Generator {
const payload = firmware.slice(offset, offset + MaxProgramFlashSize);
yield put(programRequest(info[0].startAddress + offset, payload.buffer));
// TODO: dispatch progress action
yield put(progress(offset, firmware.length));
// request checksum every so often to prevent buffer overrun on the hub
// request checksum every 8K to prevent buffer overrun on the hub
// because of sending too much data at once
if (++count % 10 === 0) {
if (++count % 585 === 0) {
yield put(checksumRequest());
const checksum = (yield wait(
BootloaderResponseActionType.Checksum,
@@ -334,6 +335,8 @@ function* flashFirmware(action: BootloaderFlashFirmwareAction): Generator {
throw Error("Didn't flash all bytes");
}
yield put(progress(firmware.length, firmware.length));
// this will cause the remote device to disconnect and reboot
yield put(rebootRequest());
}