firmware/actions: remove didStart and didFinish actions

Remove didStart and didFinish actions from firmware flashing sagas as
they are not used for anything.

didFailToFinish is not so easily removed as it is used to trigger error
toasts.
This commit is contained in:
David Lechner
2026-01-04 17:27:08 -06:00
parent 7fe080bf1a
commit a4aade5a29
3 changed files with 0 additions and 86 deletions
-13
View File
@@ -132,19 +132,6 @@ export const flashFirmware = createAction(
}),
);
/**
* Action that indicates flashing firmware started.
* @param total The total number of bytes to be flashed.
*/
export const didStart = createAction(() => ({
type: 'flashFirmware.action.didStart',
}));
/** Action that indicates that flashing firmware completed successfully. */
export const didFinish = createAction(() => ({
type: 'flashFirmware.action.didFinish',
}));
// FIXME: get rid of this monstrosity
const didFailToFinishType = 'flashFirmware.action.didFailToFinish';
-62
View File
@@ -42,8 +42,6 @@ import {
HubError,
MetadataProblem,
didFailToFinish,
didFinish,
didStart,
flashFirmware as flashFirmwareAction,
} from './actions';
import flashFirmware from './sagas';
@@ -124,12 +122,6 @@ describe('flashFirmware', () => {
const mpyBinaryData = new Uint8Array(mpySize);
saga.put(didCompile(mpyBinaryData));
// then start flashing the firmware
// should get didStart action just before starting to erase
action = await saga.take();
expect(action).toEqual(didStart());
// erase first
action = await saga.take();
@@ -232,9 +224,6 @@ describe('flashFirmware', () => {
// then we are done
action = await saga.take();
expect(action).toEqual(didFinish());
await saga.end();
});
@@ -284,12 +273,6 @@ describe('flashFirmware', () => {
saga.put(didRequest(0));
saga.put(infoResponse(0x01000000, 0x08005000, 0x081f800, HubType.MoveHub));
// then start flashing the firmware
// should get didStart action just before starting to erase
action = await saga.take();
expect(action).toEqual(didStart());
// erase first
action = await saga.take();
@@ -392,9 +375,6 @@ describe('flashFirmware', () => {
// then we are done
action = await saga.take();
expect(action).toEqual(didFinish());
await saga.end();
});
@@ -1008,12 +988,6 @@ describe('flashFirmware', () => {
const mpyBinaryData = new Uint8Array(mpySize);
saga.put(didCompile(mpyBinaryData));
// then start flashing the firmware
// should get didStart action just before starting to erase
action = await saga.take();
expect(action).toEqual(didStart());
// erase first
action = await saga.take();
@@ -1121,12 +1095,6 @@ describe('flashFirmware', () => {
const mpyBinaryData = new Uint8Array(mpySize);
saga.put(didCompile(mpyBinaryData));
// then start flashing the firmware
// should get didStart action just before starting to erase
action = await saga.take();
expect(action).toEqual(didStart());
// erase first
action = await saga.take();
@@ -1243,12 +1211,6 @@ describe('flashFirmware', () => {
const mpyBinaryData = new Uint8Array(mpySize);
saga.put(didCompile(mpyBinaryData));
// then start flashing the firmware
// should get didStart action just before starting to erase
action = await saga.take();
expect(action).toEqual(didStart());
// erase first
action = await saga.take();
@@ -1416,12 +1378,6 @@ describe('flashFirmware', () => {
const mpyBinaryData = new Uint8Array(mpySize);
saga.put(didCompile(mpyBinaryData));
// then start flashing the firmware
// should get didStart action just before starting to erase
action = await saga.take();
expect(action).toEqual(didStart());
// erase first
action = await saga.take();
@@ -1594,12 +1550,6 @@ describe('flashFirmware', () => {
saga.put(didRequest(0));
saga.put(infoResponse(0x01000000, 0x08005000, 0x081f800, HubType.MoveHub));
// then start flashing the firmware
// should get didStart action just before starting to erase
action = await saga.take();
expect(action).toEqual(didStart());
// erase first
action = await saga.take();
@@ -1703,9 +1653,6 @@ describe('flashFirmware', () => {
// then we are done
action = await saga.take();
expect(action).toEqual(didFinish());
await saga.end();
});
@@ -2156,12 +2103,6 @@ describe('flashFirmware', () => {
const mpyBinaryData = new Uint8Array(mpySize);
saga.put(didCompile(mpyBinaryData));
// then start flashing the firmware
// should get didStart action just before starting to erase
action = await saga.take();
expect(action).toEqual(didStart());
// erase first
action = await saga.take();
@@ -2262,9 +2203,6 @@ describe('flashFirmware', () => {
// then we are done
action = await saga.take();
expect(action).toEqual(didFinish());
await saga.end();
});
});
-11
View File
@@ -74,8 +74,6 @@ import {
HubError,
MetadataProblem,
didFailToFinish,
didFinish,
didStart,
firmwareDidFailToFlashEV3,
firmwareDidFailToFlashUsbDfu,
firmwareDidFailToRestoreOfficialDfu,
@@ -465,8 +463,6 @@ function* handleFlashFirmware(action: ReturnType<typeof flashFirmware>): Generat
}
}
yield* put(didStart());
yield* put(
alertsShowAlert(
'firmware',
@@ -630,8 +626,6 @@ function* handleFlashFirmware(action: ReturnType<typeof flashFirmware>): Generat
// this will cause the remote device to disconnect and reboot
const rebootAction = yield* put(rebootRequest(nextMessageId()));
yield* waitForDidRequest(rebootAction.id);
yield* put(didFinish());
} catch (err) {
yield* put(didFailToFinish(FailToFinishReasonType.Unknown, ensureError(err)));
yield* disconnectAndCancel();
@@ -1211,9 +1205,6 @@ function* handleFlashEV3(action: ReturnType<typeof firmwareFlashEV3>): Generator
return [new DataView(reply.payload), undefined];
}
// FIXME: should be called much earlier.
yield* put(didStart());
const sectorSize = 64 * 1024; // flash memory sector size
const maxPayloadSize = 1018; // maximum payload size for EV3 commands
@@ -1288,8 +1279,6 @@ function* handleFlashEV3(action: ReturnType<typeof firmwareFlashEV3>): Generator
return;
}
yield* put(didFinish());
yield* cleanup();
yield* put(firmwareDidFlashEV3());