summaryrefslogtreecommitdiff
path: root/grapher
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2020-09-04 01:15:12 -0700
committerJacob Palecki <[email protected]>2020-09-04 01:15:12 -0700
commit87ee655d3c0ba3cdb0ca71a1b66aeb02c8c6aa70 (patch)
treea2ca5c42352737e3dab48ec854c1cd068a282e46 /grapher
parentThe menus mostly work (diff)
parentMerge pull request #19 from JacobPalecki/gainOffset (diff)
downloadrawaccel-87ee655d3c0ba3cdb0ca71a1b66aeb02c8c6aa70.tar.xz
rawaccel-87ee655d3c0ba3cdb0ca71a1b66aeb02c8c6aa70.zip
Merge with master
Diffstat (limited to 'grapher')
-rw-r--r--grapher/Form1.Designer.cs353
-rw-r--r--grapher/Form1.cs7
-rw-r--r--grapher/Models/AccelGUI.cs11
-rw-r--r--grapher/Models/AccelGUIFactory.cs30
-rw-r--r--grapher/Models/Options/AccelOptionSet.cs13
-rw-r--r--grapher/Models/Options/CapOptions.cs26
-rw-r--r--grapher/Models/Options/OffsetOptions.cs124
-rw-r--r--grapher/Models/Serialized/DriverSettings.cs30
-rw-r--r--grapher/Models/Serialized/SettingsManager.cs24
-rw-r--r--grapher/grapher.csproj1
10 files changed, 399 insertions, 220 deletions
diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs
index af60be1..b78b450 100644
--- a/grapher/Form1.Designer.cs
+++ b/grapher/Form1.Designer.cs
@@ -30,30 +30,30 @@ namespace grapher
/// </summary>
private void InitializeComponent()
{
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea13 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- System.Windows.Forms.DataVisualization.Charting.Legend legend13 = new System.Windows.Forms.DataVisualization.Charting.Legend();
- System.Windows.Forms.DataVisualization.Charting.Series series25 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.Series series26 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea14 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- System.Windows.Forms.DataVisualization.Charting.Legend legend14 = new System.Windows.Forms.DataVisualization.Charting.Legend();
- System.Windows.Forms.DataVisualization.Charting.Series series27 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.Series series28 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea15 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- System.Windows.Forms.DataVisualization.Charting.Legend legend15 = new System.Windows.Forms.DataVisualization.Charting.Legend();
- System.Windows.Forms.DataVisualization.Charting.Series series29 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.Series series30 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea16 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- System.Windows.Forms.DataVisualization.Charting.Legend legend16 = new System.Windows.Forms.DataVisualization.Charting.Legend();
- System.Windows.Forms.DataVisualization.Charting.Series series31 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.Series series32 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea17 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- System.Windows.Forms.DataVisualization.Charting.Legend legend17 = new System.Windows.Forms.DataVisualization.Charting.Legend();
- System.Windows.Forms.DataVisualization.Charting.Series series33 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.Series series34 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea18 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- System.Windows.Forms.DataVisualization.Charting.Legend legend18 = new System.Windows.Forms.DataVisualization.Charting.Legend();
- System.Windows.Forms.DataVisualization.Charting.Series series35 = new System.Windows.Forms.DataVisualization.Charting.Series();
- System.Windows.Forms.DataVisualization.Charting.Series series36 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+ System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+ System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+ System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+ System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+ System.Windows.Forms.DataVisualization.Charting.Legend legend3 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+ System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+ System.Windows.Forms.DataVisualization.Charting.Legend legend4 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+ System.Windows.Forms.DataVisualization.Charting.Series series7 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.Series series8 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea5 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+ System.Windows.Forms.DataVisualization.Charting.Legend legend5 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+ System.Windows.Forms.DataVisualization.Charting.Series series9 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.Series series10 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+ System.Windows.Forms.DataVisualization.Charting.Legend legend6 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+ System.Windows.Forms.DataVisualization.Charting.Series series11 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ System.Windows.Forms.DataVisualization.Charting.Series series12 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.AccelerationChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.accelTypeDropX = new System.Windows.Forms.ComboBox();
this.sensitivityBoxX = new System.Windows.Forms.TextBox();
@@ -91,13 +91,16 @@ namespace grapher
this.ScaleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.advancedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.capStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.sensitivityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.velocityGainToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.gainCapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.legacyCapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.offsetStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.gainOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.legacyOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.startupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.AutoWriteMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.wholeVectorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.byVectorComponentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.startupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.AutoWriteMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AccelerationChartY = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.VelocityChartY = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.GainChartY = new System.Windows.Forms.DataVisualization.Charting.Chart();
@@ -145,25 +148,25 @@ namespace grapher
//
// AccelerationChart
//
- chartArea13.AxisX.Title = "Speed (counts/ms)";
- chartArea13.AxisY.Title = "Sensitivity (magnitude ratio)";
- chartArea13.Name = "ChartArea1";
- this.AccelerationChart.ChartAreas.Add(chartArea13);
- legend13.Name = "Legend1";
- this.AccelerationChart.Legends.Add(legend13);
+ chartArea1.AxisX.Title = "Speed (counts/ms)";
+ chartArea1.AxisY.Title = "Sensitivity (magnitude ratio)";
+ chartArea1.Name = "ChartArea1";
+ this.AccelerationChart.ChartAreas.Add(chartArea1);
+ legend1.Name = "Legend1";
+ this.AccelerationChart.Legends.Add(legend1);
this.AccelerationChart.Location = new System.Drawing.Point(432, 0);
this.AccelerationChart.Name = "AccelerationChart";
- series25.ChartArea = "ChartArea1";
- series25.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
- series25.Legend = "Legend1";
- series25.Name = "Accelerated Sensitivity";
- series26.ChartArea = "ChartArea1";
- series26.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
- series26.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- series26.Legend = "Legend1";
- series26.Name = "LastAccelVal";
- this.AccelerationChart.Series.Add(series25);
- this.AccelerationChart.Series.Add(series26);
+ series1.ChartArea = "ChartArea1";
+ series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+ series1.Legend = "Legend1";
+ series1.Name = "Accelerated Sensitivity";
+ series2.ChartArea = "ChartArea1";
+ series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
+ series2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ series2.Legend = "Legend1";
+ series2.Name = "LastAccelVal";
+ this.AccelerationChart.Series.Add(series1);
+ this.AccelerationChart.Series.Add(series2);
this.AccelerationChart.Size = new System.Drawing.Size(723, 328);
this.AccelerationChart.TabIndex = 0;
this.AccelerationChart.Text = "Sensitivity";
@@ -364,50 +367,50 @@ namespace grapher
//
// VelocityChart
//
- chartArea14.AxisX.Title = "Speed (count/ms)";
- chartArea14.AxisY.Title = "Output Speed (counts/ms)";
- chartArea14.Name = "ChartArea1";
- this.VelocityChart.ChartAreas.Add(chartArea14);
- legend14.Name = "Legend1";
- this.VelocityChart.Legends.Add(legend14);
+ chartArea2.AxisX.Title = "Speed (count/ms)";
+ chartArea2.AxisY.Title = "Output Speed (counts/ms)";
+ chartArea2.Name = "ChartArea1";
+ this.VelocityChart.ChartAreas.Add(chartArea2);
+ legend2.Name = "Legend1";
+ this.VelocityChart.Legends.Add(legend2);
this.VelocityChart.Location = new System.Drawing.Point(432, 334);
this.VelocityChart.Name = "VelocityChart";
- series27.ChartArea = "ChartArea1";
- series27.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
- series27.Legend = "Legend1";
- series27.Name = "Mouse Velocity";
- series28.ChartArea = "ChartArea1";
- series28.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
- series28.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- series28.Legend = "Legend1";
- series28.Name = "LastVelocityVal";
- this.VelocityChart.Series.Add(series27);
- this.VelocityChart.Series.Add(series28);
+ series3.ChartArea = "ChartArea1";
+ series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+ series3.Legend = "Legend1";
+ series3.Name = "Mouse Velocity";
+ series4.ChartArea = "ChartArea1";
+ series4.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
+ series4.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ series4.Legend = "Legend1";
+ series4.Name = "LastVelocityVal";
+ this.VelocityChart.Series.Add(series3);
+ this.VelocityChart.Series.Add(series4);
this.VelocityChart.Size = new System.Drawing.Size(723, 307);
this.VelocityChart.TabIndex = 28;
this.VelocityChart.Text = "chart1";
//
// GainChart
//
- chartArea15.AxisX.Title = "Speed (counts/ms)";
- chartArea15.AxisY.Title = "Slope of Velocity Chart";
- chartArea15.Name = "ChartArea1";
- this.GainChart.ChartAreas.Add(chartArea15);
- legend15.Name = "Legend1";
- this.GainChart.Legends.Add(legend15);
+ chartArea3.AxisX.Title = "Speed (counts/ms)";
+ chartArea3.AxisY.Title = "Slope of Velocity Chart";
+ chartArea3.Name = "ChartArea1";
+ this.GainChart.ChartAreas.Add(chartArea3);
+ legend3.Name = "Legend1";
+ this.GainChart.Legends.Add(legend3);
this.GainChart.Location = new System.Drawing.Point(432, 647);
this.GainChart.Name = "GainChart";
- series29.ChartArea = "ChartArea1";
- series29.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
- series29.Legend = "Legend1";
- series29.Name = "Velocity Gain";
- series30.ChartArea = "ChartArea1";
- series30.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
- series30.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- series30.Legend = "Legend1";
- series30.Name = "LastGainVal";
- this.GainChart.Series.Add(series29);
- this.GainChart.Series.Add(series30);
+ series5.ChartArea = "ChartArea1";
+ series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+ series5.Legend = "Legend1";
+ series5.Name = "Velocity Gain";
+ series6.ChartArea = "ChartArea1";
+ series6.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
+ series6.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ series6.Legend = "Legend1";
+ series6.Name = "LastGainVal";
+ this.GainChart.Series.Add(series5);
+ this.GainChart.Series.Add(series6);
this.GainChart.Size = new System.Drawing.Size(723, 309);
this.GainChart.TabIndex = 29;
this.GainChart.Text = "chart1";
@@ -490,6 +493,7 @@ namespace grapher
//
this.advancedToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.capStyleToolStripMenuItem,
+ this.offsetStyleToolStripMenuItem,
this.toolStripMenuItem1});
this.advancedToolStripMenuItem.Name = "advancedToolStripMenuItem";
this.advancedToolStripMenuItem.Size = new System.Drawing.Size(72, 20);
@@ -498,25 +502,63 @@ namespace grapher
// capStyleToolStripMenuItem
//
this.capStyleToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.sensitivityToolStripMenuItem,
- this.velocityGainToolStripMenuItem});
+ this.gainCapToolStripMenuItem,
+ this.legacyCapToolStripMenuItem});
this.capStyleToolStripMenuItem.Name = "capStyleToolStripMenuItem";
- this.capStyleToolStripMenuItem.Size = new System.Drawing.Size(163, 22);
+ this.capStyleToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.capStyleToolStripMenuItem.Text = "Cap Style";
//
- // sensitivityToolStripMenuItem
+ // gainCapToolStripMenuItem
+ //
+ this.gainCapToolStripMenuItem.Checked = true;
+ this.gainCapToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.gainCapToolStripMenuItem.Name = "gainCapToolStripMenuItem";
+ this.gainCapToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+ this.gainCapToolStripMenuItem.Text = "Gain (Default)";
+ //
+ // legacyCapToolStripMenuItem
+ //
+ this.legacyCapToolStripMenuItem.Name = "legacyCapToolStripMenuItem";
+ this.legacyCapToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+ this.legacyCapToolStripMenuItem.Text = "Legacy";
+ //
+ // offsetStyleToolStripMenuItem
+ //
+ this.offsetStyleToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.gainOffsetToolStripMenuItem,
+ this.legacyOffsetToolStripMenuItem});
+ this.offsetStyleToolStripMenuItem.Name = "offsetStyleToolStripMenuItem";
+ this.offsetStyleToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.offsetStyleToolStripMenuItem.Text = "Offset Style";
+ //
+ // gainOffsetToolStripMenuItem
+ //
+ this.gainOffsetToolStripMenuItem.Name = "gainOffsetToolStripMenuItem";
+ this.gainOffsetToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+ this.gainOffsetToolStripMenuItem.Text = "Gain (Default)";
//
- this.sensitivityToolStripMenuItem.Checked = true;
- this.sensitivityToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
- this.sensitivityToolStripMenuItem.Name = "sensitivityToolStripMenuItem";
- this.sensitivityToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
- this.sensitivityToolStripMenuItem.Text = "Sensitivity";
+ // legacyOffsetToolStripMenuItem
//
- // velocityGainToolStripMenuItem
+ this.legacyOffsetToolStripMenuItem.Name = "legacyOffsetToolStripMenuItem";
+ this.legacyOffsetToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+ this.legacyOffsetToolStripMenuItem.Text = "Legacy";
//
- this.velocityGainToolStripMenuItem.Name = "velocityGainToolStripMenuItem";
- this.velocityGainToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
- this.velocityGainToolStripMenuItem.Text = "Velocity Gain";
+ // startupToolStripMenuItem
+ //
+ this.startupToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.AutoWriteMenuItem});
+ this.startupToolStripMenuItem.Name = "startupToolStripMenuItem";
+ this.startupToolStripMenuItem.Size = new System.Drawing.Size(57, 20);
+ this.startupToolStripMenuItem.Text = "Startup";
+ //
+ // AutoWriteMenuItem
+ //
+ this.AutoWriteMenuItem.Checked = true;
+ this.AutoWriteMenuItem.CheckOnClick = true;
+ this.AutoWriteMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.AutoWriteMenuItem.Name = "AutoWriteMenuItem";
+ this.AutoWriteMenuItem.Size = new System.Drawing.Size(229, 22);
+ this.AutoWriteMenuItem.Text = "Apply Settings File on Startup";
//
// toolStripMenuItem1
//
@@ -542,94 +584,77 @@ namespace grapher
this.byVectorComponentToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.byVectorComponentToolStripMenuItem.Text = "By Component";
//
- // startupToolStripMenuItem
- //
- this.startupToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.AutoWriteMenuItem});
- this.startupToolStripMenuItem.Name = "startupToolStripMenuItem";
- this.startupToolStripMenuItem.Size = new System.Drawing.Size(57, 20);
- this.startupToolStripMenuItem.Text = "Startup";
- //
- // AutoWriteMenuItem
- //
- this.AutoWriteMenuItem.Checked = true;
- this.AutoWriteMenuItem.CheckOnClick = true;
- this.AutoWriteMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
- this.AutoWriteMenuItem.Name = "AutoWriteMenuItem";
- this.AutoWriteMenuItem.Size = new System.Drawing.Size(229, 22);
- this.AutoWriteMenuItem.Text = "Apply Settings File on Startup";
- //
// AccelerationChartY
//
- chartArea16.AxisX.Title = "Speed (counts/ms)";
- chartArea16.AxisY.Title = "Sensitivity (magnitude ratio)";
- chartArea16.Name = "ChartArea1";
- this.AccelerationChartY.ChartAreas.Add(chartArea16);
- legend16.Name = "Legend1";
- this.AccelerationChartY.Legends.Add(legend16);
+ chartArea4.AxisX.Title = "Speed (counts/ms)";
+ chartArea4.AxisY.Title = "Sensitivity (magnitude ratio)";
+ chartArea4.Name = "ChartArea1";
+ this.AccelerationChartY.ChartAreas.Add(chartArea4);
+ legend4.Name = "Legend1";
+ this.AccelerationChartY.Legends.Add(legend4);
this.AccelerationChartY.Location = new System.Drawing.Point(1161, 0);
this.AccelerationChartY.Name = "AccelerationChartY";
- series31.ChartArea = "ChartArea1";
- series31.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
- series31.Legend = "Legend1";
- series31.Name = "Accelerated Sensitivity";
- series32.ChartArea = "ChartArea1";
- series32.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
- series32.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- series32.Legend = "Legend1";
- series32.Name = "LastAccelVal";
- this.AccelerationChartY.Series.Add(series31);
- this.AccelerationChartY.Series.Add(series32);
+ series7.ChartArea = "ChartArea1";
+ series7.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+ series7.Legend = "Legend1";
+ series7.Name = "Accelerated Sensitivity";
+ series8.ChartArea = "ChartArea1";
+ series8.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
+ series8.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ series8.Legend = "Legend1";
+ series8.Name = "LastAccelVal";
+ this.AccelerationChartY.Series.Add(series7);
+ this.AccelerationChartY.Series.Add(series8);
this.AccelerationChartY.Size = new System.Drawing.Size(723, 328);
this.AccelerationChartY.TabIndex = 31;
this.AccelerationChartY.Text = "chart1";
//
// VelocityChartY
//
- chartArea17.AxisX.Title = "Speed (count/ms)";
- chartArea17.AxisY.Title = "Output Speed (counts/ms)";
- chartArea17.Name = "ChartArea1";
- this.VelocityChartY.ChartAreas.Add(chartArea17);
- legend17.Name = "Legend1";
- this.VelocityChartY.Legends.Add(legend17);
+ chartArea5.AxisX.Title = "Speed (count/ms)";
+ chartArea5.AxisY.Title = "Output Speed (counts/ms)";
+ chartArea5.Name = "ChartArea1";
+ this.VelocityChartY.ChartAreas.Add(chartArea5);
+ legend5.Name = "Legend1";
+ this.VelocityChartY.Legends.Add(legend5);
this.VelocityChartY.Location = new System.Drawing.Point(1161, 334);
this.VelocityChartY.Name = "VelocityChartY";
- series33.ChartArea = "ChartArea1";
- series33.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
- series33.Legend = "Legend1";
- series33.Name = "Mouse Velocity";
- series34.ChartArea = "ChartArea1";
- series34.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
- series34.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- series34.Legend = "Legend1";
- series34.Name = "LastVelocityVal";
- this.VelocityChartY.Series.Add(series33);
- this.VelocityChartY.Series.Add(series34);
+ series9.ChartArea = "ChartArea1";
+ series9.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+ series9.Legend = "Legend1";
+ series9.Name = "Mouse Velocity";
+ series10.ChartArea = "ChartArea1";
+ series10.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
+ series10.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ series10.Legend = "Legend1";
+ series10.Name = "LastVelocityVal";
+ this.VelocityChartY.Series.Add(series9);
+ this.VelocityChartY.Series.Add(series10);
this.VelocityChartY.Size = new System.Drawing.Size(723, 307);
this.VelocityChartY.TabIndex = 32;
this.VelocityChartY.Text = "chart1";
//
// GainChartY
//
- chartArea18.AxisX.Title = "Speed (counts/ms)";
- chartArea18.AxisY.Title = "Slope of Velocity Chart";
- chartArea18.Name = "ChartArea1";
- this.GainChartY.ChartAreas.Add(chartArea18);
- legend18.Name = "Legend1";
- this.GainChartY.Legends.Add(legend18);
+ chartArea6.AxisX.Title = "Speed (counts/ms)";
+ chartArea6.AxisY.Title = "Slope of Velocity Chart";
+ chartArea6.Name = "ChartArea1";
+ this.GainChartY.ChartAreas.Add(chartArea6);
+ legend6.Name = "Legend1";
+ this.GainChartY.Legends.Add(legend6);
this.GainChartY.Location = new System.Drawing.Point(1161, 647);
this.GainChartY.Name = "GainChartY";
- series35.ChartArea = "ChartArea1";
- series35.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
- series35.Legend = "Legend1";
- series35.Name = "Velocity Gain";
- series36.ChartArea = "ChartArea1";
- series36.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
- series36.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
- series36.Legend = "Legend1";
- series36.Name = "LastGainVal";
- this.GainChartY.Series.Add(series35);
- this.GainChartY.Series.Add(series36);
+ series11.ChartArea = "ChartArea1";
+ series11.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+ series11.Legend = "Legend1";
+ series11.Name = "Velocity Gain";
+ series12.ChartArea = "ChartArea1";
+ series12.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
+ series12.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
+ series12.Legend = "Legend1";
+ series12.Name = "LastGainVal";
+ this.GainChartY.Series.Add(series11);
+ this.GainChartY.Series.Add(series12);
this.GainChartY.Size = new System.Drawing.Size(723, 309);
this.GainChartY.TabIndex = 33;
this.GainChartY.Text = "chart1";
@@ -1043,8 +1068,8 @@ namespace grapher
private System.Windows.Forms.ToolStripMenuItem showVelocityGainToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem advancedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem capStyleToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem sensitivityToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem velocityGainToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem gainCapToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem legacyCapToolStripMenuItem;
private System.Windows.Forms.DataVisualization.Charting.Chart AccelerationChartY;
private System.Windows.Forms.DataVisualization.Charting.Chart VelocityChartY;
private System.Windows.Forms.DataVisualization.Charting.Chart GainChartY;
@@ -1092,6 +1117,10 @@ namespace grapher
private System.Windows.Forms.Label OptionSetXTitle;
private System.Windows.Forms.Label OptionSetYTitle;
private System.Windows.Forms.Label AccelTypeActiveLabelY;
+ private System.Windows.Forms.ToolStripMenuItem offsetStyleToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem gainOffsetToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem legacyOffsetToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
}
}
diff --git a/grapher/Form1.cs b/grapher/Form1.cs
index 68a8a31..a4c32cd 100644
--- a/grapher/Form1.cs
+++ b/grapher/Form1.cs
@@ -57,8 +57,10 @@ namespace grapher
showVelocityGainToolStripMenuItem,
wholeVectorToolStripMenuItem,
byVectorComponentToolStripMenuItem,
- sensitivityToolStripMenuItem,
- velocityGainToolStripMenuItem,
+ gainCapToolStripMenuItem,
+ legacyCapToolStripMenuItem,
+ gainOffsetToolStripMenuItem,
+ legacyOffsetToolStripMenuItem,
AutoWriteMenuItem,
scaleByDPIToolStripMenuItem,
DPITextBox,
@@ -115,7 +117,6 @@ namespace grapher
OptionSetXTitle,
OptionSetYTitle,
MouseLabel);
-
}
#endregion Constructor
diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs
index 3a15d48..e9e925f 100644
--- a/grapher/Models/AccelGUI.cs
+++ b/grapher/Models/AccelGUI.cs
@@ -78,7 +78,7 @@ namespace grapher
public void UpdateActiveSettingsFromFields()
{
- Settings.UpdateActiveSettings(new DriverSettings
+ var settings = new DriverSettings
{
rotation = Rotation.Field.Data,
sensitivity = new Vec2<double>
@@ -90,6 +90,14 @@ namespace grapher
modes = ApplyOptions.GetModes(),
args = ApplyOptions.GetArgs(),
minimumTime = .4
+ };
+
+ Settings.UpdateActiveSettings(settings, () =>
+ {
+ AccelForm.Invoke((MethodInvoker)delegate
+ {
+ UpdateGraph();
+ });
});
RefreshOnRead();
}
@@ -117,7 +125,6 @@ namespace grapher
Sensitivity.SetActiveValues(settings.sensitivity.x, settings.sensitivity.y);
Rotation.SetActiveValue(settings.rotation);
ApplyOptions.SetActiveValues(settings);
-
}
private void OnScaleMenuItemClick(object sender, EventArgs e)
diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs
index 8ed4d72..230b64d 100644
--- a/grapher/Models/AccelGUIFactory.cs
+++ b/grapher/Models/AccelGUIFactory.cs
@@ -30,8 +30,10 @@ namespace grapher.Models
ToolStripMenuItem showVelocityGainToolStripMenuItem,
ToolStripMenuItem wholeVectorToolStripMenuItem,
ToolStripMenuItem byVectorComponentToolStripMenuItem,
- ToolStripMenuItem sensitivityToolStripMenuItem,
- ToolStripMenuItem velocityGainToolStripMenuItem,
+ ToolStripMenuItem velocityGainCapToolStripMenuItem,
+ ToolStripMenuItem legacyCapToolStripMenuItem,
+ ToolStripMenuItem gainOffsetToolStripMenuItem,
+ ToolStripMenuItem legacyOffsetToolStripMenuItem,
ToolStripMenuItem autoWriteMenuItem,
ToolStripMenuItem scaleMenuItem,
ToolStripTextBox dpiTextBox,
@@ -173,6 +175,16 @@ namespace grapher.Models
new ActiveValueLabel(offsetActiveLabelY, activeValueTitle),
"Offset");
+ var offsetOptionsX = new OffsetOptions(
+ gainOffsetToolStripMenuItem,
+ legacyOffsetToolStripMenuItem,
+ offsetX);
+
+ var offsetOptionsY = new OffsetOptions(
+ gainOffsetToolStripMenuItem,
+ legacyOffsetToolStripMenuItem,
+ offsetY);
+
// The name and layout of these options is handled by AccelerationOptions object.
var accelerationX = new Option(
new Field(accelerationBoxX, form, 0),
@@ -239,13 +251,13 @@ namespace grapher.Models
new ActiveValueLabel(accelTypeActiveLabelY, activeValueTitle));
var capOptionsX = new CapOptions(
- sensitivityToolStripMenuItem,
- velocityGainToolStripMenuItem,
+ velocityGainCapToolStripMenuItem,
+ legacyCapToolStripMenuItem,
capX);
var capOptionsY = new CapOptions(
- sensitivityToolStripMenuItem,
- velocityGainToolStripMenuItem,
+ velocityGainCapToolStripMenuItem,
+ legacyCapToolStripMenuItem,
capY);
var optionsSetX = new AccelOptionSet(
@@ -255,9 +267,9 @@ namespace grapher.Models
accelerationX,
capOptionsX,
weightX,
- offsetX,
+ offsetOptionsX,
limitOrExponentX,
- midpointX); ;
+ midpointX);
var optionsSetY = new AccelOptionSet(
optionSetYTitle,
@@ -266,7 +278,7 @@ namespace grapher.Models
accelerationY,
capOptionsY,
weightY,
- offsetY,
+ offsetOptionsY,
limitOrExponentY,
midpointY);
diff --git a/grapher/Models/Options/AccelOptionSet.cs b/grapher/Models/Options/AccelOptionSet.cs
index b1f85a9..838917c 100644
--- a/grapher/Models/Options/AccelOptionSet.cs
+++ b/grapher/Models/Options/AccelOptionSet.cs
@@ -17,7 +17,7 @@ namespace grapher.Models.Options
Option acceleration,
CapOptions cap,
Option weight,
- Option offset,
+ OffsetOptions offset,
Option limitOrExp,
Option midpoint)
{
@@ -50,7 +50,7 @@ namespace grapher.Models.Options
public Option Weight { get; }
- public Option Offset { get; }
+ public OffsetOptions Offset { get; }
public Option LimitOrExponent { get; }
@@ -126,7 +126,8 @@ namespace grapher.Models.Options
args.limit = LimitOrExponent.Field.Data;
args.exponent = LimitOrExponent.Field.Data;
args.powerExponent = LimitOrExponent.Field.Data;
- args.offset = Offset.Field.Data;
+ args.offset = Offset.Offset;
+ args.legacy_offset = Offset.LegacyOffset;
args.midpoint = Midpoint.Field.Data;
args.weight = Weight.Field.Data;
}
@@ -143,7 +144,7 @@ namespace grapher.Models.Options
AccelTypeOptions.SetActiveValue(mode);
Weight.SetActiveValue(args.weight);
Cap.SetActiveValues(args.gainCap, args.scaleCap, args.gainCap > 0);
- Offset.SetActiveValue(args.offset);
+ Offset.SetActiveValue(args.offset, args.legacy_offset);
Acceleration.SetActiveValue(args.accel);
LimitOrExponent.SetActiveValue(args.exponent);
Midpoint.SetActiveValue(args.midpoint);
@@ -155,8 +156,8 @@ namespace grapher.Models.Options
Acceleration.Top = AccelTypeOptions.Top + AccelTypeOptions.Height + Constants.OptionVerticalSeperation;
Cap.SnapTo(Acceleration);
Weight.SnapTo(Cap);
- Offset.SnapTo(Weight);
- LimitOrExponent.SnapTo(Offset);
+ Offset.OffsetOption.SnapTo(Weight);
+ LimitOrExponent.SnapTo(Offset.OffsetOption);
Midpoint.SnapTo(LimitOrExponent);
}
}
diff --git a/grapher/Models/Options/CapOptions.cs b/grapher/Models/Options/CapOptions.cs
index 713842c..6dc1116 100644
--- a/grapher/Models/Options/CapOptions.cs
+++ b/grapher/Models/Options/CapOptions.cs
@@ -18,29 +18,29 @@ namespace grapher
#region Constructors
public CapOptions(
- ToolStripMenuItem sensitivityCapCheck,
ToolStripMenuItem velocityGainCapCheck,
+ ToolStripMenuItem legacyCapCheck,
Option capOption)
{
- SensitivityCapCheck = sensitivityCapCheck;
VelocityGainCapCheck = velocityGainCapCheck;
+ LegacyCapCheck = legacyCapCheck;
CapOption = capOption;
- SensitivityCapCheck.Click += new System.EventHandler(OnSensitivityCapCheckClick);
+ LegacyCapCheck.Click += new System.EventHandler(OnSensitivityCapCheckClick);
VelocityGainCapCheck.Click += new System.EventHandler(OnVelocityGainCapCheckClick);
- SensitivityCapCheck.CheckedChanged += new System.EventHandler(OnSensitivityCapCheckedChange);
+ LegacyCapCheck.CheckedChanged += new System.EventHandler(OnSensitivityCapCheckedChange);
VelocityGainCapCheck.CheckedChanged += new System.EventHandler(OnVelocityGainCapCheckedChange);
- EnableSensitivityCap();
+ EnableVelocityGainCap();
}
#endregion Constructors
#region Properties
- public ToolStripMenuItem SensitivityCapCheck { get; }
+ public ToolStripMenuItem LegacyCapCheck { get; }
public ToolStripMenuItem VelocityGainCapCheck { get; }
@@ -124,7 +124,7 @@ namespace grapher
CapOption.ActiveValueLabel.FormatString = Constants.GainCapFormatString;
CapOption.ActiveValueLabel.Prefix = "Gain";
CapOption.SetActiveValue(gainCap);
- SensitivityCapCheck.Checked = true;
+ LegacyCapCheck.Checked = true;
VelocityGainCapCheck.Checked = false;
}
else
@@ -132,17 +132,17 @@ namespace grapher
CapOption.ActiveValueLabel.FormatString = Constants.DefaultActiveValueFormatString;
CapOption.ActiveValueLabel.Prefix = string.Empty;
CapOption.SetActiveValue(sensCap);
- SensitivityCapCheck.Checked = false;
+ LegacyCapCheck.Checked = false;
VelocityGainCapCheck.Checked = true;
}
}
void OnSensitivityCapCheckClick(object sender, EventArgs e)
{
- if (!SensitivityCapCheck.Checked)
+ if (!LegacyCapCheck.Checked)
{
VelocityGainCapCheck.Checked = false;
- SensitivityCapCheck.Checked = true;
+ LegacyCapCheck.Checked = true;
}
}
@@ -151,13 +151,13 @@ namespace grapher
if (!VelocityGainCapCheck.Checked)
{
VelocityGainCapCheck.Checked = true;
- SensitivityCapCheck.Checked = false;
+ LegacyCapCheck.Checked = false;
}
}
void OnSensitivityCapCheckedChange(object sender, EventArgs e)
{
- if (SensitivityCapCheck.Checked)
+ if (LegacyCapCheck.Checked == true)
{
EnableSensitivityCap();
}
@@ -165,7 +165,7 @@ namespace grapher
void OnVelocityGainCapCheckedChange(object sender, EventArgs e)
{
- if (SensitivityCapCheck.Checked)
+ if (LegacyCapCheck.Checked == true)
{
EnableVelocityGainCap();
}
diff --git a/grapher/Models/Options/OffsetOptions.cs b/grapher/Models/Options/OffsetOptions.cs
new file mode 100644
index 0000000..0b01ab9
--- /dev/null
+++ b/grapher/Models/Options/OffsetOptions.cs
@@ -0,0 +1,124 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace grapher.Models.Options
+{
+ public class OffsetOptions
+ {
+ public OffsetOptions(
+ ToolStripMenuItem velocityGainOffsetCheck,
+ ToolStripMenuItem legacyOffsetCheck,
+ Option offsetOption)
+ {
+ VelocityGainOffsetCheck = velocityGainOffsetCheck;
+ LegacyOffsetCheck = legacyOffsetCheck;
+ OffsetOption = offsetOption;
+
+ VelocityGainOffsetCheck.Click += new System.EventHandler(OnVelocityGainOffsetClick);
+ LegacyOffsetCheck.Click += new System.EventHandler(OnLegacyOffsetClick);
+
+ VelocityGainOffsetCheck.CheckedChanged += new System.EventHandler(OnVelocityGainOffsetCheckedChange);
+ LegacyOffsetCheck.CheckedChanged += new System.EventHandler(OnLegacyOffsetCheckedChange);
+
+ VelocityGainOffsetCheck.Checked = true;
+ }
+
+ public ToolStripMenuItem VelocityGainOffsetCheck { get; }
+
+ public ToolStripMenuItem LegacyOffsetCheck { get; }
+
+ public Option OffsetOption { get; }
+
+ 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;
+ }
+ }
+ }
+
+ public void SetActiveValue(double offset, double legacyOffset)
+ {
+ if (offset > 0)
+ {
+ OffsetOption.SetActiveValue(offset);
+ }
+ else
+ {
+ OffsetOption.SetActiveValue(legacyOffset);
+ }
+ }
+
+ public void OnVelocityGainOffsetClick(object sender, EventArgs e)
+ {
+ if (!VelocityGainOffsetCheck.Checked)
+ {
+ VelocityGainOffsetCheck.Checked = true;
+ LegacyOffsetCheck.Checked = false;
+ }
+ }
+
+ public void OnLegacyOffsetClick(object sender, EventArgs e)
+ {
+ if (!LegacyOffsetCheck.Checked)
+ {
+ LegacyOffsetCheck.Checked = true;
+ VelocityGainOffsetCheck.Checked = false;
+ }
+ }
+
+ public void OnVelocityGainOffsetCheckedChange(object sender, EventArgs e)
+ {
+ if (VelocityGainOffsetCheck.Checked)
+ {
+ EnableVelocityGainOffset();
+ }
+ }
+
+ public void OnLegacyOffsetCheckedChange(object sender, EventArgs e)
+ {
+ if (LegacyOffsetCheck.Checked)
+ {
+ EnableLegacyOffset();
+ }
+ }
+
+ public void EnableVelocityGainOffset()
+ {
+ IsLegacy = false;
+ }
+
+ public void EnableLegacyOffset()
+ {
+ IsLegacy = true;
+ }
+ }
+}
diff --git a/grapher/Models/Serialized/DriverSettings.cs b/grapher/Models/Serialized/DriverSettings.cs
index e0b5d4a..ecd4d51 100644
--- a/grapher/Models/Serialized/DriverSettings.cs
+++ b/grapher/Models/Serialized/DriverSettings.cs
@@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
+using System.Threading;
namespace grapher.Models.Serialized
{
@@ -18,6 +19,7 @@ namespace grapher.Models.Serialized
public struct AccelArgs
{
public double offset;
+ public double legacy_offset;
public double accel;
public double limit;
public double exponent;
@@ -47,6 +49,7 @@ namespace grapher.Models.Serialized
private static readonly IntPtr UnmanagedSettingsHandle =
Marshal.AllocHGlobal(Marshal.SizeOf<DriverSettings>());
+ private static object UnmanagedSettingsLock = new object();
public double rotation;
public bool combineMagnitudes;
@@ -65,21 +68,32 @@ namespace grapher.Models.Serialized
return Marshal.PtrToStructure<DriverSettings>(UnmanagedSettingsHandle);
}
- public static void SetActive(DriverSettings settings)
+ public static void SetActive(DriverSettings settings, Action<IntPtr> unmanagedActionBefore = null)
{
- Marshal.StructureToPtr(settings, UnmanagedSettingsHandle, false);
- DriverInterop.SetActiveSettings(UnmanagedSettingsHandle);
+ new Thread(() =>
+ {
+ lock (UnmanagedSettingsLock)
+ {
+ Marshal.StructureToPtr(settings, UnmanagedSettingsHandle, false);
+ unmanagedActionBefore?.Invoke(UnmanagedSettingsHandle);
+ DriverInterop.SetActiveSettings(UnmanagedSettingsHandle);
+ }
+ }).Start();
+
}
- public void SendToDriver()
+ public void SendToDriver(Action<IntPtr> unmanagedActionBefore = null)
{
- SetActive(this);
+ SetActive(this, unmanagedActionBefore);
}
- public void SendToDriverAndUpdate(ManagedAccel accel)
+ public void SendToDriverAndUpdate(ManagedAccel accel, Action betweenAccelAndWrite = null)
{
- SendToDriver();
- accel.UpdateFromSettings(UnmanagedSettingsHandle);
+ SendToDriver(settingsHandle =>
+ {
+ accel.UpdateFromSettings(settingsHandle);
+ betweenAccelAndWrite?.Invoke();
+ });
}
public bool verify()
diff --git a/grapher/Models/Serialized/SettingsManager.cs b/grapher/Models/Serialized/SettingsManager.cs
index 7f018cf..d7cf590 100644
--- a/grapher/Models/Serialized/SettingsManager.cs
+++ b/grapher/Models/Serialized/SettingsManager.cs
@@ -38,12 +38,10 @@ namespace grapher.Models.Serialized
#region Methods
- public void UpdateActiveSettings(DriverSettings settings)
+ public void UpdateActiveSettings(DriverSettings settings, Action afterAccelSettingsUpdate = null)
{
- try
+ settings.SendToDriverAndUpdate(ActiveAccel, () =>
{
- settings.SendToDriverAndUpdate(ActiveAccel);
-
RawAccelSettings.AccelerationSettings = settings;
RawAccelSettings.GUISettings = new GUISettings
{
@@ -53,23 +51,15 @@ namespace grapher.Models.Serialized
};
RawAccelSettings.Save();
- }
- catch (DriverWriteCDException)
- {
- Console.WriteLine("write on cooldown");
- }
+
+ afterAccelSettingsUpdate?.Invoke();
+ });
}
public void UpdateActiveAccelFromFileSettings(DriverSettings settings)
{
- try
- {
- settings.SendToDriverAndUpdate(ActiveAccel);
- }
- catch (DriverWriteCDException)
- {
- Console.WriteLine("write on cd during file init");
- }
+ settings.SendToDriverAndUpdate(ActiveAccel);
+
DpiField.SetToEntered(RawAccelSettings.GUISettings.DPI);
PollRateField.SetToEntered(RawAccelSettings.GUISettings.PollRate);
AutoWriteMenuItem.Checked = RawAccelSettings.GUISettings.AutoWriteToDriverOnStartup;
diff --git a/grapher/grapher.csproj b/grapher/grapher.csproj
index 8481e75..4717a8b 100644
--- a/grapher/grapher.csproj
+++ b/grapher/grapher.csproj
@@ -89,6 +89,7 @@
<Compile Include="Layouts\OffLayout.cs" />
<Compile Include="Layouts\PowerLayout.cs" />
<Compile Include="Layouts\SigmoidLayout.cs" />
+ <Compile Include="Models\Options\OffsetOptions.cs" />
<Compile Include="Models\Options\Option.cs" />
<Compile Include="Models\Options\OptionXY.cs" />
<Compile Include="Models\Serialized\GUISettings.cs" />