Commit 9633130e 几米阳光

测高值修改。压紧轴点动时实时坐标更新

1 个父辈 9c7ba9f1
...@@ -310,7 +310,14 @@ namespace OnlineStore.ACSingleStore ...@@ -310,7 +310,14 @@ namespace OnlineStore.ACSingleStore
UpdateMiddlePosition(); UpdateMiddlePosition();
UpdateInOutPosition(); UpdateInOutPosition();
UpdateUpdownPosition(); UpdateUpdownPosition();
txtComPosition.Text = ShuoKeControls.GetLastPosition(compress_Slv).ToString(); ShuoKeInfo info = ShuoKeControls.GetLastPosition(compress_Slv);
txtComPosition.Text = info.LastPosition.ToString();
TimeSpan span = DateTime.Now - info.UpdateTime;
if (span.TotalSeconds > 1.5)
{
ShuoKeControls.GetABSPosition(compress_Slv);
}
} }
} }
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.txtSize = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.txtHeight = new System.Windows.Forms.TextBox(); this.txtHeight = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
...@@ -61,8 +63,9 @@ ...@@ -61,8 +63,9 @@
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.txtAI1 = new System.Windows.Forms.TextBox(); this.txtAI1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.txtSize = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout(); this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
...@@ -464,6 +467,9 @@ ...@@ -464,6 +467,9 @@
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.label13);
this.groupBox2.Controls.Add(this.label12);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.txtSize); this.groupBox2.Controls.Add(this.txtSize);
this.groupBox2.Controls.Add(this.label10); this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.txtHeight); this.groupBox2.Controls.Add(this.txtHeight);
...@@ -485,6 +491,29 @@ ...@@ -485,6 +491,29 @@
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "高度传感器"; this.groupBox2.Text = "高度传感器";
// //
// txtSize
//
this.txtSize.Enabled = false;
this.txtSize.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtSize.Location = new System.Drawing.Point(253, 116);
this.txtSize.MaxLength = 10;
this.txtSize.Name = "txtSize";
this.txtSize.Size = new System.Drawing.Size(71, 23);
this.txtSize.TabIndex = 256;
this.txtSize.Text = "0";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label10.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label10.Location = new System.Drawing.Point(179, 119);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(68, 17);
this.label10.TabIndex = 255;
this.label10.Text = "料盘尺寸:";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtHeight // txtHeight
// //
this.txtHeight.Enabled = false; this.txtHeight.Enabled = false;
...@@ -527,7 +556,7 @@ ...@@ -527,7 +556,7 @@
this.txtAIResult3.Location = new System.Drawing.Point(203, 82); this.txtAIResult3.Location = new System.Drawing.Point(203, 82);
this.txtAIResult3.MaxLength = 10; this.txtAIResult3.MaxLength = 10;
this.txtAIResult3.Name = "txtAIResult3"; this.txtAIResult3.Name = "txtAIResult3";
this.txtAIResult3.Size = new System.Drawing.Size(121, 23); this.txtAIResult3.Size = new System.Drawing.Size(93, 23);
this.txtAIResult3.TabIndex = 251; this.txtAIResult3.TabIndex = 251;
this.txtAIResult3.Text = "0"; this.txtAIResult3.Text = "0";
// //
...@@ -538,7 +567,7 @@ ...@@ -538,7 +567,7 @@
this.txtAIResult2.Location = new System.Drawing.Point(203, 53); this.txtAIResult2.Location = new System.Drawing.Point(203, 53);
this.txtAIResult2.MaxLength = 10; this.txtAIResult2.MaxLength = 10;
this.txtAIResult2.Name = "txtAIResult2"; this.txtAIResult2.Name = "txtAIResult2";
this.txtAIResult2.Size = new System.Drawing.Size(121, 23); this.txtAIResult2.Size = new System.Drawing.Size(93, 23);
this.txtAIResult2.TabIndex = 250; this.txtAIResult2.TabIndex = 250;
this.txtAIResult2.Text = "0"; this.txtAIResult2.Text = "0";
// //
...@@ -549,7 +578,7 @@ ...@@ -549,7 +578,7 @@
this.txtAIResult1.Location = new System.Drawing.Point(203, 24); this.txtAIResult1.Location = new System.Drawing.Point(203, 24);
this.txtAIResult1.MaxLength = 10; this.txtAIResult1.MaxLength = 10;
this.txtAIResult1.Name = "txtAIResult1"; this.txtAIResult1.Name = "txtAIResult1";
this.txtAIResult1.Size = new System.Drawing.Size(121, 23); this.txtAIResult1.Size = new System.Drawing.Size(93, 23);
this.txtAIResult1.TabIndex = 249; this.txtAIResult1.TabIndex = 249;
this.txtAIResult1.Text = "0"; this.txtAIResult1.Text = "0";
// //
...@@ -622,28 +651,41 @@ ...@@ -622,28 +651,41 @@
this.label1.Text = "1:"; this.label1.Text = "1:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// txtSize // label11
// //
this.txtSize.Enabled = false; this.label11.AutoSize = true;
this.txtSize.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label11.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtSize.Location = new System.Drawing.Point(253, 116); this.label11.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.txtSize.MaxLength = 10; this.label11.Location = new System.Drawing.Point(297, 27);
this.txtSize.Name = "txtSize"; this.label11.Name = "label11";
this.txtSize.Size = new System.Drawing.Size(71, 23); this.label11.Size = new System.Drawing.Size(30, 17);
this.txtSize.TabIndex = 256; this.label11.TabIndex = 257;
this.txtSize.Text = "0"; this.label11.Text = "mm";
// this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// label10 //
// // label12
this.label10.AutoSize = true; //
this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label12.AutoSize = true;
this.label10.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label10.Location = new System.Drawing.Point(179, 119); this.label12.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label10.Name = "label10"; this.label12.Location = new System.Drawing.Point(297, 56);
this.label10.Size = new System.Drawing.Size(68, 17); this.label12.Name = "label12";
this.label10.TabIndex = 255; this.label12.Size = new System.Drawing.Size(30, 17);
this.label10.Text = "料盘尺寸:"; this.label12.TabIndex = 258;
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label12.Text = "mm";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label13
//
this.label13.AutoSize = true;
this.label13.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label13.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label13.Location = new System.Drawing.Point(297, 85);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(30, 17);
this.label13.TabIndex = 259;
this.label13.Text = "mm";
this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// FrmIOStatus // FrmIOStatus
// //
...@@ -723,6 +765,9 @@ ...@@ -723,6 +765,9 @@
private System.Windows.Forms.TextBox txtHeight; private System.Windows.Forms.TextBox txtHeight;
private System.Windows.Forms.TextBox txtSize; private System.Windows.Forms.TextBox txtSize;
private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label12;
} }
} }
...@@ -95,6 +95,7 @@ namespace OnlineStore.ACSingleStore ...@@ -95,6 +95,7 @@ namespace OnlineStore.ACSingleStore
private void FrmTest_FormClosing(object sender, FormClosingEventArgs e) private void FrmTest_FormClosing(object sender, FormClosingEventArgs e)
{ {
KNDAIManager.NeedReadAI = false ;
try try
{ {
if (this.timer1.Enabled) if (this.timer1.Enabled)
...@@ -155,6 +156,7 @@ namespace OnlineStore.ACSingleStore ...@@ -155,6 +156,7 @@ namespace OnlineStore.ACSingleStore
private void FrmStoreIOStatus_Load(object sender, EventArgs e) private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{ {
KNDAIManager.NeedReadAI = true;
} }
private void cmbWriteIO_DrawItem(object sender, DrawItemEventArgs e) private void cmbWriteIO_DrawItem(object sender, DrawItemEventArgs e)
......
...@@ -72,7 +72,10 @@ ...@@ -72,7 +72,10 @@
20190508修改 20190508修改
伺服回原点时若原点亮且未回过原点,需要匀速运动。 伺服回原点时若原点亮且未回过原点,需要匀速运动。
20190531:
测高计算修改。
bug修改:压紧轴点动时实时坐标更新。
......
...@@ -273,14 +273,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -273,14 +273,14 @@ namespace OnlineStore.DeviceLibrary
return info; return info;
} }
public static int GetLastPosition(int slvAddr) public static ShuoKeInfo GetLastPosition(int slvAddr)
{ {
if (shuokeMap.ContainsKey(slvAddr)) if (shuokeMap.ContainsKey(slvAddr))
{ {
ShuoKeInfo info = shuokeMap[slvAddr]; ShuoKeInfo info = shuokeMap[slvAddr];
return info.LastPosition; return info;
} }
return -1; return null;
} }
#endregion #endregion
......
...@@ -1581,22 +1581,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -1581,22 +1581,23 @@ namespace OnlineStore.DeviceLibrary
} }
double ai1Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, Config.AIDI1_Addr), Config.AIDI1_DefaultPosition); double ai1Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, Config.AIDI1_Addr), Config.AIDI1_DefaultPosition);
double ai2Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, Config.AIDI2_Addr), Config.AIDI2_DefaultPosition); double ai2Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, Config.AIDI2_Addr), Config.AIDI2_DefaultPosition);
double Value = Math.Round((ai1Value + ai2Value ) / 2, 1); double Value = Math.Round(ai1Value > ai2Value ? ai1Value : ai2Value, 1);
if (Value > 14) //double Value = Math.Round((ai1Value + ai2Value) / 2, 1);
if (Value >= 13)
{ {
result = 16; result = 16;
} }
else if (Value >= 10) else if (Value >= 9)
{ {
result = 12; result = 12;
} }
else if (Value >= 4) else if (Value >= 4)
{ {
if (ai1Value >= 9 || ai2Value >= 9 ) //if (ai1Value >= 9 || ai2Value >= 9)
{ //{
result = 12; // result = 12;
} //}
else //else
{ {
result = 8; result = 8;
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!