From 172ff8fc6c0686ed07ce48dbab2aa65315b9cbde Mon Sep 17 00:00:00 2001 From: Erimel Date: Tue, 20 Oct 2026 19:21:13 -0400 Subject: [PATCH] Increase height calibration range --- .../main/java/dev/slimevr/heightcalibration/behaviours.kt | 6 +++--- .../dev/slimevr/heightcalibration/HeightCalibrationTest.kt | 4 ++-- .../test/java/dev/slimevr/solarxr/ProfilesBehaviourTest.kt | 2 ++ .../test/java/dev/slimevr/solarxr/SettingsDefaultsTest.kt | 1 + .../src/test/java/dev/slimevr/solarxr/SettingsResetTest.kt | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/server/core/src/main/java/dev/slimevr/heightcalibration/behaviours.kt b/server/core/src/main/java/dev/slimevr/heightcalibration/behaviours.kt index 80ef5dd84..8ee027f58 100644 --- a/server/core/src/main/java/dev/slimevr/heightcalibration/behaviours.kt +++ b/server/core/src/main/java/dev/slimevr/heightcalibration/behaviours.kt @@ -33,9 +33,9 @@ private const val HEAD_STABILITY_THRESHOLD = 0.003f internal const val HEAD_STABILITY_DURATION = 600_000_000L internal const val MAX_FLOOR_Y = 0.10f -internal const val HEAD_RISE_THRESHOLD = 1.2f -internal const val HEIGHT_MIN = 1.4f -internal const val HEIGHT_MAX = 1.936f +internal const val HEAD_RISE_THRESHOLD = 1.18f +internal const val HEIGHT_MIN = 1.3f +internal const val HEIGHT_MAX = 2f private val HEAD_ANGLE_THRESHOLD = cos(FastMath.DEG_TO_RAD * 15.0) private val CONTROLLER_ANGLE_THRESHOLD = cos(FastMath.DEG_TO_RAD * 60.0) diff --git a/server/core/src/test/java/dev/slimevr/heightcalibration/HeightCalibrationTest.kt b/server/core/src/test/java/dev/slimevr/heightcalibration/HeightCalibrationTest.kt index 734165118..c249c7ea1 100644 --- a/server/core/src/test/java/dev/slimevr/heightcalibration/HeightCalibrationTest.kt +++ b/server/core/src/test/java/dev/slimevr/heightcalibration/HeightCalibrationTest.kt @@ -215,7 +215,7 @@ class HeightCalibrationSessionTest { advanceTimeBy(SAMPLE_INTERVAL_MS) completeFloorPhase(controllerFlow, TrackerSnapshot(Vector3(0f, 0f, 0f), POINTING_DOWN)) - completeHeightPhase(headFlow, TrackerSnapshot(Vector3(0f, 1.3f, 0f), HEAD_LEVEL)) + completeHeightPhase(headFlow, TrackerSnapshot(Vector3(0f, 1.2f, 0f), HEAD_LEVEL)) assertEquals(UserHeightCalibrationStatus.ERROR_TOO_SMALL, context.state.value.status) job.cancel() @@ -230,7 +230,7 @@ class HeightCalibrationSessionTest { advanceTimeBy(SAMPLE_INTERVAL_MS) completeFloorPhase(controllerFlow, TrackerSnapshot(Vector3(0f, 0f, 0f), POINTING_DOWN)) - completeHeightPhase(headFlow, TrackerSnapshot(Vector3(0f, 2.0f, 0f), HEAD_LEVEL)) + completeHeightPhase(headFlow, TrackerSnapshot(Vector3(0f, 2.2f, 0f), HEAD_LEVEL)) assertEquals(UserHeightCalibrationStatus.ERROR_TOO_HIGH, context.state.value.status) job.cancel() diff --git a/server/core/src/test/java/dev/slimevr/solarxr/ProfilesBehaviourTest.kt b/server/core/src/test/java/dev/slimevr/solarxr/ProfilesBehaviourTest.kt index 9348ea090..9b4a8c3ea 100644 --- a/server/core/src/test/java/dev/slimevr/solarxr/ProfilesBehaviourTest.kt +++ b/server/core/src/test/java/dev/slimevr/solarxr/ProfilesBehaviourTest.kt @@ -29,6 +29,7 @@ private class Harness(val bridge: SolarXRBridge, val config: AppConfig, val sent fun statuses() = sent.filterIsInstance().map { it.status } } +@OptIn(ExperimentalCoroutinesApi::class) private suspend fun buildHarness(scope: TestScope): Harness { val config = AppConfig.create(scope.backgroundScope, MemoryStorage()) val sent = mutableListOf() @@ -54,6 +55,7 @@ private suspend fun buildHarness(scope: TestScope): Harness { return Harness(bridge, config, sent) } +@OptIn(ExperimentalCoroutinesApi::class) private fun awaitStatuses(scope: TestScope, h: Harness, count: Int) { val deadline = System.nanoTime() + 5_000_000_000L while (h.statuses().size < count && System.nanoTime() < deadline) { diff --git a/server/core/src/test/java/dev/slimevr/solarxr/SettingsDefaultsTest.kt b/server/core/src/test/java/dev/slimevr/solarxr/SettingsDefaultsTest.kt index 838214fad..8a2006e68 100644 --- a/server/core/src/test/java/dev/slimevr/solarxr/SettingsDefaultsTest.kt +++ b/server/core/src/test/java/dev/slimevr/solarxr/SettingsDefaultsTest.kt @@ -42,6 +42,7 @@ class SettingsDefaultsTest { } } +@OptIn(ExperimentalCoroutinesApi::class) private fun buildBridge(scope: TestScope, responses: MutableList): SolarXRBridge { val context = Context.create( initialState = SolarXRBridgeState(dataFeedConfigs = listOf()), diff --git a/server/core/src/test/java/dev/slimevr/solarxr/SettingsResetTest.kt b/server/core/src/test/java/dev/slimevr/solarxr/SettingsResetTest.kt index 166af01b7..a53c5641a 100644 --- a/server/core/src/test/java/dev/slimevr/solarxr/SettingsResetTest.kt +++ b/server/core/src/test/java/dev/slimevr/solarxr/SettingsResetTest.kt @@ -27,6 +27,7 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue +@OptIn(ExperimentalCoroutinesApi::class) private fun awaitReset(scope: TestScope, config: AppConfig) { val deadline = System.nanoTime() + 5_000_000_000L while (config.globalConfig.context.state.value.errorReporting.consent != ErrorReportingConsent.UNDECIDED && System.nanoTime() < deadline) {