From 85aefb4ba131521595e48fe1a25f4db9a69e71e6 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Sun, 27 Sep 2020 23:04:29 -0400 Subject: add arg checks in wrapper minor changes to settings shape, requires driver reinstall add error handling to writer grapher changes: add prettier serialization + comments add elements for scale and separated limit/exp reset irrelevant (invisible) arg input before checks/write --- grapher/Models/AccelGUI.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'grapher/Models/AccelGUI.cs') diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index 1fff4c3..5b37e81 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -3,6 +3,7 @@ using grapher.Models.Mouse; using grapher.Models.Options; using grapher.Models.Serialized; using System; +using System.Drawing; using System.Windows.Forms; namespace grapher @@ -72,6 +73,8 @@ namespace grapher public void UpdateActiveSettingsFromFields() { + var driverSettings = Settings.RawAccelSettings.AccelerationSettings; + var settings = new DriverSettings { rotation = ApplyOptions.Rotation.Field.Data, @@ -82,13 +85,20 @@ namespace grapher }, combineMagnitudes = ApplyOptions.IsWhole, modes = ApplyOptions.GetModes(), - args = ApplyOptions.GetArgs(), - minimumTime = .4 + args = ApplyOptions.GetUpdatedArgs(ref driverSettings.args), + minimumTime = driverSettings.minimumTime }; WriteButtonDelay(); - Settings.UpdateActiveSettings(settings); - RefreshOnRead(); + SettingsErrors errors = Settings.TryUpdateActiveSettings(settings); + if (errors.Empty()) + { + RefreshOnRead(); + } + else + { + WriteButton.Text = "bad args"; + } } public void RefreshOnRead() @@ -126,7 +136,7 @@ namespace grapher { Timer buttonTimer = new Timer(); buttonTimer.Enabled = true; - buttonTimer.Interval = Convert.ToInt32(ManagedAccel.WriteDelay); + buttonTimer.Interval = Convert.ToInt32(DriverInterop.WriteDelayMs); buttonTimer.Tick += new System.EventHandler(OnButtonTimerTick); return buttonTimer; } -- cgit v1.2.3