mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
firmware/sagas: add check for new SPIKE Prime bootloader version
This commit is contained in:
@@ -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'),
|
||||
});
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user