From b016e35f170a6e1a98d39f125762f97af677fd20 Mon Sep 17 00:00:00 2001
From: wells.liu <wells.liu@broconcentric.com>
Date: 星期一, 06 七月 2020 18:17:30 +0800
Subject: [PATCH] 板卡 运行 +操作界面
---
src/Bro.Device.GTSCard/GTSCardDriver.cs | 2
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs | 65 ++++++++++++
src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs | 11 -
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs | 196 ++++++++++++++++++++-------------------
4 files changed, 168 insertions(+), 106 deletions(-)
diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs
index 4a236b9..c2a4783 100644
--- a/src/Bro.Device.GTSCard/GTSCardDriver.cs
+++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -472,7 +472,7 @@
if (ret != (short)GTSRetCode.GRCRunOK)
{
- LogAsync(DateTime.Now, "杞�" + optionPara.AxisIndex + "APS_absolute_move寮傚父", "閿欒鐮侊細" + ret + ";" + "閲嶈瘯娆℃暟锛�" + repeatTime);
+ LogAsync(DateTime.Now, "杞�" + optionPara.AxisIndex + "JogMove寮傚父", "閿欒鐮侊細" + ret + ";" + "閲嶈瘯娆℃暟锛�" + repeatTime);
Thread.Sleep(10);
}
repeatTime--;
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs
index aa563fb..1bbcd47 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs
@@ -31,24 +31,24 @@
this.groupBoxAxisOperration = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.panel2 = new System.Windows.Forms.Panel();
- this.button3 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
+ this.buttonStop = new System.Windows.Forms.Button();
+ this.buttonStart = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
- this.textBox5 = new System.Windows.Forms.TextBox();
- this.textBox4 = new System.Windows.Forms.TextBox();
- this.textBox7 = new System.Windows.Forms.TextBox();
- this.textBox6 = new System.Windows.Forms.TextBox();
+ this.textBoxP2PVel = new System.Windows.Forms.TextBox();
+ this.textBoxP2PPrfPosition = new System.Windows.Forms.TextBox();
+ this.textBoxP2PDec = new System.Windows.Forms.TextBox();
+ this.textBoxP2PAcc = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
- this.button1 = new System.Windows.Forms.Button();
- this.textBox3 = new System.Windows.Forms.TextBox();
- this.buttonClearStatus = new System.Windows.Forms.Button();
- this.textBox2 = new System.Windows.Forms.TextBox();
+ this.buttonNegative = new System.Windows.Forms.Button();
+ this.textBoxJogDec = new System.Windows.Forms.TextBox();
+ this.buttonPositive = new System.Windows.Forms.Button();
+ this.textBoxJogAcc = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
- this.textBox1 = new System.Windows.Forms.TextBox();
+ this.textBoxJogVel = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
@@ -88,13 +88,13 @@
//
// panel2
//
- this.panel2.Controls.Add(this.button3);
- this.panel2.Controls.Add(this.button2);
+ this.panel2.Controls.Add(this.buttonStop);
+ this.panel2.Controls.Add(this.buttonStart);
this.panel2.Controls.Add(this.label1);
- this.panel2.Controls.Add(this.textBox5);
- this.panel2.Controls.Add(this.textBox4);
- this.panel2.Controls.Add(this.textBox7);
- this.panel2.Controls.Add(this.textBox6);
+ this.panel2.Controls.Add(this.textBoxP2PVel);
+ this.panel2.Controls.Add(this.textBoxP2PPrfPosition);
+ this.panel2.Controls.Add(this.textBoxP2PDec);
+ this.panel2.Controls.Add(this.textBoxP2PAcc);
this.panel2.Controls.Add(this.label7);
this.panel2.Controls.Add(this.label6);
this.panel2.Controls.Add(this.label9);
@@ -105,23 +105,25 @@
this.panel2.Size = new System.Drawing.Size(535, 58);
this.panel2.TabIndex = 3;
//
- // button3
+ // buttonStop
//
- this.button3.Location = new System.Drawing.Point(462, 31);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(70, 25);
- this.button3.TabIndex = 6;
- this.button3.Text = "鍋滄";
- this.button3.UseVisualStyleBackColor = true;
+ this.buttonStop.Location = new System.Drawing.Point(462, 31);
+ this.buttonStop.Name = "buttonStop";
+ this.buttonStop.Size = new System.Drawing.Size(70, 25);
+ this.buttonStop.TabIndex = 6;
+ this.buttonStop.Text = "鍋滄";
+ this.buttonStop.UseVisualStyleBackColor = true;
+ this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click);
//
- // button2
+ // buttonStart
//
- this.button2.Location = new System.Drawing.Point(462, 3);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(70, 25);
- this.button2.TabIndex = 6;
- this.button2.Text = "寮�濮�";
- this.button2.UseVisualStyleBackColor = true;
+ this.buttonStart.Location = new System.Drawing.Point(462, 3);
+ this.buttonStart.Name = "buttonStart";
+ this.buttonStart.Size = new System.Drawing.Size(70, 25);
+ this.buttonStart.TabIndex = 6;
+ this.buttonStart.Text = "寮�濮�";
+ this.buttonStart.UseVisualStyleBackColor = true;
+ this.buttonStart.Click += new System.EventHandler(this.buttonStart_Click);
//
// label1
//
@@ -136,33 +138,33 @@
this.label1.Text = "P2P妯″紡";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
- // textBox5
+ // textBoxP2PVel
//
- this.textBox5.Location = new System.Drawing.Point(154, 34);
- this.textBox5.Name = "textBox5";
- this.textBox5.Size = new System.Drawing.Size(116, 21);
- this.textBox5.TabIndex = 5;
+ this.textBoxP2PVel.Location = new System.Drawing.Point(154, 34);
+ this.textBoxP2PVel.Name = "textBoxP2PVel";
+ this.textBoxP2PVel.Size = new System.Drawing.Size(116, 21);
+ this.textBoxP2PVel.TabIndex = 5;
//
- // textBox4
+ // textBoxP2PPrfPosition
//
- this.textBox4.Location = new System.Drawing.Point(154, 4);
- this.textBox4.Name = "textBox4";
- this.textBox4.Size = new System.Drawing.Size(116, 21);
- this.textBox4.TabIndex = 5;
+ this.textBoxP2PPrfPosition.Location = new System.Drawing.Point(154, 4);
+ this.textBoxP2PPrfPosition.Name = "textBoxP2PPrfPosition";
+ this.textBoxP2PPrfPosition.Size = new System.Drawing.Size(116, 21);
+ this.textBoxP2PPrfPosition.TabIndex = 5;
//
- // textBox7
+ // textBoxP2PDec
//
- this.textBox7.Location = new System.Drawing.Point(340, 34);
- this.textBox7.Name = "textBox7";
- this.textBox7.Size = new System.Drawing.Size(116, 21);
- this.textBox7.TabIndex = 5;
+ this.textBoxP2PDec.Location = new System.Drawing.Point(340, 34);
+ this.textBoxP2PDec.Name = "textBoxP2PDec";
+ this.textBoxP2PDec.Size = new System.Drawing.Size(116, 21);
+ this.textBoxP2PDec.TabIndex = 5;
//
- // textBox6
+ // textBoxP2PAcc
//
- this.textBox6.Location = new System.Drawing.Point(340, 4);
- this.textBox6.Name = "textBox6";
- this.textBox6.Size = new System.Drawing.Size(116, 21);
- this.textBox6.TabIndex = 5;
+ this.textBoxP2PAcc.Location = new System.Drawing.Point(340, 4);
+ this.textBoxP2PAcc.Name = "textBoxP2PAcc";
+ this.textBoxP2PAcc.Size = new System.Drawing.Size(116, 21);
+ this.textBoxP2PAcc.TabIndex = 5;
//
// label7
//
@@ -202,12 +204,12 @@
//
// panel1
//
- this.panel1.Controls.Add(this.button1);
- this.panel1.Controls.Add(this.textBox3);
- this.panel1.Controls.Add(this.buttonClearStatus);
- this.panel1.Controls.Add(this.textBox2);
+ this.panel1.Controls.Add(this.buttonNegative);
+ this.panel1.Controls.Add(this.textBoxJogDec);
+ this.panel1.Controls.Add(this.buttonPositive);
+ this.panel1.Controls.Add(this.textBoxJogAcc);
this.panel1.Controls.Add(this.label5);
- this.panel1.Controls.Add(this.textBox1);
+ this.panel1.Controls.Add(this.textBoxJogVel);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.label2);
@@ -217,37 +219,39 @@
this.panel1.Size = new System.Drawing.Size(535, 58);
this.panel1.TabIndex = 2;
//
- // button1
+ // buttonNegative
//
- this.button1.Location = new System.Drawing.Point(462, 33);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(70, 25);
- this.button1.TabIndex = 6;
- this.button1.Text = "璐熷悜";
- this.button1.UseVisualStyleBackColor = true;
+ this.buttonNegative.Location = new System.Drawing.Point(462, 33);
+ this.buttonNegative.Name = "buttonNegative";
+ this.buttonNegative.Size = new System.Drawing.Size(70, 25);
+ this.buttonNegative.TabIndex = 6;
+ this.buttonNegative.Text = "璐熷悜";
+ this.buttonNegative.UseVisualStyleBackColor = true;
+ this.buttonNegative.Click += new System.EventHandler(this.buttonNegative_Click);
//
- // textBox3
+ // textBoxJogDec
//
- this.textBox3.Location = new System.Drawing.Point(340, 4);
- this.textBox3.Name = "textBox3";
- this.textBox3.Size = new System.Drawing.Size(116, 21);
- this.textBox3.TabIndex = 5;
+ this.textBoxJogDec.Location = new System.Drawing.Point(340, 4);
+ this.textBoxJogDec.Name = "textBoxJogDec";
+ this.textBoxJogDec.Size = new System.Drawing.Size(116, 21);
+ this.textBoxJogDec.TabIndex = 5;
//
- // buttonClearStatus
+ // buttonPositive
//
- this.buttonClearStatus.Location = new System.Drawing.Point(462, 3);
- this.buttonClearStatus.Name = "buttonClearStatus";
- this.buttonClearStatus.Size = new System.Drawing.Size(70, 25);
- this.buttonClearStatus.TabIndex = 6;
- this.buttonClearStatus.Text = "姝e悜";
- this.buttonClearStatus.UseVisualStyleBackColor = true;
+ this.buttonPositive.Location = new System.Drawing.Point(462, 3);
+ this.buttonPositive.Name = "buttonPositive";
+ this.buttonPositive.Size = new System.Drawing.Size(70, 25);
+ this.buttonPositive.TabIndex = 6;
+ this.buttonPositive.Text = "姝e悜";
+ this.buttonPositive.UseVisualStyleBackColor = true;
+ this.buttonPositive.Click += new System.EventHandler(this.buttonPositive_Click);
//
- // textBox2
+ // textBoxJogAcc
//
- this.textBox2.Location = new System.Drawing.Point(154, 35);
- this.textBox2.Name = "textBox2";
- this.textBox2.Size = new System.Drawing.Size(116, 21);
- this.textBox2.TabIndex = 5;
+ this.textBoxJogAcc.Location = new System.Drawing.Point(154, 35);
+ this.textBoxJogAcc.Name = "textBoxJogAcc";
+ this.textBoxJogAcc.Size = new System.Drawing.Size(116, 21);
+ this.textBoxJogAcc.TabIndex = 5;
//
// label5
//
@@ -258,12 +262,12 @@
this.label5.TabIndex = 4;
this.label5.Text = "鍑忛�熷害锛�";
//
- // textBox1
+ // textBoxJogVel
//
- this.textBox1.Location = new System.Drawing.Point(154, 4);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(116, 21);
- this.textBox1.TabIndex = 5;
+ this.textBoxJogVel.Location = new System.Drawing.Point(154, 4);
+ this.textBoxJogVel.Name = "textBoxJogVel";
+ this.textBoxJogVel.Size = new System.Drawing.Size(116, 21);
+ this.textBoxJogVel.TabIndex = 5;
//
// label4
//
@@ -321,20 +325,20 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label2;
- private System.Windows.Forms.TextBox textBox2;
- private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.TextBox textBoxJogAcc;
+ private System.Windows.Forms.TextBox textBoxJogVel;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Button buttonClearStatus;
- private System.Windows.Forms.TextBox textBox3;
+ private System.Windows.Forms.Button buttonNegative;
+ private System.Windows.Forms.Button buttonPositive;
+ private System.Windows.Forms.TextBox textBoxJogDec;
private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Button button3;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.TextBox textBox5;
- private System.Windows.Forms.TextBox textBox4;
- private System.Windows.Forms.TextBox textBox7;
- private System.Windows.Forms.TextBox textBox6;
+ private System.Windows.Forms.Button buttonStop;
+ private System.Windows.Forms.Button buttonStart;
+ private System.Windows.Forms.TextBox textBoxP2PVel;
+ private System.Windows.Forms.TextBox textBoxP2PPrfPosition;
+ private System.Windows.Forms.TextBox textBoxP2PDec;
+ private System.Windows.Forms.TextBox textBoxP2PAcc;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label9;
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs
index 916bc80..488561c 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs
@@ -7,6 +7,10 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using Bro.Common.Interface;
+using Bro.Common.Base;
+using Bro.Common.Model;
+using static Bro.Common.Helper.EnumHelper;
namespace Bro.UI.Device.Winform
{
@@ -17,11 +21,68 @@
InitializeComponent();
}
- public CtrlMotionCardAxisOperation(int axisIndex,string axisName)
+ private IDevice Device { get; set; }
+ private int _axisIndex { get; set; }
+
+ protected MotionCardBase MotionCard
+ {
+ get => Device as MotionCardBase;
+ }
+
+ public CtrlMotionCardAxisOperation(IDevice device, int axisIndex, string axisName)
{
InitializeComponent();
+ Device = device;
+ _axisIndex = axisIndex;
groupBoxAxisOperration.Text = $"杩愬姩杞达細{axisIndex}-{axisName}";
}
-
+
+ private void buttonPositive_Click(object sender, EventArgs e)
+ {
+ var opConfig = new MotionOperationCollection();
+ MovingOption movingOption = new MovingOption();
+ movingOption.AxisIndex = _axisIndex;
+ movingOption.MoveMode = MotionMode.Jog;
+ movingOption.VelocityPara.Acc = Convert.ToDouble(textBoxJogAcc.Text);
+ movingOption.VelocityPara.Dec = Convert.ToDouble(textBoxJogDec.Text);
+ movingOption.VelocityPara.Velocity= Convert.ToDouble(textBoxJogVel.Text);
+
+ opConfig.MovingOps.Add(movingOption);
+ MotionCard.MoveToPoint(opConfig);
+ }
+
+ private void buttonNegative_Click(object sender, EventArgs e)
+ {
+ var opConfig = new MotionOperationCollection();
+ MovingOption movingOption = new MovingOption();
+ movingOption.AxisIndex = _axisIndex;
+ movingOption.MoveMode = MotionMode.Jog;
+ movingOption.VelocityPara.Acc = Convert.ToDouble(textBoxJogAcc.Text);
+ movingOption.VelocityPara.Dec = Convert.ToDouble(textBoxJogDec.Text);
+ movingOption.VelocityPara.Velocity = Convert.ToDouble(textBoxJogVel.Text);
+
+ opConfig.MovingOps.Add(movingOption);
+ MotionCard.MoveToPoint(opConfig);
+ }
+
+ private void buttonStart_Click(object sender, EventArgs e)
+ {
+ var opConfig = new MotionOperationCollection();
+ MovingOption movingOption = new MovingOption();
+ movingOption.AxisIndex = _axisIndex;
+ movingOption.Destination = Convert.ToInt32(textBoxP2PPrfPosition.Text);
+ movingOption.MoveMode = MotionMode.Normal;
+ movingOption.VelocityPara.Acc = Convert.ToDouble(textBoxP2PAcc.Text);
+ movingOption.VelocityPara.Dec = Convert.ToDouble(textBoxP2PDec.Text);
+ movingOption.VelocityPara.Velocity = Convert.ToDouble(textBoxP2PVel.Text);
+
+ opConfig.MovingOps.Add(movingOption);
+ MotionCard.MoveToPoint(opConfig);
+ }
+
+ private void buttonStop_Click(object sender, EventArgs e)
+ {
+ MotionCard.StateChange(DeviceState.DSPause);
+ }
}
}
diff --git a/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs b/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs
index fd2a2f0..3502964 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs
@@ -39,13 +39,10 @@
{
foreach (var axisConfig in MotionCard.IConfig.AxisSettings.FindAll(u => u.IsAxisEnabled))
{
- var axisMovingStatus = MotionCard.AxisMovingOptionValues.FirstOrDefault(u => u.AxisIndex == axisConfig.AxisIndex);
- if (axisMovingStatus != null)
- {
- CtrlMotionCardAxisOperation axisOperation = new CtrlMotionCardAxisOperation(axisMovingStatus.AxisIndex, axisMovingStatus.AxisName);
- axisOperation.Dock = DockStyle.Fill;
- flowLayoutPanel1.Controls.Add(axisOperation);
- }
+ CtrlMotionCardAxisOperation axisOperation = new CtrlMotionCardAxisOperation(Device, axisConfig.AxisIndex, axisConfig.AxisName);
+ axisOperation.Dock = DockStyle.Fill;
+ flowLayoutPanel1.Controls.Add(axisOperation);
+
}
}
--
Gitblit v1.8.0