Skip to content

Commit

Permalink
Merge pull request #32 from asterics/driftCompensation
Browse files Browse the repository at this point in the history
Drift compensation
  • Loading branch information
ChrisVeigl authored Jun 4, 2020
2 parents b54d7cb + 8792e0f commit 56b854f
Show file tree
Hide file tree
Showing 12 changed files with 4,202 additions and 3,995 deletions.
24 changes: 12 additions & 12 deletions FLipMouseGUI/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ AT CA calibration of zeropoint
AT TP <uint> treshold for puff action (512-1023)
AT SP <uint> treshold for strong puff (512-1023)
AT SS <uint> treshold for strong sip (0-512)
AT GU <uint> gain for up sensor (0-100)
AT GD <uint> gain for down sensor (0-100)
AT GL <uint> gain for left sensor (0-100)
AT GR <uint> gain for right sensor (0-100)
AT GV <uint> gain vertical drift compensation (0-100)
AT RV <uint> range vertical drift compensation (0-100)
AT GH <uint> gain horizontal drift compensation (0-100)
AT RH <uint> range horizontal drift compensation (0-100)
Infrared-specific commands:
Expand Down Expand Up @@ -251,10 +251,10 @@ public void initCommands()
allCommands.add(new Command("AT TP", PARTYPE_UINT, "Theshold Puff", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT SP", PARTYPE_UINT, "Threshold StrongPuff", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT SS", PARTYPE_UINT, "Threshold StrongSip", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT GU", PARTYPE_UINT, "Gain for Up Sensor", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT GD", PARTYPE_UINT, "Gain for Down Sensor", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT GL", PARTYPE_UINT, "Gain for Left Sensor", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT GR", PARTYPE_UINT, "Gain for Right Sensor", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT GV", PARTYPE_UINT, "gain vertical drift compensation", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT RV", PARTYPE_UINT, "range vertical drift compensation", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT GH", PARTYPE_UINT, "gain horizontal drift compensation", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT RH", PARTYPE_UINT, "range horizontal drift compensation", COMBOENTRY_NO, GUITYPE_SLIDER));
allCommands.add(new Command("AT IR", PARTYPE_STRING, "Record Infrared Command", COMBOENTRY_NO, GUITYPE_STANDARD));
allCommands.add(new Command("AT IP", PARTYPE_STRING, "Play Infrared Command", COMBOENTRY_YES, GUITYPE_IRSELECT));
allCommands.add(new Command("AT IH", PARTYPE_STRING, "Hold Infrared Command", COMBOENTRY_YES, GUITYPE_IRSELECT));
Expand Down Expand Up @@ -285,10 +285,10 @@ public void initCommandGuiLinks()
commandGuiLinks.Add(new CommandGuiLink("AT TP", puffThresholdBar, puffThresholdLabel, "525"));
commandGuiLinks.Add(new CommandGuiLink("AT SP", strongPuffThresholdBar, strongPuffThresholdLabel, "700"));
commandGuiLinks.Add(new CommandGuiLink("AT SS", strongSipThresholdBar, stongSipThresholdLabel , "300"));
commandGuiLinks.Add(new CommandGuiLink("AT GU", upGainBar, upGainLabel, "50"));
commandGuiLinks.Add(new CommandGuiLink("AT GD", downGainBar, downGainLabel, "50"));
commandGuiLinks.Add(new CommandGuiLink("AT GL", leftGainBar, leftGainLabel, "50"));
commandGuiLinks.Add(new CommandGuiLink("AT GR", rightGainBar, rightGainLabel, "50"));
commandGuiLinks.Add(new CommandGuiLink("AT GV", verticalDriftGainBar, verticalDriftGainLabel, "40"));
commandGuiLinks.Add(new CommandGuiLink("AT RV", verticalDriftRangeBar, verticalDriftRangeLabel, "20"));
commandGuiLinks.Add(new CommandGuiLink("AT GH", horizontalDriftGainBar, horizontalDriftGainLabel, "40"));
commandGuiLinks.Add(new CommandGuiLink("AT RH", horizontalDriftRangeBar, horizontalDriftRangeLabel, "20"));
commandGuiLinks.Add(new CommandGuiLink("AT MM", selectStick, selectJoystick, selectAlternative, "1"));
commandGuiLinks.Add(new CommandGuiLink("AT BM 01", Button1FunctionBox, Button1ParameterText, Button1NumericParameter, Button1ComboBox, "AT NE"));
commandGuiLinks.Add(new CommandGuiLink("AT BM 02", Button2FunctionBox, Button2ParameterText, Button2NumericParameter, Button2ComboBox, "AT NC "));
Expand Down
819 changes: 423 additions & 396 deletions FLipMouseGUI/MainGui.Designer.cs

Large diffs are not rendered by default.

168 changes: 138 additions & 30 deletions FLipMouseGUI/MainGui.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@



/*
FLipMouseGUI - Graphical user Interface for FlipMouse / FlipWare firmware
Expand Down Expand Up @@ -29,7 +29,7 @@ namespace MouseApp2
{
public partial class FLipMouseGUI : Form
{
const string VERSION_STRING = "2.8.3";
const string VERSION_STRING = "2.9";
const int MAX_KEYSTRING_LEN = 65;

const int SENS_CHANGE_STEP = 1;
Expand Down Expand Up @@ -1288,13 +1288,13 @@ private void decStrongSipThreshold_MouseHover(object sender, EventArgs e)

private void upGainBar_Scroll(object sender, EventArgs e)
{
upGainLabel.Text = upGainBar.Value.ToString();
verticalDriftGainLabel.Text = verticalDriftGainBar.Value.ToString();
}
private void incUpGain_Click(object sender, EventArgs e)
{
if (upGainBar.Value <= upGainBar.Maximum - GAIN_CHANGE_STEP)
upGainBar.Value += GAIN_CHANGE_STEP;
upGainLabel.Text = upGainBar.Value.ToString();
if (verticalDriftGainBar.Value <= verticalDriftGainBar.Maximum - GAIN_CHANGE_STEP)
verticalDriftGainBar.Value += GAIN_CHANGE_STEP;
verticalDriftGainLabel.Text = verticalDriftGainBar.Value.ToString();
}
private void incUpGain_MouseHover(object sender, EventArgs e)
{
Expand All @@ -1303,9 +1303,9 @@ private void incUpGain_MouseHover(object sender, EventArgs e)
}
private void decUpGain_Click(object sender, EventArgs e)
{
if (upGainBar.Value >= upGainBar.Minimum + GAIN_CHANGE_STEP)
upGainBar.Value -= GAIN_CHANGE_STEP;
upGainLabel.Text = upGainBar.Value.ToString();
if (verticalDriftGainBar.Value >= verticalDriftGainBar.Minimum + GAIN_CHANGE_STEP)
verticalDriftGainBar.Value -= GAIN_CHANGE_STEP;
verticalDriftGainLabel.Text = verticalDriftGainBar.Value.ToString();
}
private void decUpGain_MouseHover(object sender, EventArgs e)
{
Expand All @@ -1315,14 +1315,14 @@ private void decUpGain_MouseHover(object sender, EventArgs e)

private void downGainBar_Scroll(object sender, EventArgs e)
{
downGainLabel.Text = (100-downGainBar.Value).ToString();
verticalDriftRangeLabel.Text = (verticalDriftRangeBar.Value).ToString();

}
private void incDownGain_Click(object sender, EventArgs e)
{
if (downGainBar.Value >= downGainBar.Minimum + GAIN_CHANGE_STEP)
downGainBar.Value -= GAIN_CHANGE_STEP;
downGainLabel.Text = (100-downGainBar.Value).ToString();
if (verticalDriftRangeBar.Value <= verticalDriftRangeBar.Maximum - GAIN_CHANGE_STEP)
verticalDriftRangeBar.Value += GAIN_CHANGE_STEP;
verticalDriftRangeLabel.Text = (verticalDriftRangeBar.Value).ToString();
}
private void incDownGain_MouseHover(object sender, EventArgs e)
{
Expand All @@ -1331,9 +1331,9 @@ private void incDownGain_MouseHover(object sender, EventArgs e)
}
private void decDownGain_Click(object sender, EventArgs e)
{
if (downGainBar.Value <= downGainBar.Maximum - GAIN_CHANGE_STEP)
downGainBar.Value += GAIN_CHANGE_STEP;
downGainLabel.Text = (100-downGainBar.Value).ToString();
if (verticalDriftRangeBar.Value >= verticalDriftRangeBar.Minimum + GAIN_CHANGE_STEP)
verticalDriftRangeBar.Value -= GAIN_CHANGE_STEP;
verticalDriftRangeLabel.Text = (verticalDriftRangeBar.Value).ToString();
}
private void decDownGain_MouseHover(object sender, EventArgs e)
{
Expand All @@ -1343,13 +1343,13 @@ private void decDownGain_MouseHover(object sender, EventArgs e)

private void leftGainBar_Scroll(object sender, EventArgs e)
{
leftGainLabel.Text = leftGainBar.Value.ToString();
horizontalDriftGainLabel.Text = horizontalDriftGainBar.Value.ToString();
}
private void incLeftGain_Click(object sender, EventArgs e)
{
if (leftGainBar.Value <= leftGainBar.Maximum - GAIN_CHANGE_STEP)
leftGainBar.Value += GAIN_CHANGE_STEP;
leftGainLabel.Text = leftGainBar.Value.ToString();
if (horizontalDriftGainBar.Value <= horizontalDriftGainBar.Maximum - GAIN_CHANGE_STEP)
horizontalDriftGainBar.Value += GAIN_CHANGE_STEP;
horizontalDriftGainLabel.Text = horizontalDriftGainBar.Value.ToString();
}
private void incLeftGain_MouseHover(object sender, EventArgs e)
{
Expand All @@ -1358,9 +1358,9 @@ private void incLeftGain_MouseHover(object sender, EventArgs e)
}
private void decLeftGain_Click(object sender, EventArgs e)
{
if (leftGainBar.Value >= leftGainBar.Minimum + GAIN_CHANGE_STEP)
leftGainBar.Value -= GAIN_CHANGE_STEP;
leftGainLabel.Text = leftGainBar.Value.ToString();
if (horizontalDriftGainBar.Value >= horizontalDriftGainBar.Minimum + GAIN_CHANGE_STEP)
horizontalDriftGainBar.Value -= GAIN_CHANGE_STEP;
horizontalDriftGainLabel.Text = horizontalDriftGainBar.Value.ToString();
}
private void decLeftGain_MouseHover(object sender, EventArgs e)
{
Expand All @@ -1370,13 +1370,13 @@ private void decLeftGain_MouseHover(object sender, EventArgs e)

private void rightGainBar_Scroll(object sender, EventArgs e)
{
rightGainLabel.Text = rightGainBar.Value.ToString();
horizontalDriftRangeLabel.Text = horizontalDriftRangeBar.Value.ToString();
}
private void incRightGain_Click(object sender, EventArgs e)
{
if (rightGainBar.Value <= rightGainBar.Maximum - GAIN_CHANGE_STEP)
rightGainBar.Value += GAIN_CHANGE_STEP;
rightGainLabel.Text = rightGainBar.Value.ToString();
if (horizontalDriftRangeBar.Value <= horizontalDriftRangeBar.Maximum - GAIN_CHANGE_STEP)
horizontalDriftRangeBar.Value += GAIN_CHANGE_STEP;
horizontalDriftRangeLabel.Text = horizontalDriftRangeBar.Value.ToString();
}
private void incRightGain_MouseHover(object sender, EventArgs e)
{
Expand All @@ -1385,9 +1385,9 @@ private void incRightGain_MouseHover(object sender, EventArgs e)
}
private void decRightGain_Click(object sender, EventArgs e)
{
if (rightGainBar.Value >= rightGainBar.Minimum + GAIN_CHANGE_STEP)
rightGainBar.Value -= GAIN_CHANGE_STEP;
rightGainLabel.Text = rightGainBar.Value.ToString();
if (horizontalDriftRangeBar.Value >= horizontalDriftRangeBar.Minimum + GAIN_CHANGE_STEP)
horizontalDriftRangeBar.Value -= GAIN_CHANGE_STEP;
horizontalDriftRangeLabel.Text = horizontalDriftRangeBar.Value.ToString();
}
private void decRightGain_MouseHover(object sender, EventArgs e)
{
Expand Down Expand Up @@ -1515,5 +1515,113 @@ private void copy_stickactions_Click(object sender, EventArgs e)

}

private void showDriftCorrection_CheckedChanged(object sender, EventArgs e)
{
if (showDriftCorrection.Checked)
{
incVerticalDriftGain.Visible = true;
incVerticalDriftRange.Visible = true;
incHorizontalDriftRange.Visible = true;
incHorizontalDriftGain.Visible = true;
decVerticalDriftGain.Visible = true;
decVerticalDriftRange.Visible = true;
decHorizontalDriftRange.Visible = true;
decHorizontalDriftGain.Visible = true;
verticalDriftGainBar.Visible = true;
verticalDriftRangeBar.Visible = true;
horizontalDriftRangeBar.Visible = true;
horizontalDriftGainBar.Visible = true;
verticalDriftGainLabel.Visible = true;
verticalDriftGainCaption.Visible = true;
verticalDriftRangeLabel.Visible = true;
verticalDriftRangeCaption.Visible = true;
horizontalDriftGainLabel.Visible = true;
horizontalDriftGainCaption.Visible = true;
horizontalDriftRangeLabel.Visible = true;
horizontalDriftRangeCaption.Visible = true;

incVerticalDriftGain.Enabled = true;
incVerticalDriftRange.Enabled = true;
incHorizontalDriftRange.Enabled = true;
incHorizontalDriftGain.Enabled = true;
decVerticalDriftGain.Enabled = true;
decVerticalDriftRange.Enabled = true;
decHorizontalDriftRange.Enabled = true;
decHorizontalDriftGain.Enabled = true;
verticalDriftGainBar.Enabled = true;
verticalDriftRangeBar.Enabled = true;
horizontalDriftRangeBar.Enabled = true;
horizontalDriftGainBar.Enabled = true;
verticalDriftGainLabel.Enabled = true;
verticalDriftGainCaption.Enabled = true;
verticalDriftRangeLabel.Enabled = true;
verticalDriftRangeCaption.Enabled = true;
horizontalDriftGainLabel.Enabled = true;
horizontalDriftGainCaption.Enabled = true;
horizontalDriftRangeLabel.Enabled = true;
horizontalDriftRangeCaption.Enabled = true;

copy_driftCompensation.Visible = true;
copy_driftCompensation.Enabled = true;
}
else
{

incVerticalDriftGain.Visible = false;
incVerticalDriftRange.Visible = false;
incHorizontalDriftRange.Visible = false;
incHorizontalDriftGain.Visible = false;
decVerticalDriftGain.Visible = false;
decVerticalDriftRange.Visible = false;
decHorizontalDriftRange.Visible = false;
decHorizontalDriftGain.Visible = false;
verticalDriftGainBar.Visible = false;
verticalDriftRangeBar.Visible = false;
horizontalDriftRangeBar.Visible = false;
horizontalDriftGainBar.Visible = false;
verticalDriftGainLabel.Visible = false;
verticalDriftGainCaption.Visible = false;
verticalDriftRangeLabel.Visible = false;
verticalDriftRangeCaption.Visible = false;
horizontalDriftGainLabel.Visible = false;
horizontalDriftGainCaption.Visible = false;
horizontalDriftRangeLabel.Visible = false;
horizontalDriftRangeCaption.Visible = false;

incVerticalDriftGain.Enabled = false;
incVerticalDriftRange.Enabled = false;
incHorizontalDriftRange.Enabled = false;
incHorizontalDriftGain.Enabled = false;
decVerticalDriftGain.Enabled = false;
decVerticalDriftRange.Enabled = false;
decHorizontalDriftRange.Enabled = false;
decHorizontalDriftGain.Enabled = false;
verticalDriftGainBar.Enabled = false;
verticalDriftRangeBar.Enabled = false;
horizontalDriftRangeBar.Enabled = false;
horizontalDriftGainBar.Enabled = false;
verticalDriftGainLabel.Enabled = false;
verticalDriftGainCaption.Enabled = false;
verticalDriftRangeLabel.Enabled = false;
verticalDriftRangeCaption.Enabled = false;
horizontalDriftGainLabel.Enabled = false;
horizontalDriftGainCaption.Enabled = false;
horizontalDriftRangeLabel.Enabled = false;
horizontalDriftRangeCaption.Enabled = false;

copy_driftCompensation.Visible = false;
copy_driftCompensation.Enabled = false;
}

}

private void copy_driftCompensation_Click(object sender, EventArgs e)
{
storeSlot(actSlot);
copyToAllSlots(actSlot, "AT GV");
copyToAllSlots(actSlot, "AT RV");
copyToAllSlots(actSlot, "AT GH");
copyToAllSlots(actSlot, "AT RH");
}
}
}
Loading

0 comments on commit 56b854f

Please sign in to comment.