Skip to content

Commit

Permalink
Feat: update shared
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebonnici committed May 29, 2024
1 parent f09bc6e commit b68cb7c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 24 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 7 additions & 20 deletions src/actions/jlinkTargetActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
describeError,
Device,
logger,
setWaitForDevice,
} from '@nordicsemiconductor/pc-nrfconnect-shared';
import {
BatchCallbacks,
Expand Down Expand Up @@ -411,33 +410,21 @@ export const recover =

export const updateOBFirmware =
(device: Device): AppThunk<RootState, Promise<void>> =>
async dispatch => {
dispatch(
setWaitForDevice({
timeout: 30000,
when: 'always',
once: false,
})
);
logger.info(`Updating OB Firmware`);
await NrfutilDeviceLib.updateDebugProbeFirmware(device).then(result => {
dispatch => {
logger.info(`Updating J-Link OB firmware.`);
return dispatch(
NrfutilDeviceLib.updateOBFirmwareWithWaitForDevice(device)
).then(result => {
if (result.versionAfterUpdate === result.versionBeforeUpdate) {
logger.info(
`No OB version update was required. OB version is at ${result.versionAfterUpdate}.`
`No J-Link OB firmware update was required. Version is at ${result.versionAfterUpdate}.`
);
} else {
logger.info(
`OB version was updated to ${result.versionAfterUpdate}.`
`J-Link OB firmware version was updated to ${result.versionAfterUpdate}.`
);
}
});
dispatch(
setWaitForDevice({
timeout: 30000,
when: 'always',
once: true,
})
);
};

export const recoverAndWrite =
Expand Down
2 changes: 1 addition & 1 deletion src/components/ControlPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ Are you sure you want to continue?`,
disabled={isMcuboot || !isJLink || !targetIsReady}
>
<span className="mdi mdi-update" />
Update OB Firmware
Update J-Link OB Firmware
</Button>
<Button
variant="secondary"
Expand Down
1 change: 1 addition & 0 deletions src/reducers/settingsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const settingsSlice = createSlice({
settingsLoad(state, action: PayloadAction<SettingsState>) {
state.autoRead = action.payload.autoRead;
state.autoReset = action.payload.autoReset;
state.autoUpdateOBFirmware = action.payload.autoUpdateOBFirmware;
},
toggleAutoRead(state) {
state.autoRead = !state.autoRead;
Expand Down

0 comments on commit b68cb7c

Please sign in to comment.