private void TryCalibrate() { if (IsCalbrating) { return; } bool leftReady = !FinchController.Left.IsConnected || leftReadyCalibrate && FinchController.Left.GetPressTime(FinchControllerElement.HomeButton) > Settings.TimePressingToCallCalibration; bool rightReady = !FinchController.Right.IsConnected || rightReadyCalibrate && FinchController.Right.GetPressTime(FinchControllerElement.HomeButton) > Settings.TimePressingToCallCalibration; if (Settings.AvailableMomentalCalibration) { if (FinchCore.Settings.ControllerType == FinchControllerType.Dash) { if (leftReady) { FastCalibrate(FinchController.Left); leftReadyCalibrate = false; } if (rightReady) { FastCalibrate(FinchController.Right); rightReadyCalibrate = false; } } else if (leftReady && rightReady) { if (availableMomentalCalibration) { leftReadyCalibrate = false; rightReadyCalibrate = false; FinchController.Left.HapticPulse(Settings.HapticTime); FinchController.Right.HapticPulse(Settings.HapticTime); FinchCore.Calibration(FinchChirality.Both); } else { leftReadyCalibrate = false; rightReadyCalibrate = false; ResetCalibration(); Calibrate(Settings.Calibration); } } } else if (FinchCore.NodesState.GetControllersCount() > 0 && leftReady && rightReady) { leftReadyCalibrate = false; rightReadyCalibrate = false; ResetCalibration(); Calibrate(Settings.Calibration); } }
private void TryCalibrate() { bool leftReady = !FinchController.Left.IsConnected || leftReadyCalibrate && FinchController.Left.GetPressTime(FinchControllerElement.HomeButton) > Settings.TimeToCallModule; bool rightReady = !FinchController.Right.IsConnected || rightReadyCalibrate && FinchController.Right.GetPressTime(FinchControllerElement.HomeButton) > Settings.TimeToCallModule; bool fastCalibrate = Settings.Calibration == CalibrationType.FastCalibration && PlayableSet.AllPlayableNodesConnected; bool useDash = FinchCore.Settings.ControllerType == FinchControllerType.Dash; if (fastCalibrate && useDash) { if (leftReady) { FastCalibrate(FinchController.Left); leftReadyCalibrate = false; } if (rightReady) { FastCalibrate(FinchController.Right); rightReadyCalibrate = false; } } else if (FinchCore.NodesState.GetControllersCount() > 0 && leftReady && rightReady && !IsCalbrating) { leftReadyCalibrate = false; rightReadyCalibrate = false; ResetCalibration(); bool leftCapacityCorrect = !FinchController.Left.IsConnected || FinchCore.GetCapacitySensor(FinchNodeType.LeftHand) == FinchChirality.Left; bool rightCapacityCorrect = !FinchController.Right.IsConnected || FinchCore.GetCapacitySensor(FinchNodeType.RightHand) == FinchChirality.Right; bool angleCorrect = NodeAngleChecker.IsCorrectAngle; bool momentalCalibration = leftCapacityCorrect && rightCapacityCorrect && angleCorrect && !useDash; if (fastCalibrate && momentalCalibration) { FinchController.Left.HapticPulse(Settings.HapticTime); FinchController.Right.HapticPulse(Settings.HapticTime); FinchCore.Calibration(FinchChirality.Both); } else { if (!(PlayableSet.AllPlayableNodesConnected)) { PlayableSet.ResetSaveComlect(); } Calibrate(PlayableSet.AllPlayableNodesConnected ? Settings.Calibration : CalibrationType.FullCalibration); } } }
/// <summary> /// Calibrates the selected controller. /// </summary> public void Calibrate() { FinchCore.Calibration(Chirality); }
/// <summary> /// Allows you to calibrate controllers for a given chirality. /// </summary> /// <param name="chirality">Controller chirality</param> public static void Calibrate(FinchChirality chirality) { FinchCore.Calibration(chirality); }