mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-22 10:01:19 -08:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61065eba7f | ||
|
|
0e750fd1de | ||
|
|
7aabdbe724 |
No files matched your search
@@ -26,6 +26,7 @@
|
||||
"@tweenjs/tween.js": "^25.0.0",
|
||||
"@twemoji/svg": "^15.0.0",
|
||||
"browser-fs-access": "^0.35.0",
|
||||
"chart.js": "^4.5.0",
|
||||
"classnames": "^2.5.1",
|
||||
"flatbuffers": "22.10.26",
|
||||
"intl-pluralrules": "^2.0.1",
|
||||
@@ -33,6 +34,7 @@
|
||||
"jotai": "^2.12.2",
|
||||
"prompts": "^2.4.2",
|
||||
"react": "^18.3.1",
|
||||
"react-chartjs-2": "^5.3.0",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-error-boundary": "^4.0.13",
|
||||
"react-helmet": "^6.1.0",
|
||||
|
||||
@@ -390,6 +390,10 @@ tracker-settings-update-blocked = Update not available. No other releases availa
|
||||
tracker-settings-update-available = { $versionName } is now available
|
||||
tracker-settings-update = Update now
|
||||
tracker-settings-update-title = Firmware version
|
||||
tracker-settings-graph-acceleration-title = Tracker Acceleration
|
||||
tracker-settings-graph-position-title = Tracker Position
|
||||
tracker-settings-graph-show-title = Show Tracker Graph
|
||||
tracker-settings-graph-hide-title = Hide Tracker Graph
|
||||
|
||||
## Tracker part card info
|
||||
tracker-part_card-no_name = No name
|
||||
@@ -971,7 +975,6 @@ onboarding-connect_tracker-next = I connected all my trackers
|
||||
onboarding-calibration_tutorial = IMU Calibration Tutorial
|
||||
onboarding-calibration_tutorial-subtitle = This will help reduce tracker drifting!
|
||||
onboarding-calibration_tutorial-description-v1 = After turning on your trackers, place them on a stable surface for a moment to allow for calibration. Calibration can be performed at any time after the trackers are powered on—this page simply provides a tutorial. To begin, click the "{ onboarding-calibration_tutorial-calibrate }" button, then <b>do not move your trackers!</b>
|
||||
onboarding-calibration_tutorial-description-no-ready-v1 = After turning on your trackers, place them on a stable surface for a couple seconds to allow for calibration. Calibration can be performed at any time after the trackers are powered on—this page simply provides a tutorial. To begin, put down your trackers, then <b>do not move them!</b>
|
||||
onboarding-calibration_tutorial-calibrate = I placed my trackers on a table
|
||||
onboarding-calibration_tutorial-status-waiting = Waiting for you
|
||||
onboarding-calibration_tutorial-status-calibrating = Calibrating
|
||||
|
||||
@@ -61,6 +61,16 @@ import { FirmwareUpdate } from './components/firmware-update/FirmwareUpdate';
|
||||
import { ConnectionLost } from './components/onboarding/pages/ConnectionLost';
|
||||
import { VRCWarningsPage } from './components/vrc/VRCWarningsPage';
|
||||
import { StayAlignedSetup } from './components/onboarding/pages/stay-aligned/StayAlignedSetup';
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend,
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
PointElement,
|
||||
LineElement,
|
||||
} from 'chart.js';
|
||||
|
||||
export const GH_REPO = 'SlimeVR/SlimeVR-Server';
|
||||
export const VersionContext = createContext('');
|
||||
@@ -73,6 +83,16 @@ function Layout() {
|
||||
const { isMobile } = useBreakpoint('mobile');
|
||||
useDiscordPresence();
|
||||
|
||||
ChartJS.register(
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend,
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
PointElement,
|
||||
LineElement
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SerialDetectionModal></SerialDetectionModal>
|
||||
|
||||
@@ -14,7 +14,6 @@ import { Vector3 } from 'three';
|
||||
import { useTimeout } from '@/hooks/timeout';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { connectedIMUTrackersAtom } from '@/store/app-store';
|
||||
import { RestCalibrationStatus } from 'solarxr-protocol';
|
||||
|
||||
export enum CalibrationStatus {
|
||||
SUCCESS,
|
||||
@@ -41,25 +40,9 @@ export function CalibrationTutorialPage() {
|
||||
const connectedIMUTrackers = useAtomValue(connectedIMUTrackersAtom);
|
||||
const restCalibrationTrackers =
|
||||
useRestCalibrationTrackers(connectedIMUTrackers);
|
||||
|
||||
const useRestCalibrationFlag = useMemo(
|
||||
() =>
|
||||
restCalibrationTrackers.length > 0 &&
|
||||
restCalibrationTrackers.every(
|
||||
(tracker) =>
|
||||
tracker.tracker.info?.restCalibrationStatus !==
|
||||
RestCalibrationStatus.NOT_SUPPORTED
|
||||
),
|
||||
[restCalibrationTrackers]
|
||||
);
|
||||
|
||||
const [rested, setRested] = useState(false);
|
||||
const lastValueMap = useRef(new Map<number, Vector3[]>());
|
||||
useEffect(() => {
|
||||
if (useRestCalibrationFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
const accelLength = restCalibrationTrackers.every((x) => {
|
||||
if (
|
||||
x.tracker.trackerId?.trackerNum === undefined ||
|
||||
@@ -88,29 +71,6 @@ export function CalibrationTutorialPage() {
|
||||
}, [restCalibrationTrackers]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!useRestCalibrationFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
restCalibrationTrackers.some(
|
||||
(tracker) =>
|
||||
tracker.tracker.info?.restCalibrationStatus !==
|
||||
RestCalibrationStatus.CALIBRATED
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
setCalibrationStatus(CalibrationStatus.SUCCESS);
|
||||
abortCountdown();
|
||||
}, [restCalibrationTrackers]);
|
||||
|
||||
useEffect(() => {
|
||||
if (useRestCalibrationFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (calibrationStatus === CalibrationStatus.CALIBRATING && !rested) {
|
||||
setCalibrationStatus(CalibrationStatus.ERROR);
|
||||
abortCountdown();
|
||||
@@ -169,11 +129,7 @@ export function CalibrationTutorialPage() {
|
||||
</Typography>
|
||||
</div>
|
||||
<Localized
|
||||
id={
|
||||
useRestCalibrationFlag
|
||||
? 'onboarding-calibration_tutorial-description-no-ready-v1'
|
||||
: 'onboarding-calibration_tutorial-description-v1'
|
||||
}
|
||||
id="onboarding-calibration_tutorial-description-v1"
|
||||
elems={{ b: <b></b> }}
|
||||
>
|
||||
<Typography>Description on calibration of IMU</Typography>
|
||||
@@ -221,9 +177,7 @@ export function CalibrationTutorialPage() {
|
||||
disabled={isCounting || !rested}
|
||||
className={classNames(
|
||||
'xs:ml-auto',
|
||||
(CalibrationStatus.SUCCESS === calibrationStatus ||
|
||||
useRestCalibrationFlag) &&
|
||||
'hidden'
|
||||
CalibrationStatus.SUCCESS === calibrationStatus && 'hidden'
|
||||
)}
|
||||
>
|
||||
{l10n.getString('onboarding-calibration_tutorial-calibrate')}
|
||||
@@ -233,14 +187,8 @@ export function CalibrationTutorialPage() {
|
||||
to="/onboarding/assign-tutorial"
|
||||
className={classNames(
|
||||
'xs:ml-auto',
|
||||
CalibrationStatus.SUCCESS !== calibrationStatus &&
|
||||
!useRestCalibrationFlag &&
|
||||
'hidden'
|
||||
CalibrationStatus.SUCCESS !== calibrationStatus && 'hidden'
|
||||
)}
|
||||
disabled={
|
||||
useRestCalibrationFlag &&
|
||||
calibrationStatus !== CalibrationStatus.SUCCESS
|
||||
}
|
||||
>
|
||||
{l10n.getString('onboarding-continue')}
|
||||
</Button>
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
import { useLocalization } from '@fluent/react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Line } from 'react-chartjs-2';
|
||||
import { TrackerDataT } from 'solarxr-protocol';
|
||||
import { Button } from '@/components/commons/Button';
|
||||
import { useConfig } from '@/hooks/config';
|
||||
|
||||
export function TrackerGraph({ tracker }: { tracker: TrackerDataT }) {
|
||||
const { l10n } = useLocalization();
|
||||
const { config } = useConfig();
|
||||
|
||||
type AxisData = {
|
||||
x: number;
|
||||
y: number;
|
||||
time: number;
|
||||
};
|
||||
|
||||
type ChartData = {
|
||||
x: AxisData[];
|
||||
y: AxisData[];
|
||||
z: AxisData[];
|
||||
};
|
||||
|
||||
const [chartData, setChartData] = useState<ChartData>({
|
||||
x: [],
|
||||
y: [],
|
||||
z: [],
|
||||
});
|
||||
|
||||
const [showTrackerGraph, setShowTrackerGraph] = useState(false);
|
||||
|
||||
const secondDuration = 60;
|
||||
|
||||
useEffect(() => {
|
||||
if (!showTrackerGraph) {
|
||||
return;
|
||||
}
|
||||
|
||||
const newValue = tracker.info?.isImu
|
||||
? tracker.linearAcceleration
|
||||
: tracker.position;
|
||||
if (!newValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentTime = new Date().getTime() / 1000;
|
||||
const startTime = currentTime - secondDuration;
|
||||
|
||||
const updateData = (data: AxisData[], newSample: number) => {
|
||||
const remapped = data
|
||||
.filter((value) => value.time >= startTime)
|
||||
.map((value) => ({ ...value, x: value.time - startTime }));
|
||||
remapped.push({
|
||||
time: currentTime,
|
||||
x: secondDuration,
|
||||
y: newSample,
|
||||
});
|
||||
return remapped;
|
||||
};
|
||||
|
||||
const newData = {
|
||||
x: updateData(chartData.x, newValue.x),
|
||||
y: updateData(chartData.y, newValue.y),
|
||||
z: updateData(chartData.z, newValue.z),
|
||||
};
|
||||
setChartData(newData);
|
||||
}, [tracker]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!showTrackerGraph) {
|
||||
setChartData({ x: [], y: [], z: [] });
|
||||
}
|
||||
}, [showTrackerGraph]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
variant="tertiary"
|
||||
className="self-start"
|
||||
onClick={() => setShowTrackerGraph(!showTrackerGraph)}
|
||||
>
|
||||
{l10n.getString(
|
||||
showTrackerGraph
|
||||
? 'tracker-settings-graph-hide-title'
|
||||
: 'tracker-settings-graph-show-title'
|
||||
)}
|
||||
</Button>
|
||||
{showTrackerGraph && (
|
||||
<div className="h-96">
|
||||
<Line
|
||||
options={{
|
||||
responsive: true,
|
||||
animation: false,
|
||||
font: {
|
||||
family: config?.fonts.map((font) => `"${font}"`).join(','),
|
||||
size: config?.textSize,
|
||||
},
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: l10n.getString(
|
||||
tracker?.info?.isImu
|
||||
? 'tracker-settings-graph-acceleration-title'
|
||||
: 'tracker-settings-graph-position-title'
|
||||
),
|
||||
color: 'white',
|
||||
},
|
||||
tooltip: {
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
animation: false,
|
||||
callbacks: {
|
||||
title: () => '',
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
labels: {
|
||||
color: 'white',
|
||||
},
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
type: 'linear',
|
||||
min: 0,
|
||||
max: secondDuration,
|
||||
ticks: {
|
||||
color: 'white',
|
||||
},
|
||||
},
|
||||
y: {
|
||||
min: -4,
|
||||
max: 4,
|
||||
ticks: {
|
||||
color: 'white',
|
||||
},
|
||||
},
|
||||
},
|
||||
elements: {
|
||||
point: {
|
||||
radius: 0,
|
||||
},
|
||||
},
|
||||
parsing: false,
|
||||
normalized: true,
|
||||
maintainAspectRatio: false,
|
||||
}}
|
||||
data={{
|
||||
labels: ['X', 'Y', 'Z'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'X',
|
||||
data: chartData.x,
|
||||
borderColor: 'rgb(200, 50, 50)',
|
||||
backgroundColor: 'rgb(200, 100, 100)',
|
||||
},
|
||||
{
|
||||
label: 'Y',
|
||||
data: chartData.y,
|
||||
borderColor: 'rgb(50, 200, 50)',
|
||||
backgroundColor: 'rgb(100, 200, 100)',
|
||||
},
|
||||
{
|
||||
label: 'Z',
|
||||
data: chartData.z,
|
||||
borderColor: 'rgb(50, 50, 200)',
|
||||
backgroundColor: 'rgb(100, 100, 200)',
|
||||
},
|
||||
],
|
||||
}}
|
||||
id="tracker-graph"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -40,6 +40,7 @@ import semver from 'semver';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { ignoredTrackersAtom } from '@/store/app-store';
|
||||
import { checkForUpdate } from '@/hooks/firmware-update';
|
||||
import { TrackerGraph } from './TrackerGraph';
|
||||
|
||||
const rotationsLabels: [Quaternion, string][] = [
|
||||
[rotationToQuatMap.BACK, 'tracker-rotation-back'],
|
||||
@@ -505,6 +506,7 @@ export function TrackerSettingsPage() {
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
{tracker && <TrackerGraph tracker={tracker.tracker} />}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Generated
+31
@@ -83,6 +83,9 @@ importers:
|
||||
browser-fs-access:
|
||||
specifier: ^0.35.0
|
||||
version: 0.35.0
|
||||
chart.js:
|
||||
specifier: ^4.5.0
|
||||
version: 4.5.0
|
||||
classnames:
|
||||
specifier: ^2.5.1
|
||||
version: 2.5.1
|
||||
@@ -104,6 +107,9 @@ importers:
|
||||
react:
|
||||
specifier: ^18.3.1
|
||||
version: 18.3.1
|
||||
react-chartjs-2:
|
||||
specifier: ^5.3.0
|
||||
version: 5.3.0([email protected])([email protected])
|
||||
react-dom:
|
||||
specifier: ^18.3.1
|
||||
version: 18.3.1([email protected])
|
||||
@@ -720,6 +726,9 @@ packages:
|
||||
'@jridgewell/[email protected]':
|
||||
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
||||
|
||||
'@kurkle/[email protected]':
|
||||
resolution: {integrity: sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==}
|
||||
|
||||
'@mediapipe/[email protected]':
|
||||
resolution: {integrity: sha512-Rp7ll8BHrKB3wXaRFKhrltwZl1CiXGdibPxuWXvqGnKTnv8fqa/nvftYNuSbf+pbJWKYCXdBtYTITdAUTGGh0Q==}
|
||||
|
||||
@@ -1780,6 +1789,10 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-aYeC/jDgSEx8SHWZvANYMioYMZ2KX02W6f6uVfyteuCGcadDLcYVHdfdygsTQkQ4TKn5lghoojAsPj5pu0SnvQ==}
|
||||
engines: {pnpm: '>=8'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
|
||||
engines: {node: '>= 8.10.0'}
|
||||
@@ -2470,6 +2483,7 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-Gwj/A2htjvLEcY07PKDItv0WCPEs3dV2vWeZ+9TVBSKSTuWEZ4oXaMD0ZAOsajwx2orahQWN4HI0MfRyWSZsbg==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
deprecated: please use built-in fetch in nodejs
|
||||
peerDependencies:
|
||||
got: ^12.0.0
|
||||
|
||||
@@ -3542,6 +3556,12 @@ packages:
|
||||
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-UfZZFnDsERI3c3CZGxzvNJd02SHjaSJ8kgW1djn65H1KK8rehwTjyrRKOG3VTMG8wtHZ5rgAO5oTHtHi9GCCmw==}
|
||||
peerDependencies:
|
||||
chart.js: ^4.1.1
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-1uWd07EME6XZvMfapwZmc7NgCZqDemcvicRi3wMJzXsQLvZ3L7fTHVyPy1bZdnWXM4iPjYuNE+uJ41MLKeTtnA==}
|
||||
peerDependencies:
|
||||
@@ -4959,6 +4979,8 @@ snapshots:
|
||||
'@jridgewell/resolve-uri': 3.1.2
|
||||
'@jridgewell/sourcemap-codec': 1.4.15
|
||||
|
||||
'@kurkle/[email protected]': {}
|
||||
|
||||
'@mediapipe/[email protected]': {}
|
||||
|
||||
'@mgit-at/[email protected]':
|
||||
@@ -6072,6 +6094,10 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
'@kurkle/color': 0.3.4
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
anymatch: 3.1.3
|
||||
@@ -8159,6 +8185,11 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]([email protected])([email protected]):
|
||||
dependencies:
|
||||
chart.js: 4.5.0
|
||||
react: 18.3.1
|
||||
|
||||
[email protected]([email protected]):
|
||||
dependencies:
|
||||
prop-types: 15.8.1
|
||||
|
||||
@@ -153,12 +153,6 @@ public class DataFeedBuilder {
|
||||
|
||||
TrackerInfo.addDataSupport(fbb, tracker.getTrackerDataType().getSolarType());
|
||||
|
||||
TrackerInfo
|
||||
.addRestCalibrationStatus(
|
||||
fbb,
|
||||
tracker.getRestCalibrationStatus().getSolarType()
|
||||
);
|
||||
|
||||
return TrackerInfo.endTrackerInfo(fbb);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import dev.slimevr.tracking.processor.stayaligned.trackers.StayAlignedTrackerSta
|
||||
import dev.slimevr.tracking.trackers.TrackerPosition.Companion.getByDesignation
|
||||
import dev.slimevr.tracking.trackers.udp.IMUType
|
||||
import dev.slimevr.tracking.trackers.udp.MagnetometerStatus
|
||||
import dev.slimevr.tracking.trackers.udp.RestCalibrationStatus
|
||||
import dev.slimevr.tracking.trackers.udp.TrackerDataType
|
||||
import dev.slimevr.util.InterpolationHandler
|
||||
import io.eiren.util.BufferedTimer
|
||||
@@ -85,7 +84,6 @@ class Tracker @JvmOverloads constructor(
|
||||
*/
|
||||
val trackRotDirection: Boolean = true,
|
||||
magStatus: MagnetometerStatus = MagnetometerStatus.NOT_SUPPORTED,
|
||||
restCalibrationStatus: RestCalibrationStatus = RestCalibrationStatus.NOT_SUPPORTED,
|
||||
/**
|
||||
* Rotation by default.
|
||||
* NOT the same as hasRotation (other data types emulate rotation)
|
||||
@@ -109,8 +107,6 @@ class Tracker @JvmOverloads constructor(
|
||||
var customName: String? = null
|
||||
var magStatus: MagnetometerStatus = magStatus
|
||||
private set
|
||||
var restCalibrationStatus: RestCalibrationStatus = restCalibrationStatus
|
||||
private set
|
||||
|
||||
/**
|
||||
* If the tracker has gotten disconnected after it was initialized first time
|
||||
@@ -478,10 +474,6 @@ class Tracker @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
internal fun setRestCalibrationPrivate(status: RestCalibrationStatus) {
|
||||
restCalibrationStatus = status
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the magnetic field vector, in mGauss.
|
||||
*/
|
||||
|
||||
@@ -153,30 +153,6 @@ enum class MagnetometerStatus {
|
||||
}
|
||||
}
|
||||
|
||||
enum class RestCalibrationStatus {
|
||||
NOT_SUPPORTED,
|
||||
NOT_CALIBRATED,
|
||||
CALIBRATED,
|
||||
;
|
||||
|
||||
fun getSolarType(): Int = this.ordinal
|
||||
|
||||
companion object {
|
||||
private val byId = entries.associateBy { it.ordinal.toUByte() }
|
||||
|
||||
@JvmStatic
|
||||
fun getById(id: UByte): RestCalibrationStatus? = byId[id]
|
||||
|
||||
@JvmStatic
|
||||
fun fromBoolean(value: Boolean?): RestCalibrationStatus =
|
||||
when (value) {
|
||||
null -> NOT_SUPPORTED
|
||||
true -> CALIBRATED
|
||||
false -> NOT_CALIBRATED
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class SensorConfig(val v: UShort) {
|
||||
val magStatus
|
||||
|
||||
@@ -174,16 +174,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
// Set up new sensor for older firmware.
|
||||
// Firmware after 7 should send sensor status packet and sensor
|
||||
// will be created when it's received
|
||||
setUpSensor(
|
||||
connection,
|
||||
0,
|
||||
handshake.imuType,
|
||||
1,
|
||||
MagnetometerStatus.NOT_SUPPORTED,
|
||||
RestCalibrationStatus.NOT_SUPPORTED,
|
||||
null,
|
||||
TrackerDataType.ROTATION,
|
||||
)
|
||||
setUpSensor(connection, 0, handshake.imuType, 1, MagnetometerStatus.NOT_SUPPORTED, null, TrackerDataType.ROTATION)
|
||||
}
|
||||
connection
|
||||
}
|
||||
@@ -195,7 +186,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
}
|
||||
|
||||
private val mainScope = CoroutineScope(SupervisorJob())
|
||||
private fun setUpSensor(connection: UDPDevice, trackerId: Int, sensorType: IMUType, sensorStatus: Int, magStatus: MagnetometerStatus, restCalibrationStatus: RestCalibrationStatus, trackerPosition: TrackerPosition?, trackerDataType: TrackerDataType) {
|
||||
private fun setUpSensor(connection: UDPDevice, trackerId: Int, sensorType: IMUType, sensorStatus: Int, magStatus: MagnetometerStatus, trackerPosition: TrackerPosition?, trackerDataType: TrackerDataType) {
|
||||
LogManager.info("[TrackerServer] Sensor $trackerId for ${connection.name} status: $sensorStatus")
|
||||
var imuTracker = connection.getTracker(trackerId)
|
||||
if (imuTracker == null) {
|
||||
@@ -223,7 +214,6 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
needsMounting = true,
|
||||
usesTimeout = true,
|
||||
magStatus = magStatus,
|
||||
restCalibrationStatus = restCalibrationStatus,
|
||||
trackerDataType = trackerDataType,
|
||||
)
|
||||
connection.trackers[trackerId] = imuTracker
|
||||
@@ -233,6 +223,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
val status = UDPPacket15SensorInfo.getStatus(sensorStatus)
|
||||
if (status != null) imuTracker.status = status
|
||||
|
||||
if (magStatus == MagnetometerStatus.NOT_SUPPORTED) return
|
||||
if (magStatus == MagnetometerStatus.ENABLED &&
|
||||
(!VRServer.instance.configManager.vrConfig.server.useMagnetometerOnAllTrackers || imuTracker.config.shouldHaveMagEnabled == false)
|
||||
) {
|
||||
@@ -250,8 +241,6 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
imuTracker.setRestCalibrationPrivate(restCalibrationStatus)
|
||||
}
|
||||
|
||||
private data class ConfigStateWaiter(
|
||||
@@ -486,14 +475,12 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
is UDPPacket15SensorInfo -> {
|
||||
if (connection == null) return
|
||||
val magStatus = packet.sensorConfig?.magStatus ?: MagnetometerStatus.NOT_SUPPORTED
|
||||
val restCalibrationStatus = RestCalibrationStatus.fromBoolean(packet.hasCompletedRestCalibration)
|
||||
setUpSensor(
|
||||
connection,
|
||||
packet.sensorId,
|
||||
packet.sensorType,
|
||||
packet.sensorStatus,
|
||||
magStatus,
|
||||
restCalibrationStatus,
|
||||
packet.trackerPosition,
|
||||
packet.trackerDataType,
|
||||
)
|
||||
|
||||
+1
-1
Submodule solarxr-protocol updated: 4f64cb3a8c...df26226d10.
Reference in new issue
Block a user