Skip to content

Commit 2b07bf6

Browse files
committed
firmware/ev3: add extra progress report
Add an extra progress between erasing and writing. This makes the progress not stall for quite as long before progressing when flashing smaller firmwares.
1 parent 20ab992 commit 2b07bf6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/firmware/sagas.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,22 @@ function* handleFlashEV3(action: ReturnType<typeof firmwareFlashEV3>): Generator
12541254
return;
12551255
}
12561256

1257+
// Erasing takes about the same time as writing, so this will make the
1258+
// progress bar smoother.
1259+
yield* put(
1260+
alertsShowAlert(
1261+
'firmware',
1262+
'flashProgress',
1263+
{
1264+
action: 'flash',
1265+
progress:
1266+
(i + sectorData.byteLength / 2) / action.firmware.byteLength,
1267+
},
1268+
firmwareEv3ProgressToastId,
1269+
true,
1270+
),
1271+
);
1272+
12571273
for (let j = 0; j < sectorData.byteLength; j += maxPayloadSize) {
12581274
const payload = sectorData.slice(j, j + maxPayloadSize);
12591275

0 commit comments

Comments
 (0)