private void btCalibrateWheel_Click(object sender, EventArgs e) { var ctlpt = this.InputRawDB.ControlPoints; CalibrateWheelForm calibwheel = new CalibrateWheelForm(); calibwheel.SelectedRawAxis = SelectedAxis; var res = calibwheel.ShowDialog(this); if (res == DialogResult.OK) { ctlpt.Clear(); // SCale values to percent given the range double X = Converting.NormalizeToPct(calibwheel.RawMostLeft_cts, this.InputRawDB.RawMin_cts, this.InputRawDB.RawMax_cts); double Y = 0.0; // 0% ctlpt.Add(new System.Windows.Point(X, Y)); X = Converting.NormalizeToPct(calibwheel.RawMostCenter_cts, this.InputRawDB.RawMin_cts, this.InputRawDB.RawMax_cts); Y = 0.5; // 50% ctlpt.Add(new System.Windows.Point(X, Y)); X = Converting.NormalizeToPct(calibwheel.RawMostRight_cts, this.InputRawDB.RawMin_cts, this.InputRawDB.RawMax_cts); Y = 1.0; // 100% ctlpt.Add(new System.Windows.Point(X, Y)); this.InputRawDB.ControlPoints = ctlpt.OrderBy(p => p.X).ThenBy(p => p.Y).ToList <System.Windows.Point>(); SelectedPoint = InputRawDB.FindClosestControlPoint(X); lbSelectedPoint.Text = "Selected point: " + SelectedPoint + "/" + this.InputRawDB.ControlPoints.Count + " total"; FillLine(); } }
private void btCalibrateWheel_Click(object sender, EventArgs e) { var ctlpt = this.InputRawDB.ControlPoints; CalibrateWheelForm calibwheel = new CalibrateWheelForm(); calibwheel.SelectedvJoyAxis = SelectedAxis; var res = calibwheel.ShowDialog(this); if (res == DialogResult.OK) { ctlpt.Clear(); double X = calibwheel.RawMostLeft / 4095.0; double Y = 0.0; // 0% ctlpt.Add(new System.Windows.Point(X, Y)); X = calibwheel.RawMostCenter / 4095.0; Y = 0.5; // 50% ctlpt.Add(new System.Windows.Point(X, Y)); X = calibwheel.RawMostRight / 4095.0; Y = 1.0; // 100% ctlpt.Add(new System.Windows.Point(X, Y)); this.InputRawDB.ControlPoints = ctlpt.OrderBy(p => p.X).ThenBy(p => p.Y).ToList <System.Windows.Point>(); SelectedPoint = InputRawDB.FindClosestControlPoint(X); lbSelectedPoint.Text = "Selected point: " + SelectedPoint + "/" + this.InputRawDB.ControlPoints.Count + " total"; FillLine(); } }
private void btnWheelCalibrate_Click(object sender, EventArgs e) { CalibrateWheelForm calibwheel = new CalibrateWheelForm(); calibwheel.SelectedvJoyAxis = 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); } }