Skip to content

Commit

Permalink
No ding when enter key pressed in a textbox
Browse files Browse the repository at this point in the history
How come no one complained during all these years? I didn't have sound on my programming machine until now...
  • Loading branch information
jkuusama committed Oct 26, 2022
1 parent 12376ce commit f86616b
Show file tree
Hide file tree
Showing 6 changed files with 514 additions and 503 deletions.
46 changes: 46 additions & 0 deletions LitePlacer/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,52 @@ namespace LitePlacer

public partial class MySettings
{

// =================================================================================
/*
Duet3_xxx should be in Duet3Settings.cs in a
public partial class MySettings
{
}
block. Visual Studio bug doesn't allow that, so they are here. :-(
*/
public double Duet3_Xspeed { get; set; } = 200; // mm/s
public double Duet3_Yspeed { get; set; } = 200; // mm/s
public double Duet3_Zspeed { get; set; } = 50; // mm/s
public double Duet3_Aspeed { get; set; } = 200; // mm/s

public double Duet3_Xacc { get; set; } = 1000; // mm/s^2
public double Duet3_Yacc { get; set; } = 1000; // mm/s^2
public double Duet3_Zacc { get; set; } = 1000; // mm/s^2
public double Duet3_Aacc { get; set; } = 1000; // mm/s^2

public double Duet3_XTravelPerRev { get; set; } = 40; // mm
public double Duet3_YTravelPerRev { get; set; } = 40; // mm
public double Duet3_ZTravelPerRev { get; set; } = 8; // mm
public double Duet3_ATravelPerRev { get; set; } = 160; // deg

public double Duet3_XDegPerStep { get; set; } = 0.9; // mm
public double Duet3_YDegPerStep { get; set; } = 0.9; // mm
public double Duet3_ZDegPerStep { get; set; } = 1.8; // mm
public double Duet3_ADegPerStep { get; set; } = 0.9; // mm

public int Duet3_XMicroStep { get; set; } = 16;
public int Duet3_YMicroStep { get; set; } = 16;
public int Duet3_ZMicroStep { get; set; } = 16;
public int Duet3_AMicroStep { get; set; } = 16;

public bool Duet3_XInterpolate { get; set; } = true;
public bool Duet3_YInterpolate { get; set; } = true;
public bool Duet3_ZInterpolate { get; set; } = true;
public bool Duet3_AInterpolate { get; set; } = true;

public int Duet3_XCurrent { get; set; } = 1100; //mA
public int Duet3_YCurrent { get; set; } = 1200; //mA
public int Duet3_ZCurrent { get; set; } = 1300; //mA
public int Duet3_ACurrent { get; set; } = 400; //mA
// =================================================================================


public bool Cam_ShowPixels { get; set; } = false;
public bool Cameras_KeepActive { get; set; } = false;
public bool Cameras_RobustSwitch { get; set; } = false;
Expand Down
71 changes: 26 additions & 45 deletions LitePlacer/Duet3Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,11 @@ namespace LitePlacer
// This file has things that are related to Duet 3 control board settings, UI, their storage and retrieval.
//

// For settings, see AppSettings.cs (VS bug prevents having the settings here.
public partial class FormMain
{
public double Duet3_Xspeed { get; set; } = 200; // mm/s
public double Duet3_Yspeed { get; set; } = 200; // mm/s
public double Duet3_Zspeed { get; set; } = 50; // mm/s
public double Duet3_Aspeed { get; set; } = 200; // mm/s

public double Duet3_Xacc { get; set; } = 1000; // mm/s^2
public double Duet3_Yacc { get; set; } = 1000; // mm/s^2
public double Duet3_Zacc { get; set; } = 1000; // mm/s^2
public double Duet3_Aacc { get; set; } = 1000; // mm/s^2

public double Duet3_XTravelPerRev { get; set; } = 40; // mm
public double Duet3_YTravelPerRev { get; set; } = 40; // mm
public double Duet3_ZTravelPerRev { get; set; } = 8; // mm
public double Duet3_ATravelPerRev { get; set; } = 160; // deg

public double Duet3_XDegPerStep { get; set; } = 0.9; // mm
public double Duet3_YDegPerStep { get; set; } = 0.9; // mm
public double Duet3_ZDegPerStep { get; set; } = 1.8; // mm
public double Duet3_ADegPerStep { get; set; } = 0.9; // mm

public int Duet3_XMicroStep { get; set; } = 16;
public int Duet3_YMicroStep { get; set; } = 16;
public int Duet3_ZMicroStep { get; set; } = 16;
public int Duet3_AMicroStep { get; set; } = 16;

public bool Duet3_XInterpolate { get; set; } = true;
public bool Duet3_YInterpolate { get; set; } = true;
public bool Duet3_ZInterpolate { get; set; } = true;
public bool Duet3_AInterpolate { get; set; } = true;

public int Duet3_XCurrent { get; set; } = 1100; //mA
public int Duet3_YCurrent { get; set; } = 1200; //mA
public int Duet3_ZCurrent { get; set; } = 1300; //mA
public int Duet3_ACurrent { get; set; } = 400; //mA

// =================================================================================
// We can go directly to business. No need to go trough cnc class in motor settins,
// We can go directly to business. No need to go trough cnc class in motor settings,
// as they are visible only when the corresponding board is already found.
// Duet3 is owned by Cnc, so we do Cnc.Duet3.xxx(), not Cnc.xxx()

Expand All @@ -67,8 +33,6 @@ public partial class FormMain

public bool SetDuet3XmotorParameters()
{
/*
SettingDuet3XmotorParameters = true;

Duet3Xspeed_maskedTextBox.Text = Setting.Duet3_Xspeed.ToString();
if (!SetDuet3Xspeed(Setting.Duet3_Xspeed)) return false;
Expand All @@ -95,10 +59,7 @@ public bool SetDuet3XmotorParameters()
Duet3XCurrent_maskedTextBox.Text = Setting.Duet3_XCurrent.ToString();
SetDuet3Xcurr(Setting.Duet3_XCurrent);

SettingDuet3XmotorParameters = false;
return true;
*/
return false;
}


Expand All @@ -117,6 +78,7 @@ private void Duet3Xspeed_maskedTextBox_KeyPress(object sender, KeyPressEventArgs
SetDuet3Xspeed(speed);
Duet3Xspeed_maskedTextBox.ForeColor = Color.Black;
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -146,6 +108,7 @@ private void Duet3Xacceleration_maskedTextBox_KeyPress(object sender, KeyPressEv
SetDuet3Xacc(acc);
}
Duet3Xacceleration_maskedTextBox.ForeColor = Color.Black;
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -203,6 +166,7 @@ private void Duet3Xmicrosteps_maskedTextBox_KeyPress(object sender, KeyPressEven
Duet3Xmicrosteps_maskedTextBox.ForeColor = Color.Black;
}
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -267,6 +231,7 @@ private void Duet3XtravelPerRev_textBox_KeyPress(object sender, KeyPressEventArg
SetDuet3Xstepping();
Duet3XtravelPerRev_textBox.ForeColor = Color.Black;
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand All @@ -287,6 +252,7 @@ private void Duet3XCurrent_maskedTextBox_KeyPress(object sender, KeyPressEventAr
SetDuet3Xcurr(curr);
Duet3XCurrent_maskedTextBox.ForeColor = Color.Black;
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -361,6 +327,7 @@ private void Duet3Yspeed_maskedTextBox_KeyPress(object sender, KeyPressEventArgs
SetDuet3Yspeed(speed);
Duet3Yspeed_maskedTextBox.ForeColor = Color.Black;
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -390,6 +357,7 @@ private void Duet3Yacceleration_maskedTextBox_KeyPress(object sender, KeyPressEv
SetDuet3Yacc(acc);
}
Duet3Yacceleration_maskedTextBox.ForeColor = Color.Black;
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -447,6 +415,7 @@ private void Duet3Ymicrosteps_maskedTextBox_KeyPress(object sender, KeyPressEven
Duet3Ymicrosteps_maskedTextBox.ForeColor = Color.Black;
}
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -511,7 +480,8 @@ private void Duet3YtravelPerRev_textBox_KeyPress(object sender, KeyPressEventArg
SetDuet3Ystepping();
Duet3YtravelPerRev_textBox.ForeColor = Color.Black;
}
}
e.Handled = true; // supress the ding sound
}
*/
}

Expand All @@ -531,6 +501,7 @@ private void Duet3YCurrent_maskedTextBox_KeyPress(object sender, KeyPressEventAr
SetDuet3Ycurr(curr);
Duet3YCurrent_maskedTextBox.ForeColor = Color.Black;
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -605,6 +576,7 @@ private void Duet3Zspeed_maskedTextBox_KeyPress(object sender, KeyPressEventArgs
SetDuet3Zspeed(speed);
Duet3Zspeed_maskedTextBox.ForeColor = Color.Black;
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -634,6 +606,7 @@ private void Duet3Zacceleration_maskedTextBox_KeyPress(object sender, KeyPressEv
SetDuet3Zacc(acc);
}
Duet3Zacceleration_maskedTextBox.ForeColor = Color.Black;
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -691,7 +664,8 @@ private void Duet3Zmicrosteps_maskedTextBox_KeyPress(object sender, KeyPressEven
Duet3Zmicrosteps_maskedTextBox.ForeColor = Color.Black;
}
}
}
e.Handled = true; // supress the ding sound
}
*/
}

Expand Down Expand Up @@ -755,7 +729,8 @@ private void Duet3ZtravelPerRev_textBox_KeyPress(object sender, KeyPressEventArg
SetDuet3Zstepping();
Duet3ZtravelPerRev_textBox.ForeColor = Color.Black;
}
}
e.Handled = true; // supress the ding sound
}
*/
}

Expand All @@ -775,6 +750,7 @@ private void Duet3ZCurrent_maskedTextBox_KeyPress(object sender, KeyPressEventAr
SetDuet3Zcurr(curr);
Duet3ZCurrent_maskedTextBox.ForeColor = Color.Black;
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -849,6 +825,7 @@ private void Duet3Aspeed_maskedTextBox_KeyPress(object sender, KeyPressEventArgs
SetDuet3Aspeed(speed);
Duet3Aspeed_maskedTextBox.ForeColor = Color.Black;
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -878,6 +855,7 @@ private void Duet3Aacceleration_maskedTextBox_KeyPress(object sender, KeyPressEv
SetDuet3Aacc(acc);
}
Duet3Aacceleration_maskedTextBox.ForeColor = Color.Black;
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -935,6 +913,7 @@ private void Duet3Amicrosteps_maskedTextBox_KeyPress(object sender, KeyPressEven
Duet3Amicrosteps_maskedTextBox.ForeColor = Color.Black;
}
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand Down Expand Up @@ -999,6 +978,7 @@ private void Duet3AtravelPerRev_textBox_KeyPress(object sender, KeyPressEventArg
SetDuet3Astepping();
Duet3AtravelPerRev_textBox.ForeColor = Color.Black;
}
e.Handled = true; // supress the ding sound
}
*/
}
Expand All @@ -1019,7 +999,8 @@ private void Duet3ACurrent_maskedTextBox_KeyPress(object sender, KeyPressEventAr
SetDuet3Acurr(curr);
Duet3ACurrent_maskedTextBox.ForeColor = Color.Black;
}
}
e.Handled = true; // supress the ding sound
}
*/
}

Expand Down
Loading

0 comments on commit f86616b

Please sign in to comment.