mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-20 09:01:20 -08:00
Remove Drift compensation (#1461)
This commit is contained in:
1 parent
79eb43fca3
commit
26f330c762
5 files changed
+13
-110
No files matched your search
@@ -1,28 +0,0 @@
|
||||
import { Localized } from '@fluent/react';
|
||||
import { ClearDriftCompensationRequestT, RpcMessage } from 'solarxr-protocol';
|
||||
import { useWebsocketAPI } from '@/hooks/websocket-api';
|
||||
import { BigButton } from './commons/BigButton';
|
||||
import { TrashIcon } from './commons/icon/TrashIcon';
|
||||
|
||||
export function ClearDriftCompensationButton({
|
||||
disabled,
|
||||
}: {
|
||||
disabled: boolean;
|
||||
}) {
|
||||
const { sendRPCPacket } = useWebsocketAPI();
|
||||
|
||||
const clearDriftCompensation = () => {
|
||||
const record = new ClearDriftCompensationRequestT();
|
||||
sendRPCPacket(RpcMessage.ClearDriftCompensationRequest, record);
|
||||
};
|
||||
|
||||
return (
|
||||
<Localized id="widget-drift_compensation-clear">
|
||||
<BigButton
|
||||
icon={<TrashIcon size={20} />}
|
||||
onClick={clearDriftCompensation}
|
||||
disabled={disabled}
|
||||
></BigButton>
|
||||
</Localized>
|
||||
);
|
||||
}
|
||||
@@ -1,22 +1,14 @@
|
||||
import { Localized, useLocalization } from '@fluent/react';
|
||||
import { BVHButton } from './BVHButton';
|
||||
import { ClearDriftCompensationButton } from './ClearDriftCompensationButton';
|
||||
import { TrackingPauseButton } from './TrackingPauseButton';
|
||||
import { ResetButton } from './home/ResetButton';
|
||||
import { OverlayWidget } from './widgets/OverlayWidget';
|
||||
import { TipBox } from './commons/TipBox';
|
||||
import { DeveloperModeWidget } from './widgets/DeveloperModeWidget';
|
||||
import { useConfig } from '@/hooks/config';
|
||||
import {
|
||||
ResetType,
|
||||
RpcMessage,
|
||||
SettingsRequestT,
|
||||
SettingsResponseT,
|
||||
StatusData,
|
||||
} from 'solarxr-protocol';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { ResetType, StatusData } from 'solarxr-protocol';
|
||||
import { useMemo } from 'react';
|
||||
import { parseStatusToLocale, useStatusContext } from '@/hooks/status-system';
|
||||
import { useWebsocketAPI } from '@/hooks/websocket-api';
|
||||
import { ClearMountingButton } from './ClearMountingButton';
|
||||
import { ToggleableSkeletonVisualizerWidget } from './widgets/SkeletonVisualizerWidget';
|
||||
import { useAtomValue } from 'jotai';
|
||||
@@ -56,17 +48,6 @@ function UnprioritizedStatuses() {
|
||||
|
||||
export function WidgetsComponent() {
|
||||
const { config } = useConfig();
|
||||
const { useRPCPacket, sendRPCPacket } = useWebsocketAPI();
|
||||
const [driftCompensationEnabled, setDriftCompensationEnabled] =
|
||||
useState(false);
|
||||
useEffect(() => {
|
||||
sendRPCPacket(RpcMessage.SettingsRequest, new SettingsRequestT());
|
||||
}, []);
|
||||
|
||||
useRPCPacket(RpcMessage.SettingsResponse, (settings: SettingsResponseT) => {
|
||||
if (settings.driftCompensation != null)
|
||||
setDriftCompensationEnabled(settings.driftCompensation.enabled);
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -77,9 +58,6 @@ export function WidgetsComponent() {
|
||||
<ClearMountingButton></ClearMountingButton>
|
||||
<BVHButton></BVHButton>
|
||||
<TrackingPauseButton></TrackingPauseButton>
|
||||
<ClearDriftCompensationButton
|
||||
disabled={!driftCompensationEnabled}
|
||||
></ClearDriftCompensationButton>
|
||||
</div>
|
||||
<div className="w-full">
|
||||
<OverlayWidget></OverlayWidget>
|
||||
|
||||
@@ -56,8 +56,7 @@ export function ManualMountingPage() {
|
||||
mountingOrientationDegrees
|
||||
);
|
||||
assignreq.trackerId = td.tracker.trackerId;
|
||||
assignreq.allowDriftCompensation =
|
||||
td.tracker.info?.allowDriftCompensation ?? true;
|
||||
assignreq.allowDriftCompensation = false;
|
||||
|
||||
sendRPCPacket(RpcMessage.AssignTrackerRequest, assignreq);
|
||||
});
|
||||
|
||||
@@ -216,8 +216,7 @@ export function TrackersAssignPage() {
|
||||
assignreq.bodyPosition = role;
|
||||
assignreq.mountingOrientation = rotation;
|
||||
assignreq.trackerId = trackerId;
|
||||
assignreq.allowDriftCompensation =
|
||||
tracker?.tracker?.info?.allowDriftCompensation ?? true;
|
||||
assignreq.allowDriftCompensation = false;
|
||||
|
||||
sendRPCPacket(RpcMessage.AssignTrackerRequest, assignreq);
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
import { ArrowLink } from '@/components/commons/ArrowLink';
|
||||
import { BodyPartIcon } from '@/components/commons/BodyPartIcon';
|
||||
import { Button } from '@/components/commons/Button';
|
||||
import { CheckBox } from '@/components/commons/Checkbox';
|
||||
import { WarningIcon } from '@/components/commons/icon/WarningIcon';
|
||||
import { Input } from '@/components/commons/Input';
|
||||
import { Typography } from '@/components/commons/Typography';
|
||||
@@ -57,7 +56,6 @@ export function TrackerSettingsPage() {
|
||||
const { l10n } = useLocalization();
|
||||
|
||||
const { sendRPCPacket } = useWebsocketAPI();
|
||||
const [firstLoad, setFirstLoad] = useState(false);
|
||||
const [selectRotation, setSelectRotation] = useState<boolean>(false);
|
||||
const [selectBodypart, setSelectBodypart] = useState<boolean>(false);
|
||||
const { trackernum, deviceid } = useParams<{
|
||||
@@ -66,16 +64,14 @@ export function TrackerSettingsPage() {
|
||||
}>();
|
||||
const { control, watch, reset, handleSubmit } = useForm<{
|
||||
trackerName: string | null;
|
||||
allowDriftCompensation: boolean | null;
|
||||
}>({
|
||||
defaultValues: {
|
||||
trackerName: null,
|
||||
allowDriftCompensation: null,
|
||||
},
|
||||
reValidateMode: 'onSubmit',
|
||||
});
|
||||
const setIgnoredTracker = useSetAtom(ignoredTrackersAtom);
|
||||
const { trackerName, allowDriftCompensation } = watch();
|
||||
const { trackerName } = watch();
|
||||
|
||||
const tracker = useTrackerFromId(trackernum, deviceid);
|
||||
|
||||
@@ -89,8 +85,7 @@ export function TrackerSettingsPage() {
|
||||
);
|
||||
assignreq.bodyPosition = tracker?.tracker.info?.bodyPart || BodyPart.NONE;
|
||||
assignreq.trackerId = tracker?.tracker.trackerId;
|
||||
if (allowDriftCompensation != null)
|
||||
assignreq.allowDriftCompensation = allowDriftCompensation;
|
||||
assignreq.allowDriftCompensation = false;
|
||||
sendRPCPacket(RpcMessage.AssignTrackerRequest, assignreq);
|
||||
setSelectRotation(false);
|
||||
};
|
||||
@@ -101,8 +96,7 @@ export function TrackerSettingsPage() {
|
||||
const assignreq = new AssignTrackerRequestT();
|
||||
assignreq.bodyPosition = role;
|
||||
assignreq.trackerId = tracker?.tracker.trackerId;
|
||||
if (allowDriftCompensation != null)
|
||||
assignreq.allowDriftCompensation = allowDriftCompensation;
|
||||
assignreq.allowDriftCompensation = false;
|
||||
sendRPCPacket(RpcMessage.AssignTrackerRequest, assignreq);
|
||||
setSelectBodypart(false);
|
||||
};
|
||||
@@ -113,12 +107,7 @@ export function TrackerSettingsPage() {
|
||||
|
||||
const updateTrackerSettings = () => {
|
||||
if (!tracker) return;
|
||||
if (allowDriftCompensation == null) return;
|
||||
if (
|
||||
trackerName == tracker.tracker.info?.customName &&
|
||||
allowDriftCompensation == tracker.tracker.info?.allowDriftCompensation
|
||||
)
|
||||
return;
|
||||
if (trackerName == tracker.tracker.info?.customName) return;
|
||||
const assignreq = new AssignTrackerRequestT();
|
||||
assignreq.bodyPosition = tracker?.tracker.info?.bodyPart || BodyPart.NONE;
|
||||
assignreq.mountingOrientation = currRotation
|
||||
@@ -127,7 +116,7 @@ export function TrackerSettingsPage() {
|
||||
|
||||
assignreq.displayName = trackerName ?? null;
|
||||
assignreq.trackerId = tracker?.tracker.trackerId;
|
||||
assignreq.allowDriftCompensation = allowDriftCompensation;
|
||||
assignreq.allowDriftCompensation = false;
|
||||
sendRPCPacket(RpcMessage.AssignTrackerRequest, assignreq);
|
||||
};
|
||||
|
||||
@@ -138,21 +127,10 @@ export function TrackerSettingsPage() {
|
||||
useDebouncedEffect(() => updateTrackerSettings(), [trackerName], 1000);
|
||||
|
||||
useEffect(() => {
|
||||
updateTrackerSettings();
|
||||
}, [allowDriftCompensation]);
|
||||
|
||||
useEffect(() => {
|
||||
if (tracker && !firstLoad) setFirstLoad(true);
|
||||
}, [tracker, firstLoad]);
|
||||
|
||||
useEffect(() => {
|
||||
if (firstLoad) {
|
||||
reset({
|
||||
trackerName: tracker?.tracker.info?.customName as string | null,
|
||||
allowDriftCompensation: tracker?.tracker.info?.allowDriftCompensation,
|
||||
});
|
||||
}
|
||||
}, [firstLoad]);
|
||||
reset({
|
||||
trackerName: tracker?.tracker.info?.customName as string | null,
|
||||
});
|
||||
}, []);
|
||||
|
||||
const boardType = useMemo(() => {
|
||||
if (tracker?.device?.hardwareInfo?.officialBoardType) {
|
||||
@@ -469,29 +447,6 @@ export function TrackerSettingsPage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{tracker?.tracker.info?.isImu && (
|
||||
<div className="flex flex-col gap-2 w-full mt-3">
|
||||
<Typography variant="section-title">
|
||||
{l10n.getString('tracker-settings-drift_compensation_section')}
|
||||
</Typography>
|
||||
<Typography color="secondary">
|
||||
{l10n.getString(
|
||||
'tracker-settings-drift_compensation_section-description'
|
||||
)}
|
||||
</Typography>
|
||||
<div className="flex">
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
name="allowDriftCompensation"
|
||||
control={control}
|
||||
label={l10n.getString(
|
||||
'tracker-settings-drift_compensation_section-edit'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{tracker?.tracker.info?.isImu &&
|
||||
tracker?.tracker.info?.magnetometer !==
|
||||
MagnetometerStatus.NOT_SUPPORTED && (
|
||||
|
||||
Reference in new issue
Block a user