firmware/sagas: add check for new SPIKE Prime bootloader version

This commit is contained in:
David Lechner
2026-01-03 21:01:53 -06:00
parent 8db1a27486
commit 4469e173cd
4 changed files with 40 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2025-2026 The Pybricks Authors
import { Intent } from '@blueprintjs/core';
import { Error } from '@blueprintjs/icons';
import React from 'react';
import type { CreateToast } from '../../toasterTypes';
import { useI18n } from './i18n';
const UnsupportedDfuHub: React.FunctionComponent = () => {
const i18n = useI18n();
return (
<>
<p>{i18n.translate('unsupportedDfuHub.message')}</p>
</>
);
};
export const unsupportedDfuHub: CreateToast = (onAction) => ({
message: <UnsupportedDfuHub />,
icon: <Error />,
intent: Intent.DANGER,
onDismiss: () => onAction('dismiss'),
});
+3 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2022-2025 The Pybricks Authors
// Copyright (c) 2022-2026 The Pybricks Authors
import { dfuError } from './DfuError';
import { flashProgress } from './FlashProgress';
@@ -8,6 +8,7 @@ import { noDfuInterface } from './NoDfuInterface';
import { noWebHid } from './NoWebHid';
import { noWebUsb } from './NoWebUsb';
import { releaseButton } from './ReleaseButton';
import { unsupportedDfuHub } from './UnsupportedDfuHub';
export default {
dfuError,
@@ -17,4 +18,5 @@ export default {
noWebHid,
noWebUsb,
releaseButton,
unsupportedDfuHub,
};
+3
View File
@@ -22,6 +22,9 @@
"installUsbDriverButton": "Install USB Driver",
"configureUdevRulesButton": "Configure udev rules"
},
"unsupportedDfuHub": {
"message": "This hub has different internal electronics and requires a different firmware. Pybricks does not support this yet. We are working on it!"
},
"noDfuInterface": {
"message": "This is very unusual. The USB device did not contain the expected interface."
},
+10 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2020-2025 The Pybricks Authors
// Copyright (c) 2020-2026 The Pybricks Authors
import {
FirmwareReader,
@@ -754,6 +754,15 @@ function* handleFlashUsbDfu(action: ReturnType<typeof firmwareFlashUsbDfu>): Gen
return;
}
if (
device.productId === LegoUsbProductId.SpikePrimeBootloader &&
device.deviceVersionMajor !== 1
) {
yield* put(alertsShowAlert('firmware', 'unsupportedDfuHub'));
yield* put(firmwareDidFailToFlashUsbDfu());
return;
}
const dfu = new WebDFU(
device,
// forceInterfacesName is needed to get the flash layout map