-
Notifications
You must be signed in to change notification settings - Fork 13
Adds initial support for the x3 device #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
221037e
625f7b4
5bd31ad
5632b10
a7f3716
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,10 @@ | |
| Alert, | ||
| Stack, | ||
| Flex, | ||
| HStack, | ||
| Text, | ||
| } from '@chakra-ui/react'; | ||
| import type { DeviceModel } from '@/esp/useEspOperations'; | ||
| import FileUpload, { FileUploadHandle } from '@/components/FileUpload'; | ||
| import Steps from '@/components/Steps'; | ||
| import { useEspOperations } from '@/esp/useEspOperations'; | ||
|
|
@@ -20,7 +23,8 @@ | |
| } from '@/remote/firmwareFetcher'; | ||
|
|
||
| export default function Home() { | ||
| const { actions, stepData, isRunning } = useEspOperations(); | ||
| const { actions, stepData, isRunning, deviceModel, setDeviceModel } = | ||
| useEspOperations(); | ||
| const [officialFirmwareVersions, setOfficialFirmwareVersions] = useState<{ | ||
| en: string; | ||
| ch: string; | ||
|
|
@@ -32,15 +36,42 @@ | |
| const appPartitionFileInput = useRef<FileUploadHandle>(null); | ||
|
|
||
| useEffect(() => { | ||
| getOfficialFirmwareVersions().then((versions) => | ||
| setOfficialFirmwareVersions(versions), | ||
| ); | ||
| let cancelled = false; | ||
| setOfficialFirmwareVersions(null); | ||
| getOfficialFirmwareVersions(deviceModel).then((versions) => { | ||
| if (!cancelled) { | ||
| setOfficialFirmwareVersions(versions); | ||
| } | ||
| }); | ||
|
|
||
| return () => { | ||
| cancelled = true; | ||
| }; | ||
| }, [deviceModel]); | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| useEffect(() => { | ||
| getCommunityFirmwareRemoteData().then(setCommunityFirmwareVersions); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <Flex direction="column" gap="20px"> | ||
| <Stack gap={3} as="section"> | ||
| <Heading size="xl">Device model</Heading> | ||
| <HStack gap={3}> | ||
| {(['x4', 'x3'] as const).map((model) => ( | ||
| <Button | ||
| key={model} | ||
| variant={deviceModel === model ? 'solid' : 'outline'} | ||
| aria-pressed={deviceModel === model} | ||
| onClick={() => setDeviceModel(model)} | ||
| disabled={isRunning} | ||
| > | ||
| Xteink {model.toUpperCase()} | ||
| </Button> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ))} | ||
| </HStack> | ||
| </Stack> | ||
|
Comment on lines
+58
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't expose the CrossPoint flash path in X3 mode yet. This selector makes X3 look fully supported, but the community firmware path is still model-agnostic in 🧭 Minimal UI guard <Button
variant="subtle"
onClick={actions.flashCrossPointFirmware}
- disabled={isRunning || !communityFirmwareVersions}
+ disabled={
+ isRunning || !communityFirmwareVersions || deviceModel === 'x3'
+ }
loading={!communityFirmwareVersions}
>🤖 Prompt for AI Agents |
||
| <Separator /> | ||
| <Alert.Root status="warning"> | ||
| <Alert.Indicator /> | ||
| <Alert.Content> | ||
|
|
@@ -208,8 +239,8 @@ | |
| <Alert.Title>Change device language</Alert.Title> | ||
| <Alert.Description> | ||
| Before starting the process, it is recommended to change the device | ||
| language to English. To do this, select “Settings” icon, then click | ||
| “OK / Confirm” button and “OK / Confirm” again until English is | ||
| language to English. To do this, select “Settings” icon, then click | ||
| “OK / Confirm” button and “OK / Confirm” again until English is | ||
|
Check failure on line 243 in src/app/page.tsx
|
||
| shown. Otherwise, the language will still be Chinese after flashing | ||
| and you may not notice changes. | ||
| </Alert.Description> | ||
|
|
@@ -220,13 +251,23 @@ | |
| <Alert.Content> | ||
| <Alert.Title>Device restart instructions</Alert.Title> | ||
| <Alert.Description> | ||
| Once you complete a write operation, you will need to restart your | ||
| device by pressing and releasing the small “Reset” button near the | ||
| bottom right, followed quickly by pressing and holding of the main | ||
| power button for about 3 seconds. | ||
| <Stack> | ||
| <p> | ||
| Once you complete a write operation, you will need to restart | ||
| your device by pressing and releasing the small “Reset” button | ||
|
Check failure on line 257 in src/app/page.tsx
|
||
| near the bottom right, followed quickly by pressing and holding | ||
| of the main power button for about 3 seconds. | ||
| </p> | ||
| {deviceModel === 'x3' && ( | ||
| <p> | ||
| For CrossPoint firmware, disconnect the USB cable and connect | ||
| it again instead. | ||
| </p> | ||
| )} | ||
| </Stack> | ||
| </Alert.Description> | ||
| </Alert.Content> | ||
| </Alert.Root> | ||
| </Flex> | ||
| ); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused imports to fix pipeline failure.
Static analysis and the CI pipeline flag
TextandDeviceModelas unused imports. Remove them to pass the lint check.🔧 Proposed fix
🧰 Tools
🪛 ESLint
[error] 15-15: Unable to resolve path to module '@chakra-ui/react'.
(import-x/no-unresolved)
🪛 GitHub Actions: CI
[warning] 14-14: ESLint (
@typescript-eslint/no-unused-vars): 'Text' is defined but never used.[warning] 16-16: ESLint (
@typescript-eslint/no-unused-vars): 'DeviceModel' is defined but never used.🪛 GitHub Check: lint
[warning] 16-16:
'DeviceModel' is defined but never used
[warning] 14-14:
'Text' is defined but never used
🤖 Prompt for AI Agents