diff --git a/gui/src/components/tracker/TrackerSettings.tsx b/gui/src/components/tracker/TrackerSettings.tsx index ed44a0f440..a2ed0e26fc 100644 --- a/gui/src/components/tracker/TrackerSettings.tsx +++ b/gui/src/components/tracker/TrackerSettings.tsx @@ -418,13 +418,15 @@ export function TrackerSettingsPage() { )} - {tracker?.tracker.info?.isImu && ( - - )} + {tracker?.tracker.info?.isImu && + tracker?.tracker.info?.magnetometer !== + MagnetometerStatus.NOT_SUPPORTED && ( + + )}
{l10n.getString('tracker-settings-name_section')} diff --git a/server/core/src/main/java/dev/slimevr/config/ServerConfig.kt b/server/core/src/main/java/dev/slimevr/config/ServerConfig.kt index 717d334fe8..cc33468296 100644 --- a/server/core/src/main/java/dev/slimevr/config/ServerConfig.kt +++ b/server/core/src/main/java/dev/slimevr/config/ServerConfig.kt @@ -1,6 +1,7 @@ package dev.slimevr.config import dev.slimevr.VRServer +import dev.slimevr.tracking.trackers.udp.MagnetometerStatus import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope @@ -20,18 +21,33 @@ class ServerConfig { VRServer.instance.deviceManager.devices.filter { it.magSupport }.map { async { + // Not using 255 as it sometimes could make one of the sensors go into + // error mode (if there is more than one sensor inside the device) if (!state) { - it.setMag(false) + val trackers = it.trackers.filterValues { + it.magStatus != MagnetometerStatus.NOT_SUPPORTED + } +// if(trackers.size == it.trackers.size) { +// it.setMag(false) +// } else { + trackers.map { (_, t) -> + async { it.setMag(false, t.trackerNum) } + }.awaitAll() +// } return@async } - val every = it.trackers.all { (_, t) -> t.config.shouldHaveMagEnabled == true } - if (every) { - it.setMag(true) - return@async - } +// val every = it.trackers.all { (_, t) -> t.config.shouldHaveMagEnabled == true +// && t.magStatus != MagnetometerStatus.NOT_SUPPORTED } +// if (every) { +// it.setMag(true) +// return@async +// } - it.trackers.filterValues { it.config.shouldHaveMagEnabled == true } + it.trackers.filterValues { + it.config.shouldHaveMagEnabled == true && + it.magStatus != MagnetometerStatus.NOT_SUPPORTED + } .map { (_, t) -> async { // FIXME: Tracker gets restarted after each setMag, what will happen for devices with 3 trackers?