diff options
| author | Jacob Palecki <[email protected]> | 2020-09-17 00:18:52 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-17 00:18:52 -0700 |
| commit | efa60a8f0a340b320517096e4def497669b187cd (patch) | |
| tree | 5306c626256c9f33de11daaaa43294dbd76bd01a | |
| parent | Unsure if I will use this (diff) | |
| parent | Fix chart scaling for DPIs < 1200 (diff) | |
| download | rawaccel-efa60a8f0a340b320517096e4def497669b187cd.tar.xz rawaccel-efa60a8f0a340b320517096e4def497669b187cd.zip | |
Merge branch 'GUI' into Unsure
| -rw-r--r-- | driver/driver.vcxproj | 1 | ||||
| -rw-r--r-- | grapher/Layouts/PowerLayout.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/Calculations/AccelCalculator.cs | 10 | ||||
| -rw-r--r-- | grapher/Models/Options/CapOptions.cs | 12 |
4 files changed, 15 insertions, 10 deletions
diff --git a/driver/driver.vcxproj b/driver/driver.vcxproj index 9ebcf31..bee36c4 100644 --- a/driver/driver.vcxproj +++ b/driver/driver.vcxproj @@ -108,6 +108,7 @@ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <FloatingPointModel>Precise</FloatingPointModel> <CallingConvention>StdCall</CallingConvention> + <Optimization>MaxSpeed</Optimization> </ClCompile> <Link> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> diff --git a/grapher/Layouts/PowerLayout.cs b/grapher/Layouts/PowerLayout.cs index e0dcaf8..2004f23 100644 --- a/grapher/Layouts/PowerLayout.cs +++ b/grapher/Layouts/PowerLayout.cs @@ -14,7 +14,7 @@ namespace grapher.Layouts CapLayout = new OptionLayout(true, Cap); WeightLayout = new OptionLayout(true, Weight); OffsetLayout = new OptionLayout(true, Offset); - LimExpLayout = new OptionLayout(true, Limit); + LimExpLayout = new OptionLayout(true, Exponent); MidpointLayout = new OptionLayout(false, string.Empty); } } diff --git a/grapher/Models/Calculations/AccelCalculator.cs b/grapher/Models/Calculations/AccelCalculator.cs index 092a7aa..4627732 100644 --- a/grapher/Models/Calculations/AccelCalculator.cs +++ b/grapher/Models/Calculations/AccelCalculator.cs @@ -46,6 +46,8 @@ namespace grapher.Models.Calculations private double XYMaxVelocity { get; set; } private int Increment { get; set; } + + private double MeasurementTime { get; set; } #endregion Fields @@ -62,14 +64,14 @@ namespace grapher.Models.Calculations Calculate(data.Y, accel, settings.sensitivity.y, MagnitudesY); } - public static void Calculate(AccelChartData data, ManagedAccel accel, double starter, ICollection<MagnitudeData> magnitudeData) + public void Calculate(AccelChartData data, ManagedAccel accel, double starter, ICollection<MagnitudeData> magnitudeData) { double lastInputMagnitude = 0; double lastOutputMagnitude = 0; foreach (var magnitudeDatum in magnitudeData) { - var output = accel.Accelerate(magnitudeDatum.x, magnitudeDatum.y, 1); + var output = accel.Accelerate(magnitudeDatum.x, magnitudeDatum.y, MeasurementTime); var outMagnitude = Magnitude(output.Item1, output.Item2); var ratio = magnitudeDatum.magnitude > 0 ? outMagnitude / magnitudeDatum.magnitude : starter; @@ -176,7 +178,9 @@ namespace grapher.Models.Calculations { var dpiPollFactor = DPI.Data / PollRate.Data; CombinedMaxVelocity = dpiPollFactor * Constants.MaxMultiplier; - Increment = (int)Math.Floor(CombinedMaxVelocity / Constants.Resolution); + var ratio = CombinedMaxVelocity / Constants.Resolution; + Increment = ratio > 1 ? (int) Math.Floor(ratio) : 1; + MeasurementTime = Increment == 1 ? 1 / ratio : 1; XYMaxVelocity = CombinedMaxVelocity * Constants.XYToCombinedRatio; MagnitudesCombined = GetMagnitudes(); MagnitudesX = GetMagnitudesX(); diff --git a/grapher/Models/Options/CapOptions.cs b/grapher/Models/Options/CapOptions.cs index 5e47d7b..c459c50 100644 --- a/grapher/Models/Options/CapOptions.cs +++ b/grapher/Models/Options/CapOptions.cs @@ -156,16 +156,16 @@ namespace grapher CapOption.ActiveValueLabel.FormatString = Constants.GainCapFormatString; CapOption.ActiveValueLabel.Prefix = "Gain"; CapOption.SetActiveValue(gainCap); - LegacyCapCheck.Checked = true; - VelocityGainCapCheck.Checked = false; + LegacyCapCheck.Checked = false; + VelocityGainCapCheck.Checked = true; } else { CapOption.ActiveValueLabel.FormatString = Constants.DefaultActiveValueFormatString; CapOption.ActiveValueLabel.Prefix = string.Empty; CapOption.SetActiveValue(sensCap); - LegacyCapCheck.Checked = false; - VelocityGainCapCheck.Checked = true; + LegacyCapCheck.Checked = true; + VelocityGainCapCheck.Checked = false; } } @@ -194,7 +194,7 @@ namespace grapher void OnSensitivityCapCheckedChange(object sender, EventArgs e) { - if (LegacyCapCheck.Checked == true) + if (LegacyCapCheck.Checked) { EnableSensitivityCap(); } @@ -202,7 +202,7 @@ namespace grapher void OnVelocityGainCapCheckedChange(object sender, EventArgs e) { - if (LegacyCapCheck.Checked == true) + if (VelocityGainCapCheck.Checked) { EnableVelocityGainCap(); } |