Skip to content
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

### Added

- Write support for 91x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Greg:

Suggested change
- Write support for 91x
- Added support for Nordic Thingy:91 X. Only writing operations are supported, as for other Nordic Thingy devices.


## 4.5.0 - 2024-12-17

### Changed
Expand Down
4 changes: 3 additions & 1 deletion src/actions/mcubootTargetActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export const performUpdate = async (
dfuFilePath: string,
onProgress: (progress: Progress) => void,
abortController: AbortController,
netCoreUploadDelay?: number
netCoreUploadDelay?: number,
target?: string
) => {
logger.info(`Writing ${dfuFilePath} to device ${device.serialNumber}`);

Expand All @@ -75,6 +76,7 @@ export const performUpdate = async (
undefined,
{
netCoreUploadDelay,
target,
},
abortController
);
Expand Down
69 changes: 67 additions & 2 deletions src/components/McuUpdateDialogView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ import {
classNames,
clearConfirmBeforeClose,
clearWaitForDevice,
convertToDropDownItems,
DialogButton,
Dropdown,
DropdownItem,
GenericDialog,
getPersistentStore,
getSelectedDropdownItem,
logger,
NumberInlineInput,
Overlay,
selectedDevice,
selectedDeviceInfo,
setWaitForDevice,
Slider,
Toggle,
Expand All @@ -40,6 +46,8 @@ import { WithRequired } from '../util/types';

const TOOLTIP_TEXT =
'Delay duration to allow successful image swap from RAM NET to NET core after image upload. Recommended default timeout is 40s. Should be increased for the older Thingy:53 devices';
const TOOLTIP_TEXT_MULTIPLE_TARGETS =
'Your device has multiple targets. Please select the target you want to program.';

const NET_CORE_UPLOAD_DELAY = 120;

Expand All @@ -56,8 +64,19 @@ const McuUpdateDialogView = () => {
const isVisible = useSelector(getShowMcuBootProgrammingDialog);
const mcubootFwPath = useSelector(getMcubootFilePath);
const zipFilePath = useSelector(getZipFilePath);
const deviceInfo = useSelector(selectedDeviceInfo);

const programmingOptions =
deviceInfo?.mcuStateOptions?.filter(s => s.type === 'Programming') ??
[];

const targetDropdownItems = convertToDropDownItems(
programmingOptions.map(s => s.arguments?.target),
false
);

const fwPath = mcubootFwPath || zipFilePath;
const [chosenTarget, setChosenTarget] = useState<string>('');

const writingHasStarted = writing || writingFail || writingSucceed;

Expand Down Expand Up @@ -111,6 +130,12 @@ const McuUpdateDialogView = () => {
}
}, [device, showDelayTimeout]);

useEffect(() => {
if (targetDropdownItems.length > 0) {
setChosenTarget(targetDropdownItems[0].value);
}
}, [targetDropdownItems]);

const onCancel = () => {
dispatch(clearWaitForDevice());
dispatch(setShowMcuBootProgrammingDialog(false));
Expand Down Expand Up @@ -175,7 +200,8 @@ Are you sure you want to continue?`,
setProgress(updatedProgress);
},
abortController.current,
showDelayTimeout ? uploadDelay : undefined
showDelayTimeout ? uploadDelay : undefined,
mcubootFwPath ? chosenTarget : undefined
)
.then(() => {
setWritingSucceed(true);
Expand Down Expand Up @@ -231,7 +257,14 @@ Are you sure you want to continue?`,
<DialogButton
variant="primary"
onClick={onWriteStart}
disabled={writing || writingSucceed || writingFail}
disabled={
writing ||
writingSucceed ||
writingFail ||
(programmingOptions.length > 1 &&
!chosenTarget &&
!!mcubootFwPath)
Comment on lines +263 to +265
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks a bit complex, how this one should be tested? looks like it does overlap with existing mcuboot programming?

}
>
Write
</DialogButton>
Expand All @@ -247,6 +280,38 @@ Are you sure you want to continue?`,
<span>{` ${mcubootFwPath || zipFilePath}`}</span>
</Form.Label>
</Form.Group>

{programmingOptions.length > 1 && !zipFilePath && (
<Form.Group>
<Form.Label
style={{ display: 'inline-flex', alignItems: 'center' }}
>
<strong>Target:</strong>
<Overlay
tooltipChildren={
<span>{TOOLTIP_TEXT_MULTIPLE_TARGETS}</span>
}
keepShowingOnHoverTooltip
tooltipId="test"
placement="right"
>
<span className="mdi mdi-information-outline info-icon ml-1" />
</Overlay>
</Form.Label>
<Dropdown
items={targetDropdownItems}
onSelect={(item: DropdownItem) => {
setChosenTarget(item.value);
}}
selectedItem={getSelectedDropdownItem(
targetDropdownItems,
chosenTarget
)}
disabled={writingHasStarted}
/>
</Form.Group>
)}

{writing && (
<Form.Group>
<Form.Label>
Expand Down