private void btCalibrateWheel_Click(object sender, EventArgs e)
        {
            CalibrateWheelForm calibwheel = new CalibrateWheelForm();

            calibwheel.SelectedAxis = SelectedAxis;
            var res = calibwheel.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                Input.AxisCorrection.ControlPoints.Clear();

                double X = calibwheel.RawMostLeft / 4095.0;
                double Y = 0.0; // 0%
                Input.AxisCorrection.ControlPoints.Add(new System.Windows.Point(X, Y));
                X = calibwheel.RawMostCenter / 4095.0;
                Y = 0.5; // 50%
                Input.AxisCorrection.ControlPoints.Add(new System.Windows.Point(X, Y));
                X = calibwheel.RawMostRight / 4095.0;
                Y = 1.0; // 100%
                Input.AxisCorrection.ControlPoints.Add(new System.Windows.Point(X, Y));

                Input.AxisCorrection.ControlPoints = Input.AxisCorrection.ControlPoints.OrderBy(p => p.X).ThenBy(p => p.Y).ToList <System.Windows.Point>();
                SelectedPoint        = Input.FindClosestControlPoint(X);
                lbSelectedPoint.Text = "Selected point: " + SelectedPoint;
                FillLine();
            }
        }
Esempio n. 2
0
        private void btnWheelCalibrate_Click(object sender, EventArgs e)
        {
            CalibrateWheelForm calibwheel = new CalibrateWheelForm();

            calibwheel.SelectedAxis = 0;
            var res = calibwheel.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                double range_cts       = calibwheel.RawMostLeft - calibwheel.RawMostRight;
                double scale_u_per_cts = 2.0 / range_cts;
                vJoyManager.Config.Hardware.WheelScaleFactor_u_per_cts = scale_u_per_cts;
                txtWheelScale.Text = vJoyManager.Config.Hardware.WheelScaleFactor_u_per_cts.ToString("G8", CultureInfo.InvariantCulture);

                double center_u = calibwheel.RawMostCenter * scale_u_per_cts;
                vJoyManager.Config.Hardware.WheelCenterOffset_u = center_u;
                txtWheelCenter.Text = vJoyManager.Config.Hardware.WheelCenterOffset_u.ToString("G8", CultureInfo.InvariantCulture);
            }
        }