private void BindsChirality(bool swapNodes)
 {
     if (swapNodes)
     {
         FinchCore.SwapNodes(FinchNodeType.LeftUpperArm, FinchNodeType.RightUpperArm);
     }
 }
        public override void Init(int id)
        {
            base.Init(id);

            if (FinchCore.Interop.FinchIsUpperArmReverted(FinchCore.Interop.FinchChirality.Left) == 1)
            {
                FinchCore.Interop.FinchRevertUpperArm(FinchCore.Interop.FinchChirality.Left);
            }

            if (FinchCore.Interop.FinchIsUpperArmReverted(FinchCore.Interop.FinchChirality.Right) == 1)
            {
                FinchCore.Interop.FinchRevertUpperArm(FinchCore.Interop.FinchChirality.Right);
            }

            FinchCore.Interop.FinchResetCalibration(FinchCore.Interop.FinchChirality.Left);
            FinchCore.Interop.FinchResetCalibration(FinchCore.Interop.FinchChirality.Right);

            bool rightDifferentNodes = FinchController.Right.IsConnected && FinchInput.IsConnected(FinchNodeType.LeftUpperArm);
            bool leftDifferentNodes  = FinchController.Left.IsConnected && FinchInput.IsConnected(FinchNodeType.RightUpperArm);

            if (FinchCore.NodesState.GetUpperArmCount() == 1 && (rightDifferentNodes || leftDifferentNodes))
            {
                FinchCore.SwapNodes(FinchNodeType.LeftUpperArm, FinchNodeType.RightUpperArm);
            }

            tremblePass    = FinchCore.NodesState.GetUpperArmCount() < 2;
            leftArmShaking = false;

            ResetValue();
            TryPassStepWithoutRedefine();
        }
        private bool TryCalibrate(FinchChirality chirality, bool swap)
        {
            FinchController mainController       = chirality == FinchChirality.Left ? FinchController.Left : FinchController.Right;
            FinchController additionalController = chirality == FinchChirality.Left ? FinchController.Right : FinchController.Left;

            bool leftCalibrate       = leftPressDown && FinchController.Left.GetPressTime(FinchControllerElement.HomeButton) > FinchCalibration.Settings.TimePressingToCallCalibration;
            bool rightCalibrate      = rightPressDown && FinchController.Right.GetPressTime(FinchControllerElement.HomeButton) > FinchCalibration.Settings.TimePressingToCallCalibration;
            bool mainCalibrate       = chirality == FinchChirality.Left ? leftCalibrate : rightCalibrate;
            bool additionalCalibrate = chirality == FinchChirality.Left ? rightCalibrate : leftCalibrate;

            if (mainCalibrate || additionalCalibrate && swap)
            {
                if (mainCalibrate)
                {
                    mainController.HapticPulse(FinchCalibration.Settings.HapticTime);
                    mainController.Calibrate();
                }
                else
                {
                    additionalController.HapticPulse(FinchCalibration.Settings.HapticTime);
                    additionalController.Calibrate();
                    FinchCore.SwapNodes(FinchNodeType.LeftHand, FinchNodeType.RightHand);
                    FinchCore.Interop.FinchSwapCalibrations(1, 0);
                }
            }

            return(mainCalibrate || additionalCalibrate && swap);
        }
        private void TryBindChiralityManually()
        {
            bool pressLeft  = FinchInput.GetPressDown(FinchNodeType.LeftUpperArm, FinchControllerElement.HomeButton);
            bool pressRight = FinchInput.GetPressDown(FinchNodeType.RightUpperArm, FinchControllerElement.HomeButton);

            if (pressLeft || pressRight)
            {
                if (pressLeft)
                {
                    FinchCore.SwapNodes(FinchNodeType.LeftUpperArm, FinchNodeType.RightUpperArm);
                }

                if (!tremblePass)
                {
                    ResetValue();
                    tremblePass = true;
                }
            }
        }