Skip to content

Commit 4e9fdb2

Browse files
authored
Firmware tool V2 (#1585)
1 parent 0a08d57 commit 4e9fdb2

28 files changed

+2003
-2363
lines changed

gui/.env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
VITE_FIRMWARE_TOOL_URL=https://fw-tool-api.slimevr.io
2-
VITE_FIRMWARE_TOOL_S3_URL=https://fw-tool-bucket.slimevr.io
3-
FIRMWARE_TOOL_SCHEMA_URL=https://fw-tool-api.slimevr.io/api-json
1+
VITE_FIRMWARE_TOOL_URL=https://fw-tool-api-v2.slimevr.io
2+
VITE_FIRMWARE_TOOL_S3_URL=https://fw-tool-bucket-v2.slimevr.io
3+
FIRMWARE_TOOL_SCHEMA_URL=https://fw-tool-api-v2.slimevr.io/api-json
44

55

66
# VITE_FIRMWARE_TOOL_URL=http://localhost:3000
7-
# VITE_FIRMWARE_TOOL_S3_URL=http://localhost:9000
7+
# VITE_FIRMWARE_TOOL_S3_URL=http://localhost:9099
88
# FIRMWARE_TOOL_SCHEMA_URL=http://localhost:3000/api-json

gui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@tauri-apps/plugin-store": "~2",
2828
"@tweenjs/tween.js": "^25.0.0",
2929
"@twemoji/svg": "^15.0.0",
30+
"ajv": "^8.17.1",
3031
"browser-fs-access": "^0.35.0",
3132
"classnames": "^2.5.1",
3233
"flatbuffers": "22.10.26",

gui/public/i18n/en/translation.ftl

Lines changed: 34 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ board_type-WEMOSD1MINI = Wemos D1 Mini
8989
board_type-TTGO_TBASE = TTGO T-Base
9090
board_type-ESP01 = ESP-01
9191
board_type-SLIMEVR = SlimeVR
92+
board_type-SLIMEVR_DEV = SlimeVR Dev Board
93+
board_type-SLIMEVR_V1_2 = SlimeVR v1.2
9294
board_type-LOLIN_C3_MINI = Lolin C3 Mini
9395
board_type-BEETLE32C3 = Beetle ESP32-C3
9496
board_type-ESP32C3DEVKITM1 = Espressif ESP32-C3 DevKitM-1
@@ -383,7 +385,8 @@ tracker-settings-name_section-label = Tracker name
383385
tracker-settings-forget = Forget tracker
384386
tracker-settings-forget-description = Removes the tracker from the SlimeVR Server and prevents it from connecting until the server is restarted. The configuration of the tracker won't be lost.
385387
tracker-settings-forget-label = Forget tracker
386-
tracker-settings-update-unavailable = Cannot be updated (DIY)
388+
tracker-settings-update-unavailable-v2 = No releases found
389+
tracker-settings-update-incompatible = Cannot update. Incompatible board
387390
tracker-settings-update-low-battery = Cannot update. Battery lower than 50%
388391
tracker-settings-update-up_to_date = Up to date
389392
tracker-settings-update-blocked = Update not available. No other releases available
@@ -1334,78 +1337,38 @@ firmware_tool-description =
13341337
firmware_tool-not_available = Oops, the firmware tool is not available at the moment. Come back later!
13351338
firmware_tool-not_compatible = The firmware tool is not compatible with this version of the server. Please update your server!
13361339
1337-
firmware_tool-board_step = Select your Board
1338-
firmware_tool-board_step-description = Select one of the boards listed below.
1339-
1340-
firmware_tool-board_pins_step = Check the pins
1341-
firmware_tool-board_pins_step-description =
1342-
Please verify that the selected pins are correct.
1343-
If you followed the SlimeVR documentation, the default values should be correct.
1344-
firmware_tool-board_pins_step-enable_led = Enable LED
1345-
firmware_tool-board_pins_step-led_pin =
1346-
.label = LED Pin
1347-
.placeholder = Enter the pin address of the LED
1348-
1349-
firmware_tool-board_pins_step-battery_type = Select the battery type
1350-
firmware_tool-board_pins_step-battery_type-BAT_EXTERNAL = External battery
1351-
firmware_tool-board_pins_step-battery_type-BAT_INTERNAL = Internal battery
1352-
firmware_tool-board_pins_step-battery_type-BAT_INTERNAL_MCP3021 = Internal MCP3021
1353-
firmware_tool-board_pins_step-battery_type-BAT_MCP3021 = MCP3021
1354-
1355-
1356-
firmware_tool-board_pins_step-battery_sensor_pin =
1357-
.label = Battery sensor Pin
1358-
.placeholder = Enter the pin address of battery sensor
1359-
firmware_tool-board_pins_step-battery_resistor =
1360-
.label = Battery Resistor (Ohms)
1361-
.placeholder = Enter the value of battery resistor
1362-
firmware_tool-board_pins_step-battery_shield_resistor-0 =
1363-
.label = Battery Shield R1 (Ohms)
1364-
.placeholder = Enter the value of Battery Shield R1
1365-
firmware_tool-board_pins_step-battery_shield_resistor-1 =
1366-
.label = Battery Shield R2 (Ohms)
1367-
.placeholder = Enter the value of Battery Shield R2
1368-
1369-
firmware_tool-add_imus_step = Declare your IMUs
1370-
firmware_tool-add_imus_step-description =
1371-
Please add the IMUs that your tracker has.
1372-
If you followed the SlimeVR documentation, the default values should be correct.
1373-
firmware_tool-add_imus_step-imu_type-label = IMU type
1374-
firmware_tool-add_imus_step-imu_type-placeholder = Select the type of IMU
1375-
firmware_tool-add_imus_step-imu_rotation =
1376-
.label = IMU Rotation (deg)
1377-
.placeholder = Rotation angle of the IMU
1378-
firmware_tool-add_imus_step-scl_pin =
1379-
.label = SCL Pin
1380-
.placeholder = Pin address of SCL
1381-
firmware_tool-add_imus_step-sda_pin =
1382-
.label = SDA Pin
1383-
.placeholder = Pin address of SDA
1384-
firmware_tool-add_imus_step-int_pin =
1385-
.label = INT Pin
1386-
.placeholder = Pin address of INT
1387-
firmware_tool-add_imus_step-optional_tracker =
1388-
.label = Optional tracker
1389-
firmware_tool-add_imus_step-show_less = Show Less
1390-
firmware_tool-add_imus_step-show_more = Show More
1391-
firmware_tool-add_imus_step-add_more = Add more IMUs
1392-
1393-
firmware_tool-select_firmware_step = Select the firmware version
1394-
firmware_tool-select_firmware_step-description =
1395-
Please choose what version of the firmware you want to use
1396-
firmware_tool-select_firmware_step-show-third-party =
1397-
.label = Show third party firmwares
1340+
firmware_tool-select_source = Select the firmware to flash
1341+
firmware_tool-select_source-description = Select the firmware you want to flash on your board
1342+
firmware_tool-select_source-error = Unable to load Sources
1343+
firmware_tool-select_source-board_type = Board Type
1344+
firmware_tool-select_source-firmware = Firmware Source
1345+
firmware_tool-select_source-version = Firmware Version
1346+
firmware_tool-select_source-official = Official
1347+
firmware_tool-select_source-dev = Dev
1348+
1349+
firmware_tool-board_defaults = Configure your board
1350+
firmware_tool-board_defaults-description = Set the pins or settings relative to your hardware
1351+
firmware_tool-board_defaults-add = Add
1352+
firmware_tool-board_defaults-reset = Reset to Default
1353+
firmware_tool-board_defaults-error-required = Required field
1354+
firmware_tool-board_defaults-error-format = Invalid format
1355+
firmware_tool-board_defaults-error-format-number = Not a number
13981356
13991357
firmware_tool-flash_method_step = Flashing Method
14001358
firmware_tool-flash_method_step-description =
14011359
Please select the flashing method you want to use
1402-
firmware_tool-flash_method_step-ota =
1403-
.label = OTA
1360+
1361+
firmware_tool-flash_method_step-ota-v2 =
1362+
.label = Wi-Fi
14041363
.description = Use the over-the-air method. Your tracker will use Wi-Fi to update its firmware. Only works on trackers that have been set up.
1405-
firmware_tool-flash_method_step-serial =
1406-
.label = Serial
1364+
firmware_tool-flash_method_step-ota-info =
1365+
We use your wifi credentials to flash the tracker and confirm that everything worked correctly.
1366+
<b>We do not store your wifi credentials!</b>
1367+
firmware_tool-flash_method_step-serial-v2 =
1368+
.label = USB
14071369
.description = Use a USB cable to update your tracker.
14081370
1371+
14091372
firmware_tool-flashbtn_step = Press the boot btn
14101373
firmware_tool-flashbtn_step-description = Before going to the next step, there are a few things you need to do
14111374
@@ -1419,10 +1382,10 @@ firmware_tool-flashbtn_step-board_OTHER = Before flashing, you will probably nee
14191382
If the flashing process times out at the start, it probably means that the tracker was not in bootloader mode.
14201383
Refer to your board's flashing instructions to learn how to enter bootloader mode.
14211384
1422-
1423-
1385+
firmware_tool-flash_method_ota-title = Flashing over Wi-Fi
14241386
firmware_tool-flash_method_ota-devices = Detected OTA Devices:
14251387
firmware_tool-flash_method_ota-no_devices = There are no boards that can be updated using OTA, make sure you selected the correct board type
1388+
firmware_tool-flash_method_serial-title = Flashing over USB
14261389
firmware_tool-flash_method_serial-wifi = Wi-Fi Credentials:
14271390
firmware_tool-flash_method_serial-devices-label = Detected Serial Devices:
14281391
firmware_tool-flash_method_serial-devices-placeholder = Select a serial device
@@ -1440,10 +1403,10 @@ firmware_tool-flashing_step-flash_more = Flash more trackers
14401403
firmware_tool-flashing_step-exit = Exit
14411404
14421405
## firmware tool build status
1406+
firmware_tool-build-QUEUED = Waiting to build....
14431407
firmware_tool-build-CREATING_BUILD_FOLDER = Creating the build folder
1444-
firmware_tool-build-DOWNLOADING_FIRMWARE = Downloading the firmware
1445-
firmware_tool-build-EXTRACTING_FIRMWARE = Extracting the firmware
1446-
firmware_tool-build-SETTING_UP_DEFINES = Configuring the defines
1408+
firmware_tool-build-DOWNLOADING_SOURCE = Downloading the source code
1409+
firmware_tool-build-EXTRACTING_SOURCE = Extracting the source code
14471410
firmware_tool-build-BUILDING = Building the firmware
14481411
firmware_tool-build-SAVING = Saving the build
14491412
firmware_tool-build-DONE = Build Complete

gui/src/components/commons/Checkbox.tsx

Lines changed: 117 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
import classNames from 'classnames';
2-
import { useMemo } from 'react';
2+
import { forwardRef, useMemo } from 'react';
33
import { Control, Controller } from 'react-hook-form';
44

55
export const CHECKBOX_CLASSES = classNames(
66
'bg-background-50 border-background-50 rounded-md w-5 h-5 text-accent-background-30 focus:border-accent-background-40 focus:ring-transparent focus:ring-offset-transparent focus:outline-transparent'
77
);
88

9-
export function CheckBox({
10-
label,
11-
variant = 'checkbox',
12-
color = 'primary',
13-
control,
14-
outlined,
15-
name,
16-
loading,
17-
// input props
18-
disabled,
19-
...props
20-
}: {
21-
label: string;
22-
control: Control<any>;
23-
name: string;
24-
variant?: 'checkbox' | 'toggle';
25-
color?: 'primary' | 'secondary' | 'tertiary';
26-
outlined?: boolean;
27-
loading?: boolean;
28-
} & React.HTMLProps<HTMLInputElement>) {
9+
export const CheckboxInternal = forwardRef<
10+
HTMLInputElement,
11+
{
12+
disabled?: boolean;
13+
variant?: 'checkbox' | 'toggle';
14+
color?: 'primary' | 'secondary' | 'tertiary';
15+
label?: string;
16+
outlined?: boolean;
17+
loading?: boolean;
18+
name: string;
19+
} & Partial<React.HTMLProps<HTMLInputElement>>
20+
>(function AppCheckbox(
21+
{
22+
variant = 'checkbox',
23+
color = 'primary',
24+
outlined = false,
25+
loading = false,
26+
disabled = false,
27+
label,
28+
onChange,
29+
checked,
30+
name,
31+
},
32+
ref
33+
) {
2934
const classes = useMemo(() => {
3035
const vriantsMap = {
3136
checkbox: {
@@ -44,68 +49,102 @@ export function CheckBox({
4449
return vriantsMap[variant];
4550
}, [variant]);
4651

52+
return (
53+
<div
54+
className={classNames(
55+
{
56+
'rounded-md': outlined,
57+
'text-background-40': disabled,
58+
'text-background-10': !disabled,
59+
'bg-background-60': outlined && color === 'primary',
60+
'bg-background-70': outlined && color === 'secondary',
61+
'bg-background-50': outlined && color === 'tertiary',
62+
},
63+
'flex items-center gap-2 w-full'
64+
)}
65+
>
66+
<label
67+
className={classNames(
68+
'w-full h-[42px] flex gap-2 items-center text-standard-bold',
69+
{
70+
'px-3': outlined,
71+
'cursor-pointer': !disabled || !loading,
72+
'cursor-default': disabled || loading,
73+
}
74+
)}
75+
>
76+
<input
77+
ref={ref}
78+
onChange={onChange}
79+
checked={checked}
80+
name={name}
81+
className={classes.checkbox}
82+
type="checkbox"
83+
disabled={disabled || loading}
84+
/>
85+
{variant === 'toggle' && (
86+
<div
87+
className={classNames(classes.toggle, {
88+
'bg-accent-background-30': checked && !disabled && !loading,
89+
'bg-accent-background-50': checked && disabled,
90+
'bg-accent-background-30 animate-pulse': loading && !disabled,
91+
'bg-background-50':
92+
((!checked && color == 'primary') || color == 'secondary') &&
93+
!loading,
94+
'bg-background-40': !checked && color == 'tertiary' && !loading,
95+
})}
96+
>
97+
<div
98+
className={classNames(classes.pin, {
99+
'left-0': !checked && !loading,
100+
'opacity-0': loading,
101+
'right-0': checked && !loading,
102+
'bg-background-30': disabled,
103+
})}
104+
></div>
105+
</div>
106+
)}
107+
{label}
108+
</label>
109+
</div>
110+
);
111+
});
112+
113+
export function CheckBox({
114+
label,
115+
variant = 'checkbox',
116+
color = 'primary',
117+
control,
118+
outlined,
119+
name,
120+
loading,
121+
disabled,
122+
}: {
123+
label: string;
124+
control: Control<any>;
125+
name: string;
126+
variant?: 'checkbox' | 'toggle';
127+
color?: 'primary' | 'secondary' | 'tertiary';
128+
outlined?: boolean;
129+
loading?: boolean;
130+
} & React.HTMLProps<HTMLInputElement>) {
47131
return (
48132
<Controller
49133
control={control}
50134
name={name}
51135
render={({ field: { onChange, value, ref, name } }) => (
52-
<div
53-
className={classNames(
54-
{
55-
'rounded-lg': outlined,
56-
'text-background-10': !outlined || disabled,
57-
'bg-background-60': outlined && color === 'primary',
58-
'bg-background-70': outlined && color === 'secondary',
59-
'bg-background-50': outlined && color === 'tertiary',
60-
},
61-
'flex items-center gap-2 w-full'
62-
)}
63-
>
64-
<label
65-
className={classNames(
66-
'w-full py-3 flex gap-2 items-center text-standard-bold',
67-
{
68-
'px-3': outlined,
69-
'cursor-pointer': !disabled || !loading,
70-
'cursor-default': disabled || loading,
71-
}
72-
)}
73-
>
74-
<input
75-
ref={ref}
76-
onChange={onChange}
77-
checked={value || false}
78-
name={name}
79-
className={classes.checkbox}
80-
type="checkbox"
81-
disabled={disabled || loading}
82-
{...props}
83-
/>
84-
{variant === 'toggle' && (
85-
<div
86-
className={classNames(classes.toggle, {
87-
'bg-accent-background-30': value && !disabled && !loading,
88-
'bg-accent-background-50': value && disabled,
89-
'bg-accent-background-30 animate-pulse': loading && !disabled,
90-
'bg-background-50':
91-
((!value && color == 'primary') || color == 'secondary') &&
92-
!loading,
93-
'bg-background-40': !value && color == 'tertiary' && !loading,
94-
})}
95-
>
96-
<div
97-
className={classNames(classes.pin, {
98-
'left-0': !value && !loading,
99-
'opacity-0': loading,
100-
'right-0': value && !loading,
101-
'bg-background-30': disabled,
102-
})}
103-
></div>
104-
</div>
105-
)}
106-
{label}
107-
</label>
108-
</div>
136+
<CheckboxInternal
137+
label={label}
138+
variant={variant}
139+
color={color}
140+
outlined={outlined}
141+
name={name}
142+
loading={loading}
143+
disabled={disabled}
144+
checked={value}
145+
onChange={onChange}
146+
ref={ref}
147+
></CheckboxInternal>
109148
)}
110149
/>
111150
);

0 commit comments

Comments
 (0)