mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-30 05:42:46 -08:00
Display Pre-release fw version as Pre-release
This commit is contained in:
1 parent
4fbbfc7fb0
commit
e51016baf4
4 files changed
+62
-36
No files matched your search
@@ -1634,6 +1634,7 @@ firmware_tool-select_source-version = Firmware Version
|
||||
firmware_tool-select_source-official = Official
|
||||
firmware_tool-select_source-dev = Dev
|
||||
firmware_tool-select_source-latest = Latest
|
||||
firmware_tool-select_source-prerelease = Pre-release
|
||||
firmware_tool-select_source-not_selected = No source selected
|
||||
firmware_tool-select_source-no_boards = No available boards for this source
|
||||
firmware_tool-select_source-no_versions = No available versions for this source
|
||||
|
||||
@@ -23,7 +23,7 @@ function Selector({
|
||||
text: string;
|
||||
active: boolean;
|
||||
official?: boolean;
|
||||
tag?: 'official' | 'dev' | 'latest';
|
||||
tag?: 'official' | 'dev' | 'latest' | 'prerelease';
|
||||
disabled?: boolean;
|
||||
onClick: () => void;
|
||||
}) {
|
||||
@@ -77,6 +77,18 @@ function Selector({
|
||||
</Localized>
|
||||
</div>
|
||||
)}
|
||||
{tag === 'prerelease' && (
|
||||
<div
|
||||
className={classNames(
|
||||
'absolute px-2 py-0.5 rounded-md bg-status-warning -top-2 -right-2',
|
||||
{ 'brightness-20': disabled, 'brightness-50': !active }
|
||||
)}
|
||||
>
|
||||
<Localized id="firmware_tool-select_source-prerelease">
|
||||
<Typography color="text-background-90" />
|
||||
</Localized>
|
||||
</div>
|
||||
)}
|
||||
{text}
|
||||
</Clickable>
|
||||
);
|
||||
@@ -106,9 +118,10 @@ export function SelectSourceStep({
|
||||
refetch,
|
||||
} = useGetFirmwareSources({});
|
||||
|
||||
const { possibleBoards, possibleVersions, sourcesGroupped } = useMemo(() => {
|
||||
let foundLatest = false;
|
||||
const { possibleBoards, possibleVersions, sourcesGrouped } = useMemo(() => {
|
||||
return {
|
||||
sourcesGroupped: sources
|
||||
sourcesGrouped: sources
|
||||
?.reduce(
|
||||
(curr, source) => {
|
||||
if (!curr.find(({ name }) => source.source === name))
|
||||
@@ -156,11 +169,19 @@ export function SelectSourceStep({
|
||||
!source.availableBoards.includes(partialBoard.board) ||
|
||||
source.source !== partialBoard.source,
|
||||
name: source.version,
|
||||
latest: !source.prerelease && !foundLatest,
|
||||
prerelease: source.prerelease,
|
||||
});
|
||||
foundLatest = foundLatest || !source.prerelease;
|
||||
|
||||
return curr;
|
||||
},
|
||||
[] as { name: string; disabled: boolean }[]
|
||||
[] as {
|
||||
name: string;
|
||||
disabled: boolean;
|
||||
latest: boolean;
|
||||
prerelease: boolean;
|
||||
}[]
|
||||
)
|
||||
.sort((a, b) => {
|
||||
// safeguard against inf loop
|
||||
@@ -228,7 +249,7 @@ export function SelectSourceStep({
|
||||
<Typography variant="section-title" />
|
||||
</Localized>
|
||||
<div className="flex flex-col gap-4 md:max-h-[305px] overflow-y-auto bg-background-80 rounded-lg p-4">
|
||||
{sourcesGroupped?.map(({ name, official }) => (
|
||||
{sourcesGrouped?.map(({ name, official }) => (
|
||||
<Selector
|
||||
active={partialBoard?.source === name}
|
||||
key={`${name}`}
|
||||
@@ -278,28 +299,32 @@ export function SelectSourceStep({
|
||||
<Typography variant="section-title" />
|
||||
</Localized>
|
||||
<div className="flex flex-col gap-4 md:max-h-[305px] overflow-y-auto bg-background-80 rounded-lg p-4">
|
||||
{possibleVersions?.map(({ name, disabled }, i) => (
|
||||
<Selector
|
||||
active={partialBoard?.version === name}
|
||||
disabled={disabled}
|
||||
key={`${name}`}
|
||||
tag={
|
||||
partialBoard?.source?.startsWith('SlimeVR/') &&
|
||||
name === 'llelievr/board-defaults'
|
||||
? 'dev'
|
||||
: i == 0
|
||||
? 'latest'
|
||||
: undefined
|
||||
}
|
||||
onClick={() => {
|
||||
setPartialBoard((curr) => ({
|
||||
...curr,
|
||||
version: name,
|
||||
}));
|
||||
}}
|
||||
text={name}
|
||||
/>
|
||||
))}
|
||||
{possibleVersions?.map(
|
||||
({ name, disabled, latest, prerelease }, i) => (
|
||||
<Selector
|
||||
active={partialBoard?.version === name}
|
||||
disabled={disabled}
|
||||
key={`${name}`}
|
||||
tag={
|
||||
partialBoard?.source?.startsWith('SlimeVR/') &&
|
||||
name === 'llelievr/board-defaults'
|
||||
? 'dev'
|
||||
: prerelease
|
||||
? 'prerelease'
|
||||
: latest
|
||||
? 'latest'
|
||||
: undefined
|
||||
}
|
||||
onClick={() => {
|
||||
setPartialBoard((curr) => ({
|
||||
...curr,
|
||||
version: name,
|
||||
}));
|
||||
}}
|
||||
text={name}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
{partialBoard?.source && possibleVersions?.length === 0 && (
|
||||
<Typography id="firmware_tool-select_source-no_versions" />
|
||||
)}
|
||||
|
||||
@@ -75,7 +75,7 @@ export async function fetchCurrentFirmwareRelease(
|
||||
);
|
||||
if (!releases) return null;
|
||||
|
||||
const processedReleses = [];
|
||||
const processedReleases: FirmwareRelease[] = [];
|
||||
for (const release of releases) {
|
||||
const fwAsset = firstAsset(release.assets, 'BOARD_SLIMEVR-firmware.bin');
|
||||
const fw12Asset = firstAsset(release.assets, 'BOARD_SLIMEVR_V1_2-firmware.bin');
|
||||
@@ -98,7 +98,7 @@ export async function fetchCurrentFirmwareRelease(
|
||||
deployAsset.browser_download_url,
|
||||
version
|
||||
);
|
||||
processedReleses.push({
|
||||
processedReleases.push({
|
||||
name: release.name,
|
||||
version,
|
||||
changelog: release.body,
|
||||
@@ -118,7 +118,7 @@ export async function fetchCurrentFirmwareRelease(
|
||||
if (userCanUpdate) break; // Stop early if we found one valid update. No need to download more
|
||||
}
|
||||
return (
|
||||
processedReleses.find(({ userCanUpdate }) => userCanUpdate) ?? processedReleses[0]
|
||||
processedReleases.find(({ userCanUpdate }) => userCanUpdate) ?? processedReleases[0]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ internal const val CONNECTION_TIMEOUT_MS = 5000L
|
||||
private val ACCEL_OFFSET_CORRECTION_22 = Quaternion.rotationAroundZAxis(FastMath.PI)
|
||||
private val ACCEL_OFFSET_CORRECTION_21 = Quaternion.rotationAroundZAxis(-FastMath.HALF_PI)
|
||||
fun getCorrectedAcceleration(acceleration: Vector3, protocolVersion: Int) = if (protocolVersion <= 21) {
|
||||
ACCEL_OFFSET_CORRECTION_21.sandwich(acceleration)
|
||||
} else if (protocolVersion == 22) {
|
||||
ACCEL_OFFSET_CORRECTION_22.sandwich(acceleration)
|
||||
} else {
|
||||
acceleration
|
||||
}
|
||||
ACCEL_OFFSET_CORRECTION_21.sandwich(acceleration)
|
||||
} else if (protocolVersion == 22) {
|
||||
ACCEL_OFFSET_CORRECTION_22.sandwich(acceleration)
|
||||
} else {
|
||||
acceleration
|
||||
}
|
||||
|
||||
internal fun assignTracker(receiver: UDPConnection, device: Device, info: SensorInfo): Pair<Tracker, Boolean> {
|
||||
val deviceState = device.context.state.value
|
||||
|
||||
Reference in new issue
Block a user