Skip to content

Commit 9b79b34

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 a1294e8 commit 9b79b34

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
@@ -1268,6 +1268,22 @@ function* handleFlashEV3(action: ReturnType<typeof firmwareFlashEV3>): Generator
12681268
return;
12691269
}
12701270

1271+
// Erasing takes about the same time as writing, so this will make the
1272+
// progress bar smoother.
1273+
yield* put(
1274+
alertsShowAlert(
1275+
'firmware',
1276+
'flashProgress',
1277+
{
1278+
action: 'flash',
1279+
progress:
1280+
(i + sectorData.byteLength / 2) / action.firmware.byteLength,
1281+
},
1282+
firmwareEv3ProgressToastId,
1283+
true,
1284+
),
1285+
);
1286+
12711287
for (let j = 0; j < sectorData.byteLength; j += maxPayloadSize) {
12721288
const payload = sectorData.slice(j, j + maxPayloadSize);
12731289

0 commit comments

Comments
 (0)