summaryrefslogtreecommitdiff
path: root/grapher/Models/AccelGUI.cs
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-09-27 23:04:29 -0400
committera1xd <[email protected]>2020-09-27 23:04:29 -0400
commit85aefb4ba131521595e48fe1a25f4db9a69e71e6 (patch)
treef1c73a42b369f362a40ea251281d98ee02bf0a98 /grapher/Models/AccelGUI.cs
parentadd os detection to installer (diff)
downloadrawaccel-85aefb4ba131521595e48fe1a25f4db9a69e71e6.tar.xz
rawaccel-85aefb4ba131521595e48fe1a25f4db9a69e71e6.zip
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
Diffstat (limited to 'grapher/Models/AccelGUI.cs')
-rw-r--r--grapher/Models/AccelGUI.cs20
1 files changed, 15 insertions, 5 deletions
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;
}