diff --git a/src/firmware/actions.ts b/src/firmware/actions.ts index 5dff5c99..77d1929d 100644 --- a/src/firmware/actions.ts +++ b/src/firmware/actions.ts @@ -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'; diff --git a/src/firmware/sagas.test.ts b/src/firmware/sagas.test.ts index 97d446a4..5af6da28 100644 --- a/src/firmware/sagas.test.ts +++ b/src/firmware/sagas.test.ts @@ -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(); }); }); diff --git a/src/firmware/sagas.ts b/src/firmware/sagas.ts index 69a62477..946b1447 100644 --- a/src/firmware/sagas.ts +++ b/src/firmware/sagas.ts @@ -74,8 +74,6 @@ import { HubError, MetadataProblem, didFailToFinish, - didFinish, - didStart, firmwareDidFailToFlashEV3, firmwareDidFailToFlashUsbDfu, firmwareDidFailToRestoreOfficialDfu, @@ -465,8 +463,6 @@ function* handleFlashFirmware(action: ReturnType): Generat } } - yield* put(didStart()); - yield* put( alertsShowAlert( 'firmware', @@ -630,8 +626,6 @@ function* handleFlashFirmware(action: ReturnType): 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): 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): Generator return; } - yield* put(didFinish()); - yield* cleanup(); yield* put(firmwareDidFlashEV3());