From 99e58acc46365fd5edc72d9b6b2ba90a94f54a4b Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Sun, 27 Sep 2020 00:53:19 -0700 Subject: Fix for second dot not clearing: --- grapher/Models/Charts/ChartState/CombinedState.cs | 4 ++++ grapher/Models/Charts/ChartState/XYTwoGraphState.cs | 4 ++++ grapher/Models/Charts/ChartXY.cs | 5 +++++ 3 files changed, 13 insertions(+) (limited to 'grapher/Models') diff --git a/grapher/Models/Charts/ChartState/CombinedState.cs b/grapher/Models/Charts/ChartState/CombinedState.cs index f4b6b8f..802c392 100644 --- a/grapher/Models/Charts/ChartState/CombinedState.cs +++ b/grapher/Models/Charts/ChartState/CombinedState.cs @@ -24,6 +24,10 @@ namespace grapher.Models.Charts.ChartState SensitivityChart.SetCombined(); VelocityChart.SetCombined(); GainChart.SetCombined(); + + SensitivityChart.ClearSecondDots(); + VelocityChart.ClearSecondDots(); + GainChart.ClearSecondDots(); } public override void MakeDots(int x, int y, double timeInMs) diff --git a/grapher/Models/Charts/ChartState/XYTwoGraphState.cs b/grapher/Models/Charts/ChartState/XYTwoGraphState.cs index b775853..017d3d1 100644 --- a/grapher/Models/Charts/ChartState/XYTwoGraphState.cs +++ b/grapher/Models/Charts/ChartState/XYTwoGraphState.cs @@ -45,6 +45,10 @@ namespace grapher.Models.Charts.ChartState SensitivityChart.SetSeparate(); VelocityChart.SetSeparate(); GainChart.SetSeparate(); + + SensitivityChart.ClearSecondDots(); + VelocityChart.ClearSecondDots(); + GainChart.ClearSecondDots(); } public override void MakeDots(int x, int y, double timeInMs) diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index d95c7ac..27b63b5 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -154,6 +154,11 @@ namespace grapher */ } + public void ClearSecondDots() + { + ChartX.Series[3].Points.Clear(); + } + public void Update() { ChartX.Update(); -- cgit v1.2.3 From 7ccdb78b8c059de31e5b568b43f4547142d9aeb4 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Sun, 27 Sep 2020 21:42:48 -0700 Subject: Handle errors from bad arg on write --- grapher/Models/AccelGUI.cs | 3 +-- grapher/Models/Serialized/SettingsManager.cs | 29 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'grapher/Models') diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index c9c4ed0..15a0c0e 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -3,7 +3,6 @@ using grapher.Models.Mouse; using grapher.Models.Options; using grapher.Models.Serialized; using System; -using System.Drawing; using System.Windows.Forms; namespace grapher @@ -97,7 +96,7 @@ namespace grapher } else { - WriteButton.Text = "bad args"; + throw new Exception($"Bad arguments: \n {SettingsManager.ErrorStringFrom(errors)}"); } } diff --git a/grapher/Models/Serialized/SettingsManager.cs b/grapher/Models/Serialized/SettingsManager.cs index 93cf42b..416823e 100644 --- a/grapher/Models/Serialized/SettingsManager.cs +++ b/grapher/Models/Serialized/SettingsManager.cs @@ -2,6 +2,7 @@ using System; using System.Windows.Forms; using System.Threading; +using System.Text; namespace grapher.Models.Serialized { @@ -47,6 +48,34 @@ namespace grapher.Models.Serialized #region Methods + public static string ErrorStringFrom(SettingsErrors errors) + { + StringBuilder builder = new StringBuilder(); + bool yPresent = errors.y?.Count > 0; + + if (yPresent) + { + builder.AppendLine("\nx:"); + } + + foreach (var error in errors.x) + { + builder.AppendLine(error); + } + + if (yPresent) + { + builder.AppendLine("\ny:"); + + foreach (var error in errors.y) + { + builder.AppendLine(error); + } + } + + return builder.ToString(); + } + public SettingsErrors TryUpdateActiveSettings(DriverSettings settings) { var errors = TryUpdateAccel(settings); -- cgit v1.2.3 From 554422cb1f2271252e35b1ace297864a4553abba Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Sun, 27 Sep 2020 22:30:50 -0700 Subject: Fix legacy offset bugs --- grapher/Models/Options/OffsetOptions.cs | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'grapher/Models') diff --git a/grapher/Models/Options/OffsetOptions.cs b/grapher/Models/Options/OffsetOptions.cs index c6bee75..6638ed7 100644 --- a/grapher/Models/Options/OffsetOptions.cs +++ b/grapher/Models/Options/OffsetOptions.cs @@ -31,33 +31,11 @@ namespace grapher.Models.Options public bool IsLegacy { get; private set; } - public double LegacyOffset - { - get - { - if (IsLegacy) - { - return OffsetOption.Field.Data; - } - else - { - return 0; - } - } - } - public double Offset { get { - if (IsLegacy) - { - return 0; - } - else - { - return OffsetOption.Field.Data; - } + return OffsetOption.Field.Data; } } @@ -131,6 +109,9 @@ namespace grapher.Models.Options public void SetActiveValue(double offset, bool legacy) { OffsetOption.SetActiveValue(offset); + + VelocityGainOffsetCheck.Checked = !legacy; + LegacyOffsetCheck.Checked = legacy; } public override void AlignActiveValues() -- cgit v1.2.3