Skip to content
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

Automatic firmware update for official trackers #1241

Merged
merged 104 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
f775da6
Allow for buttons to not have a child
loucass003 Oct 18, 2023
7b9a0ba
Fix VRMode not going back to home screen when resizing to desktop layout
loucass003 Oct 18, 2023
97dce51
Make Stepper Slider not glitch on window resize
loucass003 Oct 18, 2023
01d8e3f
Refactor of the dropdown component
loucass003 Oct 18, 2023
829d6df
Refactor TrashIcon ArrowIcon and LoaderIcon
loucass003 Oct 18, 2023
7b98137
Add more colors to checkbox
loucass003 Oct 18, 2023
062511b
Add disabled state to Ratio, Fix typos and bad typing
loucass003 Oct 18, 2023
6ef43b6
Add errors and disabled state to Input
loucass003 Oct 18, 2023
fb90362
Firmware tool
loucass003 Oct 18, 2023
e8a9112
Sync with main
loucass003 Nov 5, 2023
70003dc
Remove no needed changes
loucass003 Nov 5, 2023
fb7a497
Fix datafeed
loucass003 Nov 5, 2023
2128094
Merge branch 'main' into llelievr/firmware-tool
ImUrX Mar 22, 2024
4013e36
fix stuff
ImUrX Mar 22, 2024
1c69cbc
fix android test
ImUrX Mar 22, 2024
272b3cc
use slimevr.io urls
ImUrX Mar 29, 2024
d7df57f
Merge branch 'main' into llelievr/firmware-tool
ImUrX Mar 30, 2024
408fe21
Merge branch 'main' into llelievr/firmware-tool
ImUrX Apr 9, 2024
1184674
fix lock file
ImUrX Apr 9, 2024
5dbbf5d
Merge remote-tracking branch 'origin/main' into llelievr/firmware-tool
ImUrX Apr 9, 2024
269ebbd
tweak package.json
ImUrX Apr 9, 2024
b35ac6c
migrate to eslint flat config
ImUrX Apr 10, 2024
6214372
improve styling and translation files
ImUrX Apr 10, 2024
353d1c4
Merge branch 'main' into llelievr/firmware-tool
ImUrX May 28, 2024
99d7dd6
fix env error
ImUrX May 28, 2024
2a3c00a
Merge branch 'main' of github.com:SlimeVR/SlimeVR-Server into lleliev…
loucass003 Jun 25, 2024
a0c68af
Remove conflicts from package.json
loucass003 Jun 25, 2024
b6e496a
Fix layouts + Rework protocol + Try stuff around serial reconnect det…
loucass003 Jun 28, 2024
1e989c1
Current progress
loucass003 Oct 4, 2024
720d210
Final version
loucass003 Oct 4, 2024
e1dc199
Spotless + Fix lint then lint
loucass003 Oct 7, 2024
5f3c3ab
Better handling of the incompatible api case
loucass003 Oct 7, 2024
ef48e7a
Change deviceid and update flashing lib version
loucass003 Oct 7, 2024
9a46050
Change provisioning to handle the new mac address detection
loucass003 Oct 8, 2024
f171a03
enforce lf with editorconfig
ImUrX Oct 8, 2024
de648b2
Fix build
loucass003 Oct 8, 2024
0215ca5
lint
loucass003 Oct 8, 2024
9033605
Spotless
loucass003 Oct 8, 2024
c77d5b7
Renormalize
loucass003 Oct 8, 2024
ba468f1
add gitattributes
ImUrX Oct 8, 2024
051811a
dont edit editorconfig if we use auto
ImUrX Oct 8, 2024
6b3aca8
Revert back to api
loucass003 Oct 8, 2024
89cdcf8
Merge branch 'editorconfig-lf' of github.com:SlimeVR/SlimeVR-Server i…
loucass003 Oct 8, 2024
b04e2e9
Set to main
loucass003 Oct 8, 2024
b53b6b2
Merge branch 'main' into llelievr/firmware-tool
loucass003 Oct 8, 2024
5290b16
Update gui/src/components/firmware-tool/SelectFirmwareStep.tsx
loucass003 Oct 18, 2024
3a7b5ea
Update gui/src/components/firmware-tool/SelectFirmwareStep.tsx
loucass003 Oct 18, 2024
337fb0b
Update gui/src/components/onboarding/pages/Home.tsx
loucass003 Oct 18, 2024
d02049f
Update gui/src/components/onboarding/pages/ConnectTracker.tsx
loucass003 Oct 18, 2024
328ad0d
Update gui/public/i18n/en/translation.ftl
loucass003 Oct 18, 2024
c0fc523
Update gui/src/components/commons/VerticalStepper.tsx
loucass003 Oct 18, 2024
fc6c18f
Update gui/src/components/commons/VerticalStepper.tsx
loucass003 Oct 18, 2024
035637b
update solarxr
loucass003 Oct 18, 2024
4b51804
Add missing translation + fix typo
loucass003 Oct 18, 2024
ea0a385
Merge branch 'main' of github.com:SlimeVR/SlimeVR-Server into lleliev…
loucass003 Oct 18, 2024
e44ad38
Merge branch 'main' of github.com:SlimeVR/SlimeVR-Server into lleliev…
loucass003 Nov 7, 2024
1beadef
send pnpm-lock
loucass003 Nov 7, 2024
632e914
Rename optaining -> obtaining
loucass003 Nov 7, 2024
826b3a8
Fix home page of onboarding
loucass003 Nov 7, 2024
5c85a82
Bring back comment
loucass003 Nov 7, 2024
ef998cf
Change to a working solarxr commit
loucass003 Nov 7, 2024
cb29271
First working version
loucass003 Nov 14, 2024
c95b1c3
Cleanup and translations
loucass003 Nov 15, 2024
a3de5d4
Merge branch 'main' into llelievr/firmware-updates
loucass003 Nov 15, 2024
2823559
Merge branch 'main' into llelievr/firmware-tool
loucass003 Nov 15, 2024
d4594d3
Forgot to send the lock
loucass003 Nov 15, 2024
9bbca9a
Merge branch 'llelievr/firmware-updates' of github.com:SlimeVR/SlimeV…
loucass003 Nov 15, 2024
6086521
Update gui/src/components/firmware-tool/DeviceCard.tsx
loucass003 Dec 16, 2024
5af983e
Update gui/public/i18n/en/translation.ftl
loucass003 Dec 16, 2024
4b1d5e0
Update gui/src/components/firmware-tool/DeviceCard.tsx
loucass003 Dec 16, 2024
9d5cd74
Update gui/src/components/firmware-tool/FirmwareTool.tsx
loucass003 Dec 16, 2024
bf8f52c
Update gui/src/components/firmware-tool/FirmwareTool.tsx
loucass003 Dec 16, 2024
608a502
Change to early return
loucass003 Dec 16, 2024
8bf9124
Merge branch 'llelievr/firmware-tool' of github.com:SlimeVR/SlimeVR-S…
loucass003 Dec 16, 2024
b66331a
Update gui/src/components/firmware-tool/SelectBoardStep.tsx
loucass003 Dec 16, 2024
83eb013
Fix last gui requests
loucass003 Dec 16, 2024
c9d9afb
Merge branch 'llelievr/firmware-tool' of github.com:SlimeVR/SlimeVR-S…
loucass003 Dec 16, 2024
b7cfd88
Update server/core/src/main/java/dev/slimevr/firmware/SerialRebootHan…
loucass003 Dec 16, 2024
19df384
Update server/core/src/main/java/dev/slimevr/firmware/SerialRebootHan…
loucass003 Dec 16, 2024
7bfce04
Fix translation keys
loucass003 Dec 16, 2024
dc48cd1
Merge branch 'llelievr/firmware-tool' of github.com:SlimeVR/SlimeVR-S…
loucass003 Dec 16, 2024
8c62588
Server fixes
loucass003 Dec 16, 2024
35c1e69
Last required changes
loucass003 Dec 17, 2024
45a8dc0
Lint
loucass003 Dec 17, 2024
621c7bc
Merge branch 'main' into llelievr/firmware-tool
loucass003 Dec 17, 2024
08e1ffa
Update gui/src/components/firmware-tool/FlashingMethodStep.tsx
ImUrX Dec 17, 2024
9240d9c
Review fixes
loucass003 Dec 19, 2024
e85af61
Merge branch 'llelievr/firmware-tool' of github.com:SlimeVR/SlimeVR-S…
loucass003 Dec 19, 2024
9942cbd
Update server/core/build.gradle.kts
loucass003 Dec 19, 2024
03c6f83
Apply suggestions from code review
loucass003 Dec 19, 2024
7772692
Apply suggestions from code review
loucass003 Dec 19, 2024
aa38f9d
Update server/core/build.gradle.kts
loucass003 Dec 19, 2024
dc83fa8
Update server/core/src/main/java/dev/slimevr/firmware/FirmwareUpdateH…
loucass003 Dec 19, 2024
0ee8f0e
Apply suggestions from code review
loucass003 Dec 19, 2024
fdbd088
Remove unused destroy functi
loucass003 Dec 19, 2024
783cc3d
Merge branch 'llelievr/firmware-tool' of github.com:SlimeVR/SlimeVR-S…
loucass003 Dec 19, 2024
a416630
Sync with firmware update pr
loucass003 Dec 19, 2024
4108d4f
More logs
loucass003 Dec 19, 2024
92fceba
Typos
loucass003 Dec 19, 2024
8b3b9e1
Sync with main
loucass003 Dec 19, 2024
06a6a35
fix missing conflicts
loucass003 Dec 19, 2024
f29065c
fix missing conflicts
loucass003 Dec 19, 2024
94e7fce
Fix pnpm conflic
loucass003 Dec 19, 2024
b4f14d8
Apply suggestions from code review
loucass003 Dec 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@hookform/resolvers": "^3.6.0",
"@react-three/drei": "^9.114.3",
"@react-three/fiber": "^8.17.10",
"@tailwindcss/typography": "^0.5.15",
"@tanstack/react-query": "^5.48.0",
"@tauri-apps/api": "^2.0.2",
"@tauri-apps/plugin-dialog": "^2.0.0",
Expand All @@ -29,9 +30,11 @@
"react-error-boundary": "^4.0.13",
"react-helmet": "^6.1.0",
"react-hook-form": "^7.53.0",
"react-markdown": "^9.0.1",
"react-modal": "^3.16.1",
"react-responsive": "^10.0.0",
"react-router-dom": "^6.26.2",
"remark-gfm": "^4.0.0",
"semver": "^7.6.3",
"solarxr-protocol": "file:../solarxr-protocol",
"three": "^0.163.0",
Expand Down Expand Up @@ -80,14 +83,14 @@
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-hooks": "^4.6.2",
"globals": "^15.10.0",
"prettier": "^3.3.3",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.79.4",
"spdx-satisfies": "^5.0.1",
"tailwind-gradient-mask-image": "^1.2.0",
"tailwindcss": "^3.4.13",
"vite": "^5.4.8",
"globals": "^15.10.0",
"typescript-eslint": "^8.8.0"
}
}
}
12 changes: 11 additions & 1 deletion gui/public/i18n/en/translation.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ firmware-tool_board-pins-step_led-pin =
.label = LED Pin
.placeholder = Enter the pin address of the LED

firmware-tool_board-pins-step_battery-type = Select a battery type
firmware-tool_board-pins-step_battery-type = Select the battery type
firmware-tool_board-pins-step_battery-type_BAT_EXTERNAL = External battery
firmware-tool_board-pins-step_battery-type_BAT_INTERNAL = Internal battery
firmware-tool_board-pins-step_battery-type_BAT_INTERNAL_MCP3021 = Internal MCP3021
Expand Down Expand Up @@ -1207,6 +1207,16 @@ firmware-update_status_ERROR_PROVISIONING_FAILED = Could not set the Wi-Fi crede
firmware-update_status_ERROR_UNSUPPORTED_METHOD = The update method is not supported
firmware-update_status_ERROR_UNKNOWN = Unknown error

## Dedicated Firmware Update Page
firmware-update_title = Firmware update
firmware-update_devices = Available Devices
firmware-update_devices_desc = Please select the trackers you want to update to the lastest version of SlimeVR firmware
firmware-update_no-devices = Plase make sure that the trackers you want to update are ON and connected to Wi-Fi!
firmware-update_changelog_title = Updating to {$version}
firmware-update_looking-for-devices = Looking for devices to update...
firmware-update_retry = Retry
firmware-update_update = Update Selected Trackers

## Tray Menu
tray_menu-show = Show
tray_menu-hide = Hide
Expand Down
9 changes: 9 additions & 0 deletions gui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { UnknownDeviceModal } from './components/UnknownDeviceModal';
import { useDiscordPresence } from './hooks/discord-presence';
import { EmptyLayout } from './components/EmptyLayout';
import { AdvancedSettings } from './components/settings/pages/AdvancedSettings';
import { FirmwareUpdate } from './components/firmware-update/FirmwareUpdate';

export const GH_REPO = 'SlimeVR/SlimeVR-Server';
export const VersionContext = createContext('');
Expand All @@ -83,6 +84,14 @@ function Layout() {
</MainLayout>
}
/>
<Route
path="/firmware-update"
element={
<MainLayout isMobile={isMobile} widgets={false}>
<FirmwareUpdate />
</MainLayout>
}
/>
<Route
path="/vr-mode"
element={
Expand Down
2 changes: 1 addition & 1 deletion gui/src/components/commons/TipBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function WarningBox({
>
<WarningIcon></WarningIcon>
</div>
<div className="flex flex-col">
<div className="flex flex-col justify-center">
<Typography
color="text-background-60"
whitespace={whitespace ? 'whitespace-pre-line' : undefined}
Expand Down
18 changes: 13 additions & 5 deletions gui/src/components/firmware-tool/DeviceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface DeviceCardControlProps {
control?: Control<any>;
name?: string;
progress?: number;
disabled?: boolean;
}

export function DeviceCardContent({ deviceNames, status }: DeviceCardProps) {
Expand All @@ -33,7 +34,7 @@ export function DeviceCardContent({ deviceNames, status }: DeviceCardProps) {
</span>
))}
</div>
{status && (
{!!status && (
<Typography color="secondary">
{l10n.getString(
'firmware-update_status_' + FirmwareUpdateStatus[status]
Expand All @@ -48,15 +49,21 @@ export function DeviceCardControl({
control,
name,
progress,
disabled = false,
...props
}: DeviceCardControlProps & DeviceCardProps) {
return (
<div
className={classNames(
'rounded-md bg-background-60 pt-2 flex flex-col justify-between border-2',
props.status && firmwareUpdateErrorStatus.includes(props.status)
? 'border-status-critical'
: 'border-transparent'
'rounded-md bg-background-60 h-[86px] pt-2 flex flex-col justify-between border-2 ',
props.status &&
firmwareUpdateErrorStatus.includes(props.status) &&
'border-status-critical',
props.status === FirmwareUpdateStatus.DONE && 'border-status-success',
(!props.status ||
(props.status !== FirmwareUpdateStatus.DONE &&
!firmwareUpdateErrorStatus.includes(props.status))) &&
'border-transparent'
)}
>
{control && name ? (
Expand All @@ -72,6 +79,7 @@ export function DeviceCardControl({
className={CHECKBOX_CLASSES}
checked={value || false}
type="checkbox"
disabled={disabled}
></input>
</div>

Expand Down
81 changes: 15 additions & 66 deletions gui/src/components/firmware-tool/FlashingStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,25 @@ import { Typography } from '@/components/commons/Typography';
import {
SelectedDevice,
firmwareUpdateErrorStatus,
getFlashingRequests,
useFirmwareTool,
} from '@/hooks/firmware-tool';
import { useEffect, useMemo, useState } from 'react';
import { useWebsocketAPI } from '@/hooks/websocket-api';
import {
DeviceIdT,
DeviceIdTableT,
FirmwarePartT,
FirmwareUpdateMethod,
FirmwareUpdateRequestT,
FirmwareUpdateStatus,
FirmwareUpdateStatusResponseT,
FirmwareUpdateStopQueuesRequestT,
OTAFirmwareUpdateT,
RpcMessage,
SerialDevicePortT,
SerialFirmwareUpdateT,
} from 'solarxr-protocol';
import { firmwareToolS3BaseUrl } from '@/firmware-tool-api/firmwareToolFetcher';
import { useOnboarding } from '@/hooks/onboarding';
import { DeviceCardControl } from './DeviceCard';
import { WarningBox } from '@/components/commons/TipBox';
import { Button } from '@/components/commons/Button';
import { useNavigate } from 'react-router-dom';
import { firmwareToolS3BaseUrl } from '@/firmware-tool-api/firmwareToolFetcher';

export function FlashingStep({
goTo,
Expand Down Expand Up @@ -60,70 +55,23 @@ export function FlashingStep({
);
};

const queueFlashing = (devices: SelectedDevice[]) => {
const queueFlashing = (selectedDevices: SelectedDevice[]) => {
clear();

if (!buildStatus.firmwareFiles)
throw new Error('invalid state - no firmware files');

const firmware = buildStatus.firmwareFiles.find(
({ isFirmware }) => isFirmware
const requests = getFlashingRequests(
selectedDevices,
buildStatus.firmwareFiles.map(({ url, ...fields }) => ({
url: `${firmwareToolS3BaseUrl}/${url}`,
...fields,
})),
onboardingState,
defaultConfig
);
if (!firmware) throw new Error('invalid state - no firmware to find');

for (const device of devices) {
switch (device.type) {
case FirmwareUpdateMethod.OTAFirmwareUpdate: {
const dId = new DeviceIdT();
dId.id = +device.deviceId;

const part = new FirmwarePartT();
part.offset = 0;
part.url = firmwareToolS3BaseUrl + '/' + firmware.url;

const method = new OTAFirmwareUpdateT();
method.deviceId = dId;
method.firmwarePart = part;

const req = new FirmwareUpdateRequestT();
req.method = method;
req.methodType = FirmwareUpdateMethod.OTAFirmwareUpdate;
sendRPCPacket(RpcMessage.FirmwareUpdateRequest, req);
break;
}
case FirmwareUpdateMethod.SerialFirmwareUpdate: {
const id = new SerialDevicePortT();
id.port = device.deviceId.toString();

if (!onboardingState.wifi?.ssid || !onboardingState.wifi?.password)
throw new Error('invalid state, wifi should be set');

const method = new SerialFirmwareUpdateT();
method.deviceId = id;
method.ssid = onboardingState.wifi.ssid;
method.password = onboardingState.wifi.password;
method.needManualReboot = defaultConfig?.needManualReboot ?? false;

method.firmwarePart = buildStatus.firmwareFiles.map(
({ offset, url }) => {
const part = new FirmwarePartT();
part.offset = offset;
part.url = firmwareToolS3BaseUrl + '/' + url;
return part;
}
);

const req = new FirmwareUpdateRequestT();
req.method = method;
req.methodType = FirmwareUpdateMethod.SerialFirmwareUpdate;
sendRPCPacket(RpcMessage.FirmwareUpdateRequest, req);
break;
}
default: {
throw new Error('unsupported flashing method');
}
}
}
requests.forEach((req) => {
sendRPCPacket(RpcMessage.FirmwareUpdateRequest, req);
});
};

useEffect(() => {
Expand Down Expand Up @@ -189,6 +137,7 @@ export function FlashingStep({
() =>
Object.keys(status).filter((id) =>
[
FirmwareUpdateStatus.NEED_MANUAL_REBOOT,
FirmwareUpdateStatus.DOWNLOADING,
FirmwareUpdateStatus.AUTHENTICATING,
FirmwareUpdateStatus.REBOOTING,
Expand Down
Loading
Loading