mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 09:36:27 +00:00
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:
committed by
David Lechner
parent
7ba99d62bb
commit
3ae2fb2eef
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user