Commit 589d47aa 几米阳光

三个轴原点返回都改为负方向

1 个父辈 faf869d1
......@@ -172,14 +172,14 @@
this.打开舱门ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.关闭仓门ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator();
this.启用调试ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.语言 = new System.Windows.Forms.ToolStripMenuItem();
this.清理日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator();
this.英文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.德文ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.启用调试ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator();
this.contextMenuStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
......@@ -259,7 +259,7 @@
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(611, 535);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(627, 224);
this.groupBox1.Size = new System.Drawing.Size(627, 212);
this.groupBox1.TabIndex = 217;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "伺服状态";
......@@ -269,7 +269,7 @@
this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(200, 64);
this.axis_1_Alarm.Location = new System.Drawing.Point(194, 60);
this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264;
......@@ -279,7 +279,7 @@
this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(402, 64);
this.axis_3_Alarm.Location = new System.Drawing.Point(396, 60);
this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266;
......@@ -289,7 +289,7 @@
this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(297, 64);
this.axis_2_Alarm.Location = new System.Drawing.Point(291, 60);
this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
......@@ -297,7 +297,7 @@
// label38
//
this.label38.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label38.Location = new System.Drawing.Point(15, 69);
this.label38.Location = new System.Drawing.Point(9, 65);
this.label38.Name = "label38";
this.label38.Size = new System.Drawing.Size(160, 17);
this.label38.TabIndex = 263;
......@@ -306,7 +306,7 @@
//
// txtMiddleTarget
//
this.txtMiddleTarget.Location = new System.Drawing.Point(178, 180);
this.txtMiddleTarget.Location = new System.Drawing.Point(172, 176);
this.txtMiddleTarget.Name = "txtMiddleTarget";
this.txtMiddleTarget.ReadOnly = true;
this.txtMiddleTarget.Size = new System.Drawing.Size(87, 23);
......@@ -314,7 +314,7 @@
//
// txtInoutTarget
//
this.txtInoutTarget.Location = new System.Drawing.Point(379, 180);
this.txtInoutTarget.Location = new System.Drawing.Point(373, 176);
this.txtInoutTarget.Name = "txtInoutTarget";
this.txtInoutTarget.ReadOnly = true;
this.txtInoutTarget.Size = new System.Drawing.Size(87, 23);
......@@ -322,7 +322,7 @@
//
// txtUpdownTarget
//
this.txtUpdownTarget.Location = new System.Drawing.Point(279, 180);
this.txtUpdownTarget.Location = new System.Drawing.Point(273, 176);
this.txtUpdownTarget.Name = "txtUpdownTarget";
this.txtUpdownTarget.ReadOnly = true;
this.txtUpdownTarget.Size = new System.Drawing.Size(87, 23);
......@@ -331,7 +331,7 @@
// label12
//
this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label12.Location = new System.Drawing.Point(15, 183);
this.label12.Location = new System.Drawing.Point(9, 179);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(160, 17);
this.label12.TabIndex = 258;
......@@ -340,7 +340,7 @@
//
// lblCountPulse1
//
this.lblCountPulse1.Location = new System.Drawing.Point(178, 146);
this.lblCountPulse1.Location = new System.Drawing.Point(172, 142);
this.lblCountPulse1.Name = "lblCountPulse1";
this.lblCountPulse1.ReadOnly = true;
this.lblCountPulse1.Size = new System.Drawing.Size(87, 23);
......@@ -348,7 +348,7 @@
//
// lblOutPulse1
//
this.lblOutPulse1.Location = new System.Drawing.Point(178, 112);
this.lblOutPulse1.Location = new System.Drawing.Point(172, 108);
this.lblOutPulse1.Name = "lblOutPulse1";
this.lblOutPulse1.ReadOnly = true;
this.lblOutPulse1.Size = new System.Drawing.Size(87, 23);
......@@ -356,7 +356,7 @@
//
// lblCountPulse3
//
this.lblCountPulse3.Location = new System.Drawing.Point(379, 146);
this.lblCountPulse3.Location = new System.Drawing.Point(373, 142);
this.lblCountPulse3.Name = "lblCountPulse3";
this.lblCountPulse3.ReadOnly = true;
this.lblCountPulse3.Size = new System.Drawing.Size(87, 23);
......@@ -364,7 +364,7 @@
//
// lblOutPulse3
//
this.lblOutPulse3.Location = new System.Drawing.Point(379, 112);
this.lblOutPulse3.Location = new System.Drawing.Point(373, 108);
this.lblOutPulse3.Name = "lblOutPulse3";
this.lblOutPulse3.ReadOnly = true;
this.lblOutPulse3.Size = new System.Drawing.Size(87, 23);
......@@ -372,7 +372,7 @@
//
// lblCountPulse2
//
this.lblCountPulse2.Location = new System.Drawing.Point(280, 146);
this.lblCountPulse2.Location = new System.Drawing.Point(274, 142);
this.lblCountPulse2.Name = "lblCountPulse2";
this.lblCountPulse2.ReadOnly = true;
this.lblCountPulse2.Size = new System.Drawing.Size(87, 23);
......@@ -380,7 +380,7 @@
//
// lblOutPulse2
//
this.lblOutPulse2.Location = new System.Drawing.Point(279, 112);
this.lblOutPulse2.Location = new System.Drawing.Point(273, 108);
this.lblOutPulse2.Name = "lblOutPulse2";
this.lblOutPulse2.ReadOnly = true;
this.lblOutPulse2.Size = new System.Drawing.Size(87, 23);
......@@ -389,7 +389,7 @@
// label4
//
this.label4.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label4.Location = new System.Drawing.Point(370, 20);
this.label4.Location = new System.Drawing.Point(364, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(95, 34);
this.label4.TabIndex = 100;
......@@ -399,7 +399,7 @@
// label3
//
this.label3.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.Location = new System.Drawing.Point(271, 20);
this.label3.Location = new System.Drawing.Point(265, 16);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(95, 34);
this.label3.TabIndex = 99;
......@@ -409,7 +409,7 @@
// label1
//
this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Location = new System.Drawing.Point(173, 20);
this.label1.Location = new System.Drawing.Point(167, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(95, 34);
this.label1.TabIndex = 97;
......@@ -419,7 +419,7 @@
// label43
//
this.label43.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label43.Location = new System.Drawing.Point(15, 115);
this.label43.Location = new System.Drawing.Point(9, 111);
this.label43.Name = "label43";
this.label43.Size = new System.Drawing.Size(160, 17);
this.label43.TabIndex = 23;
......@@ -429,7 +429,7 @@
// label42
//
this.label42.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label42.Location = new System.Drawing.Point(15, 149);
this.label42.Location = new System.Drawing.Point(9, 145);
this.label42.Name = "label42";
this.label42.Size = new System.Drawing.Size(160, 17);
this.label42.TabIndex = 24;
......@@ -525,7 +525,6 @@
this.groupAxis.TabIndex = 216;
this.groupAxis.TabStop = false;
this.groupAxis.Text = "伺服运动";
//
// label6
//
......@@ -687,7 +686,7 @@
this.btnReadPosition.Cursor = System.Windows.Forms.Cursors.Default;
this.btnReadPosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadPosition.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnReadPosition.Location = new System.Drawing.Point(382, 183);
this.btnReadPosition.Location = new System.Drawing.Point(382, 181);
this.btnReadPosition.Name = "btnReadPosition";
this.btnReadPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnReadPosition.Size = new System.Drawing.Size(115, 33);
......@@ -1002,7 +1001,7 @@
this.richTextBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.richTextBox1.Location = new System.Drawing.Point(17, 651);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(583, 105);
this.richTextBox1.Size = new System.Drawing.Size(583, 96);
this.richTextBox1.TabIndex = 256;
this.richTextBox1.Text = "";
//
......@@ -1784,118 +1783,130 @@
// 查看IOToolStripMenuItem
//
this.查看IOToolStripMenuItem.Name = "查看IOToolStripMenuItem";
this.查看IOToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.查看IOToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.查看IOToolStripMenuItem.Text = "查看IO";
this.查看IOToolStripMenuItem.Click += new System.EventHandler(this.查看IOToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(173, 6);
//
// 轴卡点动ToolStripMenuItem
//
this.轴卡点动ToolStripMenuItem.Name = "轴卡点动ToolStripMenuItem";
this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.轴卡点动ToolStripMenuItem.Text = "轴卡点动";
this.轴卡点动ToolStripMenuItem.Click += new System.EventHandler(this.轴卡点动ToolStripMenuItem_Click);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator12.Size = new System.Drawing.Size(173, 6);
//
// 扫码测试ToolStripMenuItem
//
this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem";
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.扫码测试ToolStripMenuItem.Text = "扫码测试";
this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click);
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator10.Size = new System.Drawing.Size(173, 6);
//
// 学习二维码ToolStripMenuItem
//
this.学习二维码ToolStripMenuItem.Name = "学习二维码ToolStripMenuItem";
this.学习二维码ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.学习二维码ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.学习二维码ToolStripMenuItem.Text = "学习二维码";
this.学习二维码ToolStripMenuItem.Click += new System.EventHandler(this.学习二维码ToolStripMenuItem_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator5.Size = new System.Drawing.Size(173, 6);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem3.Size = new System.Drawing.Size(176, 26);
this.toolStripMenuItem3.Text = "门禁功能屏蔽";
this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click);
//
// toolStripSeparator14
//
this.toolStripSeparator14.Name = "toolStripSeparator14";
this.toolStripSeparator14.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator14.Size = new System.Drawing.Size(173, 6);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem2.Size = new System.Drawing.Size(176, 26);
this.toolStripMenuItem2.Text = "门禁功能打开";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
//
// toolStripSeparator13
//
this.toolStripSeparator13.Name = "toolStripSeparator13";
this.toolStripSeparator13.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator13.Size = new System.Drawing.Size(173, 6);
//
// 料仓运转OFFToolStripMenuItem
//
this.料仓运转OFFToolStripMenuItem.Name = "料仓运转OFFToolStripMenuItem";
this.料仓运转OFFToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.料仓运转OFFToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.料仓运转OFFToolStripMenuItem.Text = "料仓运转OFF";
this.料仓运转OFFToolStripMenuItem.Click += new System.EventHandler(this.料仓运转OFFToolStripMenuItem_Click);
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator6.Size = new System.Drawing.Size(173, 6);
//
// 料仓运转ONToolStripMenuItem
//
this.料仓运转ONToolStripMenuItem.Name = "料仓运转ONToolStripMenuItem";
this.料仓运转ONToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.料仓运转ONToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.料仓运转ONToolStripMenuItem.Text = "料仓运转ON";
this.料仓运转ONToolStripMenuItem.Click += new System.EventHandler(this.料仓运转ONToolStripMenuItem_Click);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator7.Size = new System.Drawing.Size(173, 6);
//
// 打开舱门ToolStripMenuItem
//
this.打开舱门ToolStripMenuItem.Name = "打开舱门ToolStripMenuItem";
this.打开舱门ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.打开舱门ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.打开舱门ToolStripMenuItem.Text = "打开仓门";
this.打开舱门ToolStripMenuItem.Click += new System.EventHandler(this.打开舱门ToolStripMenuItem_Click);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator8.Size = new System.Drawing.Size(173, 6);
//
// 关闭仓门ToolStripMenuItem
//
this.关闭仓门ToolStripMenuItem.Name = "关闭仓门ToolStripMenuItem";
this.关闭仓门ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.关闭仓门ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.关闭仓门ToolStripMenuItem.Text = "关闭仓门";
this.关闭仓门ToolStripMenuItem.Click += new System.EventHandler(this.关闭仓门ToolStripMenuItem_Click);
//
// toolStripSeparator16
//
this.toolStripSeparator16.Name = "toolStripSeparator16";
this.toolStripSeparator16.Size = new System.Drawing.Size(173, 6);
//
// 启用调试ToolStripMenuItem
//
this.启用调试ToolStripMenuItem.Name = "启用调试ToolStripMenuItem";
this.启用调试ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.启用调试ToolStripMenuItem.Text = "启用调试";
this.启用调试ToolStripMenuItem.Click += new System.EventHandler(this.启用调试ToolStripMenuItem_Click);
//
// 语言
//
this.语言.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
......@@ -1940,18 +1951,6 @@
this.德文ToolStripMenuItem.Visible = false;
this.德文ToolStripMenuItem.Click += new System.EventHandler(this.德文ToolStripMenuItem_Click);
//
// 启用调试ToolStripMenuItem
//
this.启用调试ToolStripMenuItem.Name = "启用调试ToolStripMenuItem";
this.启用调试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启用调试ToolStripMenuItem.Text = "启用调试";
this.启用调试ToolStripMenuItem.Click += new System.EventHandler(this.启用调试ToolStripMenuItem_Click);
//
// toolStripSeparator16
//
this.toolStripSeparator16.Name = "toolStripSeparator16";
this.toolStripSeparator16.Size = new System.Drawing.Size(177, 6);
//
// FrmStoreBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......
......@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
public class ACCMDManager
......@@ -11,7 +11,8 @@ namespace OnlineStore.DeviceLibrary
/// 0132h 原点接近传感器输入 (HOME) 状态 ReadOnly 0: 输入 OFF 1: 输入 ON
/// </summary>
public static string Home_Single = "0132";
// 0022h 负方向驱动禁止输入(NOT) ReadOnly 0: 输入 OFF、 1: 输入 ON
// 0023h 正方向驱动禁止输入(POT) ReadOnly 0: 输入 OFF、 1: 输入 ON
/// <summary>
///速度 4601
/// </summary>
......@@ -23,11 +24,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 0120h 选通输入 (STB) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public static string STB_Addr = "0120";
public static string STB_Addr = "0120";
/// <summary>
/// 0124h 减速停止输入 (S-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public static string Stop_Addr = "0124";
public static string Stop_Addr = "0124";
/// <summary>
/// 0123h 紧急停止输入 (H-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
......@@ -50,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
/// 实际位置=600F
/// </summary>
public static string ActualPosition = "600F";
/// <summary>
/// BUSY状态=0140,0140h 动作执行状态 (BUSY) ReadOnly 0:未执行 1:执行中
public static string BUSYStatus = "0140";
......@@ -73,7 +74,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 读线圈01
/// </summary>
public static byte CMD_ReadCoil= 0x01;
public static byte CMD_ReadCoil = 0x01;
/// <summary>
/// 写线圈 05
/// </summary>
......@@ -128,12 +129,12 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public static string Block_SuddenStop = "7";
public static byte[] buildCheckData(byte[] sendData, int length)
public static byte[] buildCheckData(byte[] sendData, int length)
{
ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum);
AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr);
byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1)
{
sendData[length] = checkByte[0];
......@@ -152,7 +153,7 @@ namespace OnlineStore.DeviceLibrary
// ( 2) 读取寄存器( 03h)
if (cmd.Equals(CMD_ReadRegisters))
{
return Get03WriteData(slvAddr, addr,length);
return Get03WriteData(slvAddr, addr, length);
}
else if (cmd.Equals(CMD_WriteRegisters))
{
......@@ -176,7 +177,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString());
byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1)
{
sendData[2] = 0x00;
......@@ -188,7 +189,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0];
}
byte[] dataByte = SerialBean.StringToByte(dataValue);
byte[] dataByte = AcSerialBean.StringToByte(dataValue);
if (dataByte.Length == 1)
{
sendData[4] = 0x00;
......@@ -203,13 +204,13 @@ namespace OnlineStore.DeviceLibrary
sendData = buildCheckData(sendData, sendData.Length - 2);
return sendData;
}
private static byte[] Get01WriteData(int slvAddr, string addr, int length)
private static byte[] Get01WriteData(int slvAddr, string addr, int length)
{
byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString());
byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1)
{
sendData[2] = 0x00;
......@@ -221,7 +222,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0];
}
byte[] dataByte = SerialBean.StringToByte(length.ToString());
byte[] dataByte = AcSerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1)
{
sendData[4] = 0x00;
......@@ -249,10 +250,10 @@ namespace OnlineStore.DeviceLibrary
//低位
//CRC 低位
//高位
byte[] sendData = new byte[8 ];
byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString());
byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1)
{
sendData[2] = 0x00;
......@@ -264,7 +265,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0];
}
byte[] dataByte = SerialBean.StringToByte(length.ToString());
byte[] dataByte = AcSerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1)
{
sendData[4] = 0x00;
......@@ -276,7 +277,7 @@ namespace OnlineStore.DeviceLibrary
sendData[5] = dataByte[0];
}
sendData = buildCheckData(sendData, sendData.Length-2);
sendData = buildCheckData(sendData, sendData.Length - 2);
return sendData;
}
......@@ -294,7 +295,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString());
byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1)
{
sendData[2] = 0x00;
......@@ -306,7 +307,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0];
}
byte[] dataByte = SerialBean.StringToByte(dataValue);
byte[] dataByte = AcSerialBean.StringToByte(dataValue);
if (dataByte.Length == 1)
{
sendData[4] = 0x00;
......@@ -316,14 +317,15 @@ namespace OnlineStore.DeviceLibrary
{
sendData[4] = dataByte[0];
sendData[5] = dataByte[1];
//sendData[4] = dataByte[1];
//sendData[5] = dataByte[0];
}
sendData = buildCheckData(sendData, sendData.Length - 2);
sendData = buildCheckData(sendData, sendData.Length - 2);
return sendData;
}
}
}
......@@ -4,22 +4,22 @@ using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
{
/// <summary>
/// 外部调用的接口放在此文件中
/// </summary>
public partial class ACServerManager
{
private static bool IsShowMsg = false ;
public static bool IsShowMsg = false;
private static int SleepMSendons = 100;
private static Dictionary<string, Dictionary<string, int>> ComAddrValue = new Dictionary<string, Dictionary<string, int>>();
private static string mapObj = "";
private static Dictionary<string, Dictionary<string, int>> ComAddrValue = new Dictionary<string, Dictionary<string, int>>();
private static string mapObj = "";
private static int GetAddrValue(string portName,int slvAddr, string addr)
private static int GetAddrValue(string portName, int slvAddr, string addr)
{
int value = -1;
try
......@@ -42,7 +42,7 @@ namespace OnlineStore.DeviceLibrary
}
return value;
}
private static void UpdateAddrValue(string portName,int slvAddr, string addr, int value)
private static void UpdateAddrValue(string portName, int slvAddr, string addr, int value)
{
try
{
......@@ -77,7 +77,7 @@ namespace OnlineStore.DeviceLibrary
{
if (serialBeanMap.ContainsKey(portName))
{
return true ;
return true;
}
int ACBaudRate = ConfigAppSettings.GetIntValue(Setting_Init.ACBaudRate);
......@@ -85,12 +85,12 @@ namespace OnlineStore.DeviceLibrary
bool result = bean.openPort();
if (!result)
{
LogUtil.info("打开串口【" + portName + "】【"+ACBaudRate+"】失败");
LogUtil.info("打开串口【" + portName + "】【" + ACBaudRate + "】失败");
return false;
}
LogUtil.info("打开串口【" + portName + "】【" + ACBaudRate + "】成功");
//bean.DataReceived += DataReceived;
if (serialBeanMap.ContainsKey(portName))
{
serialBeanMap.Remove(portName);
......@@ -125,15 +125,15 @@ namespace OnlineStore.DeviceLibrary
{
if (!serialBeanMap.ContainsKey(portName))
{
return false ;
return false;
}
PreReadCoilAddr = ACCMDManager.ServerOn_Addr;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadCoil, PreReadCoilAddr, "0000", 1);
//SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 6);
int result= GetCoilData(portName, reviceData, PreReadCoilAddr);
int result = GetCoilData(portName, reviceData, PreReadCoilAddr);
//TODO
return result>=1;
return result >= 1;
}
/// <summary>
/// 是否原点返回完成
......@@ -144,20 +144,22 @@ namespace OnlineStore.DeviceLibrary
if (status >= 1)
{
return true;
} return false;
}
return false;
}
public static void InitSlvAddr(string portName, int slvAddr)
{
InitSlvAddr(portName, slvAddr, 100, 30, 30 );
InitSlvAddr(portName, slvAddr, 100, 30, 30);
//InitSlvAddr(portName, slvAddr, 100, 30, 30, 100, 50, 30);
}
//把数字转换为四位的字符串
public static string SpeedToStr(int speed,int length)
public static string SpeedToStr(int speed, int length)
{
speed = Math.Abs(speed);
string str = String.Format("{0:X}", speed);
return str.PadLeft(length, '0');
}
public static void InitSlvAddr(string portName, int slvAddr,int targetSpeed,int addSpeed,int delSpeed )
public static void InitSlvAddr(string portName, int slvAddr, int targetSpeed, int addSpeed, int delSpeed)
//public static void InitSlvAddr(string portName, int slvAddr,int targetSpeed,int addSpeed,int delSpeed,int homeHighSpeed,int homeLowSpeed,int homeAddSpeed)
{
LogUtil.info("开始初始化伺服【" + portName + "】【" + slvAddr + "】");
......@@ -166,10 +168,10 @@ namespace OnlineStore.DeviceLibrary
string slvAddrStr = string.Format(strFromat, slvAddr);
//block0=原点返回,正方向
string str0 = slvAddrStr + "104800 000408 00000420 00000000 ffff";
SendStrAndSleep(portName, str0, sleep);
SendStrAndSleep(portName, str0, sleep);
//block1=原点返回,反方向
string str1 = slvAddrStr + "104804 000408 04000420 00000000 ffff";
SendStrAndSleep(portName, str1, sleep);
SendStrAndSleep(portName, str1, sleep);
//block2=绝对位置运动
string str2 = slvAddrStr + "104808 000408 10000211EC78FFFF ffff";
SendStrAndSleep(portName, str2, sleep);
......@@ -212,7 +214,7 @@ namespace OnlineStore.DeviceLibrary
public static void UpdateEEPROM(string portName, int slvAddr)
{
string addr = ACCMDManager.EEPROM_Param_Addr;
string data = "6173";
string data = "6173";
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, addr, data, length);
SendData(portName, dataArray, 5);
......@@ -238,20 +240,20 @@ namespace OnlineStore.DeviceLibrary
SendData(portName, dataArray);
}
public static void RelMove(string portName, int slvAddr, int position,int targetSpeed)
{
public static void RelMove(string portName, int slvAddr, int position, int targetSpeed)
{
//先更新速度
string slvAddrStr = string.Format(strFromat, slvAddr);
string slvAddrStr = string.Format(strFromat, slvAddr);
string v1 = slvAddrStr + "064601 " + SpeedToStr(targetSpeed, 4) + " ffff";
SendStrAndSleep(portName, v1,SleepMSendons);
SendStrAndSleep(portName, v1, SleepMSendons);
RelMove(portName, slvAddr, position);
}
public static void RelMove(string portName, int slvAddr, int position)
{
//int position = Convert.ToInt32(txtPosition.Text);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("0110480C 000408 10000111EC78FFFF ffff");
byte[] positionData = AcSerialBean.StringToByte(position.ToString("X8"));
byte[] data = AcSerialBean.StringToByte("0110480C 000408 10000111EC78FFFF ffff");
data[0] = (byte)slvAddr;
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
......@@ -287,10 +289,6 @@ namespace OnlineStore.DeviceLibrary
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(portName, data);
System.Threading.Thread.Sleep(SleepMSendons);
//运动
//data = ACCMDManager.GetWriteData(slvAddr, 06, ACCMDManager.BlockNo, ACCMDManager.Block_RelMove, 2);
//SendData(portName, data);
//Thread.Sleep(SleepMSendons);
UpdateBlock(portName, slvAddr, ACCMDManager.Block_RelMove);
OpenAndCloseSTB(portName, slvAddr);
......@@ -298,89 +296,68 @@ namespace OnlineStore.DeviceLibrary
public static void HomeMove(string portName, int slvAddr, int speed)
{
//默认负方向原点返回
//byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_HomeMove1, 2);
//SendData(portName, data);
try
{
//先判断是否在原点,如果已经在原点,先向正方向走2000
int homeSingle = GetHomeSingle(portName, slvAddr);
if (homeSingle.Equals(1))
{
int isHomeEnd = GetHomeEndStatus(portName, slvAddr);
if (isHomeEnd.Equals(1))
//int isHomeEnd = GetHomeEndStatus(portName, slvAddr);
//if (isHomeEnd.Equals(1))
//{
int value = 2000;
LogUtil.info("轴【" + portName + "_" + slvAddr + "】原点返回时发现原点已亮且回过原点,需要先相对走" + value);
RelMove(portName, slvAddr, value);
bool isStop = false;
for (int i = 0; i <= 10; i++)
{
int value = 2000;
//if (portName.Equals(ACStoreManager.store.Config.Middle_Axis.DeviceName) ||
// portName.Equals(ACStoreManager.store.Config.InOut_Axis.DeviceName))
if(ACStoreManager.store.Config.Middle_Axis.IsSameAxis(portName, slvAddr) ||
ACStoreManager.store.Config.InOut_Axis.IsSameAxis(portName,slvAddr))
{
value = -2000;
}
LogUtil.info("轴【" + portName +"_"+ slvAddr + "】原点返回时发现原点已亮且回过原点,需要先相对走" + value);
RelMove(portName, slvAddr, value);
bool isStop = false;
for (int i = 0; i <= 10; i++)
{
Thread.Sleep(200);
if (GetBusyStatus(portName, slvAddr).Equals(0))
{
isStop = true;
LogUtil.info("轴【" + portName + "_" + slvAddr + "】相对走" + value + "已结束");
break;
}
}
if (!isStop)
Thread.Sleep(200);
if (GetBusyStatus(portName, slvAddr).Equals(0))
{
LogUtil.info("轴【" + portName + "_" + slvAddr + "】相对走" + value + "已等待2分钟,直接停止");
SuddenStop(portName, slvAddr);
isStop = true;
LogUtil.info("轴【" + portName + "_" + slvAddr + "】相对走" + value + "已结束");
break;
}
}
if (!isStop)
{
LogUtil.info("轴【" + portName + "_" + slvAddr + "】相对走" + value + "已等待2分钟,直接停止");
SuddenStop(portName, slvAddr);
}
//}
}
}
catch (Exception ex)
{
LogUtil.error("轴【" + portName + "_" + slvAddr + "】原点返回前验证是否在原点出错:" + ex.StackTrace);
}
//旋转轴回正方向,其他轴回负方向
if (ACStoreManager.store.Config.Middle_Axis.IsSameAxis(portName, slvAddr))
{
UpdateBlock(portName, slvAddr, ACCMDManager.Block_HomeMove0);
LogUtil.info("旋转轴原点返回方向:正方向");
}
else if (ACStoreManager.store.Config.InOut_Axis.IsSameAxis(portName, slvAddr))
{
UpdateBlock(portName, slvAddr, ACCMDManager.Block_HomeMove0);
LogUtil.info("进出轴原点返回方向:正方向");
}
else
{
UpdateBlock(portName, slvAddr, ACCMDManager.Block_HomeMove1);
LogUtil.info("升降轴原点返回方向:反方向");
}
UpdateBlock(portName, slvAddr, ACCMDManager.Block_HomeMove1);
LogUtil.debug("回原点:反方向");
//}
Thread.Sleep(SleepMSendons);
OpenAndCloseSTB(portName, slvAddr);
}
public static void SpeedMove(string portName, int slvAddr, int speed)
{
int preSpeed = GetAddrValue(portName,slvAddr, ACCMDManager.Speed_Addr);
int preSpeed = GetAddrValue(portName, slvAddr, ACCMDManager.Speed_Addr);
if ((preSpeed.Equals(-1)) || (!preSpeed.Equals(Math.Abs(speed))))
{
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4601", string.Format("{0:X2}", Math.Abs(speed)), 2);
SendData(portName, data);
UpdateAddrValue(portName,slvAddr, ACCMDManager.Speed_Addr, Math.Abs(speed));
string v1 = slvAddr + "064601 " + ACServerManager.SpeedToStr(speed, 4) + " ffff";
LogUtil.debug("轴【" + portName + "_" + slvAddr + "】更新速度为【" + speed + "】,发送数据【" + v1 + "】");
SendStrAndSleep(portName, v1, SleepMSendons);
UpdateAddrValue(portName, slvAddr, ACCMDManager.Speed_Addr, Math.Abs(speed));
Thread.Sleep(SleepMSendons);
}
if (speed > 0)
{
{
UpdateBlock(portName, slvAddr, ACCMDManager.Block_VolMove0);
}
else
{
{
UpdateBlock(portName, slvAddr, ACCMDManager.Block_VolMove1);
}
}
//Thread.Sleep(SleepMSendons);
OpenAndCloseSTB(portName, slvAddr);
}
public static void AbsMove(string portName, int slvAddr, int targetPosition, int targetSpeed)
......@@ -388,13 +365,13 @@ namespace OnlineStore.DeviceLibrary
//先更新速度
string slvAddrStr = string.Format(strFromat, slvAddr);
int preSpeed = GetAddrValue(portName,slvAddr, ACCMDManager.Speed_Addr);
int preSpeed = GetAddrValue(portName, slvAddr, ACCMDManager.Speed_Addr);
if ((preSpeed.Equals(-1)) || (!preSpeed.Equals(targetSpeed)))
{
//速度 V1 =100
string v1 = slvAddrStr + "064601 " + SpeedToStr(targetSpeed, 4) + " ffff";
SendStrAndSleep(portName, v1, SleepMSendons);
UpdateAddrValue(portName,slvAddr, ACCMDManager.Speed_Addr, targetSpeed);
UpdateAddrValue(portName, slvAddr, ACCMDManager.Speed_Addr, targetSpeed);
}
//绝对运动
AbsMove(portName, slvAddr, targetPosition);
......@@ -402,8 +379,8 @@ namespace OnlineStore.DeviceLibrary
public static void AbsMove(string portName, int slvAddr, int position)
{
//int position = Convert.ToInt32(txtPosition.Text, 10);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("01104808 000408 10000211 EC78FFFF ffff");
byte[] positionData = AcSerialBean.StringToByte(position.ToString("X8"));
byte[] data = AcSerialBean.StringToByte("01104808 000408 10000211 EC78FFFF ffff");
data[0] = (byte)slvAddr;
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
......@@ -440,7 +417,6 @@ namespace OnlineStore.DeviceLibrary
SendData(portName, data);
Thread.Sleep(SleepMSendons);
UpdateBlock(portName, slvAddr, ACCMDManager.Block_AbsMove);
OpenAndCloseSTB(portName, slvAddr);
}
}
......
......@@ -27,131 +27,15 @@ namespace OnlineStore.DeviceLibrary
return null;
}
//public static void RunBlock(string portName, int slvAddr, int index)
//{
// //运动
// byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, index.ToString(), 2);
// SendData(portName, data);
// Thread.Sleep(100);
// CloseSTB(portName, slvAddr);
// Thread.Sleep(100);
// OnlyOpenSTB(portName, slvAddr);
//}
public static void SendStrAndSleep(string portName, string str, int sleepS)
{
byte[] data = SerialBean.StringToByte(str);
byte[] data = AcSerialBean.StringToByte(str);
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(portName, data);
System.Threading.Thread.Sleep(sleepS);
}
//public static void SendStr(string portName, string str)
//{
// byte[] data = SerialBean.StringToByte(str);
// data[data.Length - 1] = 0x00;
// data[data.Length - 2] = 0x00;
// data = ACCMDManager.buildCheckData(data, data.Length - 2);
// SendData(portName, data);
//}
//private static void DataReceived(string portName, object sender, SerialDataReceivedEventArgs e, byte[] bits)
//{
// string strSend = "";
// for (int i = 0; i < bits.Length; i++)
// {
// strSend += string.Format("{0:X2} ", bits[i]);
// }
// if (IsShowMsg)
// {
// LogUtil.info( "串口" + portName + " 收到数据:" + strSend + "");
// }
// string str = "";
// string strFromat = "{0:X2}";
// byte slvAddr = bits[0];
// int lenth = bits[2];
// byte cmd = bits[1];
// if (cmd.Equals(ACCMDManager.CMD_ReadRegisters) && bits.Length > 6)
// {
// if (PreReadAddr.Equals(ACCMDManager.TargetPostion))
// {
// if (lenth == 4)
// {
// str = string.Format(strFromat, bits[5]) + string.Format(strFromat, bits[6]) + string.Format(strFromat, bits[3]) + string.Format(strFromat, bits[4]);
// int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
// SaveData(portName, slvAddr, ACCMDManager.TargetPostion, value);
// }
// }
// else if (PreReadAddr.Equals(ACCMDManager.ActualPosition))
// {
// if (lenth == 4)
// {
// str = string.Format(strFromat, bits[5]) + string.Format(strFromat, bits[6]) + string.Format(strFromat, bits[3]) + string.Format(strFromat, bits[4]);
// int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
// SaveData(portName, slvAddr, ACCMDManager.ActualPosition, value);
// }
// }
// else
// {
// for (int i = 3; i < 3 + lenth; i++)
// {
// str += string.Format("{0:X2} ", bits[i]);
// }
// str = str.Replace(" ", "");
// int value = Convert.ToInt32(str, 16);
// LogUtil.info("转换后结果:" + value + "");
// //this.richTextBox1.AppendText("转换后结果:" + value + "");
// //Console.WriteLine("转换后结果:" + value);
// }
// //MessageBox.Show("收到数据:"+value);
// }
// else if (cmd.Equals(ACCMDManager.CMD_ReadCoil) && bits.Length >= 6)
// {
// if (PreReadCoilAddr.Equals(ACCMDManager.ServerOn_Addr))
// {
// if (lenth == 1)
// {
// str = string.Format(strFromat, bits[3]);
// int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
// SaveData(portName, slvAddr, ACCMDManager.ServerOn_Addr, value);
// }
// }
// else
// if (PreReadCoilAddr.Equals(ACCMDManager.Alarm_Status))
// {
// if (lenth == 1)
// {
// str = string.Format(strFromat, bits[3]);
// int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
// SaveData(portName, slvAddr, ACCMDManager.Alarm_Status, value);
// }
// }
// else if (PreReadCoilAddr.Equals(ACCMDManager.BUSYStatus))
// {
// if (lenth == 1)
// {
// str = string.Format(strFromat, bits[3]);
// int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
// SaveData(portName, slvAddr, ACCMDManager.BUSYStatus, value);
// }
// }
// else if (PreReadCoilAddr.Equals(ACCMDManager.HOME_CMP_Status))
// {
// if (lenth == 1)
// {
// str = string.Format(strFromat, bits[3]);
// int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
// SaveData(portName, slvAddr, ACCMDManager.HOME_CMP_Status, value);
// }
// }
// }
// if (strSend.Equals(""))
// {
// return;
// }
//}
public static void SaveData(string portName, byte slvAddr, string regAddr, int value)
{
......@@ -173,17 +57,17 @@ namespace OnlineStore.DeviceLibrary
LastDataMap.Add(slvAddr, map);
}
}
//public static RegisterInfo GetData(string portName, byte slvAddr, string regAddr)
//{
// if (LastDataMap.ContainsKey(slvAddr))
// {
// if (LastDataMap[slvAddr].ContainsKey(regAddr))
// {
// return LastDataMap[slvAddr][regAddr];
// }
// }
// return null;
//}
public static RegisterInfo GetData(string portName, byte slvAddr, string regAddr)
{
if (LastDataMap.ContainsKey(slvAddr))
{
if (LastDataMap[slvAddr].ContainsKey(regAddr))
{
return LastDataMap[slvAddr][regAddr];
}
}
return null;
}
public static void SendData(string portName, byte[] data, int reviceLength)
{
......@@ -200,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
}
if (IsShowMsg)
{
LogUtil.info( "串口" + portName + " 收到数据:" + strSend + "");
LogUtil.info("串口" + portName + " 收到数据:" + strSend + "");
}
}
public static void SendData(string portName, byte[] data)
......@@ -208,9 +92,9 @@ namespace OnlineStore.DeviceLibrary
if (data == null)
{
return;
}
}
byte[] returnData = SendCommand(portName, data, 50, 8);
if (returnData!=null)
if (returnData != null)
{
string strSend = "";
for (int i = 0; i < returnData.Length; i++)
......@@ -231,6 +115,10 @@ namespace OnlineStore.DeviceLibrary
/// <returns>返回值的长度</returns>
public static byte[] SendCommand(string portName, byte[] data, int outTime, int reviceLength)
{
if (outTime > 80)
{
outTime = 80;
}
byte[] returnData = null;
try
......@@ -250,7 +138,7 @@ namespace OnlineStore.DeviceLibrary
}
if (IsShowMsg)
{
LogUtil.info( "串口" + portName + " 写入数据:" + strSend + "");
LogUtil.info("串口" + portName + " 写入数据:" + strSend + "");
}
AcSerialBean bean = GetSerialBean(portName);
if (bean == null)
......@@ -279,7 +167,7 @@ namespace OnlineStore.DeviceLibrary
public static void SendStr(string portName, int slvAddr, string str)
{
//string str = txtSendStr.Text;
byte[] data = SerialBean.StringToByte(str);
byte[] data = AcSerialBean.StringToByte(str);
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2);
......@@ -346,13 +234,13 @@ namespace OnlineStore.DeviceLibrary
public static void UpdateBlock(string portName, int slvAddr, string blockNum)
{
int preNum = GetAddrValue(portName,slvAddr, ACCMDManager.BlockNo);
int preNum = GetAddrValue(portName, slvAddr, ACCMDManager.BlockNo);
if (preNum.Equals(-1) || (!preNum.ToString().Equals(blockNum)))
{
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, blockNum , 2);
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, blockNum, 2);
SendData(portName, data);
int value = Convert.ToInt16(blockNum);
UpdateAddrValue(portName,slvAddr, ACCMDManager.BlockNo, value);
UpdateAddrValue(portName, slvAddr, ACCMDManager.BlockNo, value);
Thread.Sleep(SleepMSendons);
}
}
......@@ -394,7 +282,7 @@ namespace OnlineStore.DeviceLibrary
}
if (IsShowMsg)
{
LogUtil.info( "串口" + portName + " 收到数据:" + strSend + "");
LogUtil.info("串口" + portName + " 收到数据:" + strSend + "");
}
string strFromat = "{0:X2}";
byte slvAddrR = reviceData[0];
......@@ -417,7 +305,7 @@ namespace OnlineStore.DeviceLibrary
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadRegisters, ACCMDManager.TargetPostion, "0000", 2);
// SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 9);
return GetRegisterData(portName, reviceData, ACCMDManager.TargetPostion);
}
public static int GetActualtPosition(string portName, int slvAddr)
......@@ -426,7 +314,7 @@ namespace OnlineStore.DeviceLibrary
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadRegisters, ACCMDManager.ActualPosition, "0000", 2);
// SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 9);
return GetRegisterData(portName, reviceData, ACCMDManager.ActualPosition);
}
......@@ -442,7 +330,7 @@ namespace OnlineStore.DeviceLibrary
if (IsShowMsg)
{
LogUtil.info( "串口" + portName + " 收到数据:" + strSend + "");
LogUtil.info("串口" + portName + " 收到数据:" + strSend + "");
}
string strFromat = "{0:X2}";
byte slvAddrR = reviceData[0];
......@@ -465,7 +353,7 @@ namespace OnlineStore.DeviceLibrary
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadCoil, PreReadCoilAddr, "0000", 1);
//SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 6);
return GetCoilData(portName, reviceData, PreReadCoilAddr);
return GetCoilData(portName, reviceData, PreReadCoilAddr);
}
public static int GetBusyStatus(string portName, int slvAddr)
......@@ -474,7 +362,7 @@ namespace OnlineStore.DeviceLibrary
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadCoil, ACCMDManager.BUSYStatus, "0000", 1);
//SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 6);
return GetCoilData(portName, reviceData, ACCMDManager.BUSYStatus);
return GetCoilData(portName, reviceData, ACCMDManager.BUSYStatus);
}
public static int GetHomeEndStatus(string portName, int slvAddr)
......@@ -483,7 +371,7 @@ namespace OnlineStore.DeviceLibrary
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadCoil, ACCMDManager.HOME_CMP_Status, "0000", 1);
//SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 6);
return GetCoilData(portName, reviceData, ACCMDManager.HOME_CMP_Status);
return GetCoilData(portName, reviceData, ACCMDManager.HOME_CMP_Status);
}
public static int GetHomeSingle(string portName, int slvAddr)
......
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
......@@ -15,13 +16,16 @@ namespace OnlineStore.DeviceLibrary
public class ShuoKeControls
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static SerialBean bean = null;
private static AcSerialBean bean = null;
public static bool isRun = false;
private static Dictionary<int, ShuoKeInfo> shuokeMap = new Dictionary<int, ShuoKeInfo>();
public static string PortName = "";
private static int SleepMS = 50;
private static int DReviceLength = 5;
#region 串口操作
public static bool ResertInitPort(string comPortName, int baudRate, int tparity, int dataBits, StopBits stopBits)
{
PortName = comPortName;
if (isRun)
{
ClosePort();
......@@ -36,14 +40,15 @@ namespace OnlineStore.DeviceLibrary
}
try
{
PortName = comPortName;
Parity parity = (Parity)tparity;
bean = new SerialBean(comPortName, baudRate, parity, 8, stopBits);
bean = new AcSerialBean(comPortName, baudRate, parity, 8, stopBits);
bool result = bean.openPort();
if (!result)
{
return false;
}
bean.DataReceived += DataReceived;
//bean.DataReceived += DataReceived;
isRun = true;
}
catch (Exception ex)
......@@ -57,28 +62,68 @@ namespace OnlineStore.DeviceLibrary
public static void ClosePort()
{
isRun = false;
if (bean == null)
{
return;
}
bean.closePort();
LogUtil.info(LOGGER, "关闭步进控制器串口完成");
}
public static void SendData(byte[] data)
/// <summary>
/// 发送数据并获取返回值
/// </summary>
/// <param name="data">发送的数据</param>
/// <param name="outTime">超时时间</param>
/// <returns>返回值的长度</returns>
public static byte[] SendCommand(byte[] data, int outTime, int reviceLength)
{
string strSend = "";
for (int i = 0; i < data.Length; i++)
if (outTime <= 0)
{
strSend += string.Format("{0:X2} ", data[i]);
outTime = 30;
}
if (strSend.Equals(""))
if (outTime > 80)
{
return;
}
if (!isRun)
outTime = 80;
}
byte[] returnData = null;
try
{
LogUtil.error(LOGGER, "电机发送数据【" + strSend + "】,当前串口未连接上,发送失败!");
return;
}
LogUtil.debug(LOGGER, "电机发送数据【" + strSend + "】");
bean.SendData(data, 0, data.Length);
if (data == null)
{
return returnData;
}
string strSend = "";
for (int i = 0; i < data.Length; i++)
{
strSend += string.Format("{0:X2} ", data[i]);
}
if (strSend.Equals(""))
{
return returnData;
}
LogUtil.debug("串口" + PortName + " 写入数据:" + strSend + "");
if (bean == null)
{
LogUtil.debug(" 试图向未打开串口【" + PortName + "】写入数据:" + strSend + "。");
}
else
{
bean.SendCommand(data, ref returnData, outTime, reviceLength);
}
}
catch (Exception ex)
{
LogUtil.info(ex.ToString());
}
return returnData;
}
private static void DataReceived(string portName, object sender, SerialDataReceivedEventArgs e, byte[] bits)
{
string strSend = "";
......@@ -93,50 +138,133 @@ namespace OnlineStore.DeviceLibrary
//校验
ushort pChecksum = 0;
SerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum);
AcSerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr);
byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1)
{
if (!bits[bits.Length - 2].Equals(checkByte[0]))
{
bean.clearInBuffer();
LogUtil.info(LOGGER, "收到数据:端口号 【" + portName + "】 数据【" + strSend + "】,校验错误");
LogUtil.info(LOGGER, " 【" + portName + "】 收到数据【" + strSend + "】,校验错误");
return;
}
}
}
else
{
if (!bits[bits.Length - 1].Equals(checkByte[0]) || (!bits[bits.Length - 2].Equals(checkByte[1])))
{
bean.clearInBuffer();
LogUtil.info(LOGGER, "收到数据:端口号 【" + portName + "】 数据【" + strSend + "】,校验错误");
LogUtil.info(LOGGER, " 【" + portName + "】 收到数据【" + strSend + "】,校验错误");
return;
}
}
LogUtil.debug(LOGGER, "收到数据:端口号 【" + portName + "】 数据【" + strSend + "】");
LogUtil.debug(LOGGER, " 【" + portName + "】 收到数据【" + strSend + "】");
int slvAddr = (int)bits[0];
byte cmd = bits[1];
//查询状态
if (cmd.Equals(ShuoKeCMD.SearchMoveStatus))
{
ShuoKeInfo info = DataToStatus(bits);
}
else if (cmd.Equals(ShuoKeCMD.GetAbsPosition))
{
int position = DataToPosition(bits);
}
}
private static bool CheckByte(byte[] bits)
{
string strSend = "";
if (bits == null)
{
return false;
}
for (int i = 0; i < bits.Length; i++)
{
strSend += string.Format("{0:X2} ", bits[i]);
}
//校验
ushort pChecksum = 0;
AcSerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1)
{
if (!bits[bits.Length - 2].Equals(checkByte[0]))
{
bean.clearInBuffer();
LogUtil.info(LOGGER, "【" + PortName + "】收到数据【" + strSend + "】校验错误");
return false;
}
}
else
{
if (!bits[bits.Length - 1].Equals(checkByte[0]) || (!bits[bits.Length - 2].Equals(checkByte[1])))
{
bean.clearInBuffer();
LogUtil.info(LOGGER, "【" + PortName + "】收到数据【" + strSend + "】校验错误");
return false;
}
}
return true;
}
private static int DataToPosition(byte[] bits)
{
int absValue = -1;
if (!CheckByte(bits))
{
return absValue;
}
if (bits.Length >= 7)
{
int slvAddr = (int)bits[0];
byte[] positionData = new byte[4];
Array.Copy(bits, 3, positionData, 0, 4);
string a = AcSerialBean.byteToHexStr(positionData);
absValue = Convert.ToInt32(a, 16);
LogUtil.debug(LOGGER, "收到驱动器【" + slvAddr + "】绝对位置【" + absValue + "】");
if (shuokeMap.ContainsKey(slvAddr))
{
shuokeMap[slvAddr].LastPosition = absValue;
}
else
{
ShuoKeInfo info = new ShuoKeInfo(slvAddr, absValue);
shuokeMap.Add(slvAddr, info);
}
}
return absValue;
}
private static ShuoKeInfo DataToStatus(byte[] bits)
{
ShuoKeInfo info = new ShuoKeInfo(-1, -1);
if (!CheckByte(bits))
{
return info;
}
if (bits.Length >= 8)
{
//[数据1]:1表示运动中,0表示停止
//[数据2]:LL-左限位IO状态 1表示有效 0表示无效
//[数据3]:O-原点IO状态 1表示有效 0表示无效,,=1表示原点灭,=0表示当前原点亮
// [数据4]:RL-右限位IO状态 1表示有效 0表示无效
//[数据5]:EN-使能IO状态 1表示有效 0表示无效
int slvAddr = (int)bits[0];
byte cmd = bits[1];
int isInMove = bits[3];
int isLLimit = bits[4];
int isOrg = bits[5];
int isRLimit = bits[6];
int isEn = bits[7];
info = new ShuoKeInfo(isInMove, slvAddr, isLLimit, isOrg, isRLimit, isEn);
try
{
ShuoKeInfo info = new ShuoKeInfo(isInMove, slvAddr, isLLimit, isOrg, isRLimit, isEn);
if (shuokeMap.ContainsKey(slvAddr))
{
info.LastPosition = shuokeMap[slvAddr].LastPosition;
shuokeMap.Remove(slvAddr);
}
shuokeMap.Add(slvAddr, info);
......@@ -147,40 +275,48 @@ namespace OnlineStore.DeviceLibrary
}
LogUtil.debug(LOGGER, "收到驱动器【" + slvAddr + "】运动状态:运动【" + isInMove + "】左限位【" + isLLimit + "】右限位【" + isRLimit + "】原点【" + isOrg + "】使能【" + isEn + "】");
}
else if (cmd.Equals(ShuoKeCMD.GetAbsPosition))
return info;
}
public static int GetLastPosition(int slvAddr)
{
if (shuokeMap.ContainsKey(slvAddr))
{
byte[] positionData = new byte[4];
Array.Copy(bits, 3, positionData, 0, 4);
string a = SerialBean.byteToHexStr(positionData);
int absValue = Convert.ToInt32(a, 16);
LogUtil.info(LOGGER, "收到驱动器【" + slvAddr + "】绝对位置【" + absValue + "】");
ShuoKeInfo info = shuokeMap[slvAddr];
return info.LastPosition;
}
}
return -1;
}
#endregion
#region 流水线逻辑判断
#region 逻辑判断
public static bool IsMoveEnd(int slvAddr,DateTime time)
public static bool IsMoveEnd(int slvAddr, int targetPosition, DateTime time, out string msg)
{
if (shuokeMap.ContainsKey(slvAddr))
ShuoKeInfo shuokeInfo = GetStatus(slvAddr);
msg = " IsInMove【" + shuokeInfo.IsInMove + "】 ";
if (shuokeInfo.IsInMove == 0 && shuokeInfo.UpdateTime > time)
{
ShuoKeInfo info = shuokeMap[slvAddr];
if (info.IsInMove == 0 && info.UpdateTime > time)
int position = GetABSPosition(slvAddr);
msg += "位置【" + position + "】";
if (Math.Abs(position - targetPosition) < 10 || targetPosition.Equals(-2000))
{
return true;
}
else
{
LogUtil.info("【" + PortName + "】 目标位置【" + targetPosition + "】当前位置【" + position + "】,已经不再运动中");
}
}
return false;
}
public static bool IsHomeMoveEnd(int slvAddr, DateTime time)
public static bool IsHomeMoveEnd(int slvAddr, DateTime time, out string msg)
{
if (shuokeMap.ContainsKey(slvAddr))
ShuoKeInfo shuokeInfo = GetStatus(slvAddr);
msg = " IsInMove【" + shuokeInfo.IsInMove + "】Org【" + shuokeInfo.Org + "】";
if (shuokeInfo.IsInMove.Equals(0) && shuokeInfo.Org.Equals(0) && shuokeInfo.UpdateTime > time)
{
ShuoKeInfo info = shuokeMap[slvAddr];
if (info.IsInMove == 0 && info.UpdateTime > time&&info.Org==0)
{
return true;
}
return true;
}
return false;
}
......@@ -188,34 +324,37 @@ namespace OnlineStore.DeviceLibrary
#region 驱动器操作方法
public static void GetStatus(int slvAddr)
public static ShuoKeInfo GetStatus(int slvAddr)
{
byte[] sendData = WriteData(slvAddr, ShuoKeCMD.SearchMoveStatus, 0x00, 0);
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.SearchMoveStatus, 0x00, 0, 10);
return DataToStatus(reviceData);
}
public static void DStoop(int slvAddr)
{
byte[] sendData = WriteData(slvAddr, ShuoKeCMD.DStopMove, 0x00, 0);
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.DStopMove, 0x00, 0, DReviceLength);
}
public static void SuddownStop(int slvAddr)
{
byte[] sendData = WriteData(slvAddr, ShuoKeCMD.SuddownStopMove, 0x00, 0);
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.SuddownStopMove, 0x00, 0, DReviceLength);
}
public static void GetABSPosition(int slvAddr)
public static int GetABSPosition(int slvAddr)
{
byte[] sendData = WriteData(slvAddr, ShuoKeCMD.GetAbsPosition, 0x00, 0);
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.GetAbsPosition, 0x00, 0, 9);
return DataToPosition(reviceData);
}
/// <summary>
///
/// </summary>
/// <param name="slvAddr"></param>
/// <param name="homeType">0=反方向,1=正方向</param>
// <param name="homeType">0=反方向,1=正方向</param>
public static void HomeMove(int slvAddr, byte homeType)
{
byte[] sendData = WriteData(slvAddr, ShuoKeCMD.HomeMove, 0x01, homeType);
string fangx = homeType.Equals(0) ? "反方向" : "正方向";
LogUtil.info("压紧轴原点返回:" + fangx);
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.HomeMove, 0x01, homeType, DReviceLength);
}
public static void VolMove(int slvAddr, int speed)
{
byte[] sendData = WriteData(slvAddr, ShuoKeCMD.VolMove, 0x04, speed);
{
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.VolMove, 0x04, speed, DReviceLength);
}
public static void AbsMove(int slvAddr, int TargetPosition)
......@@ -230,8 +369,8 @@ namespace OnlineStore.DeviceLibrary
//[CRC校验1] 0xnn [CRC校验1] 0xnn
//[CRC校验2] 0xnn [CRC校验2] 0xnn
//数据:4BYTE,(支持32位有符号脉冲位置)
byte[] sendData = WriteData(slvAddr, ShuoKeCMD.AbsMove, 0x04, TargetPosition);
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.AbsMove, 0x04, TargetPosition, DReviceLength);
}
public static void RelativeMove(int slvAddr, int position)
{
......@@ -253,7 +392,7 @@ namespace OnlineStore.DeviceLibrary
sendData[5] = 0x00;
sendData[6] = 0x00;
string speed = Convert.ToString(position, 16);
byte[] speedByte = SerialBean.StringToByte(speed);
byte[] speedByte = AcSerialBean.StringToByte(speed);
for (int i = 0; i < speedByte.Length; i++)
{
......@@ -265,13 +404,14 @@ namespace OnlineStore.DeviceLibrary
}
sendData[3] = fangxiang;
sendData = buildCheckData(sendData, 3 + dataLength);
SendData(sendData);
byte[] reviceData = SendCommand(sendData, SleepMS, DReviceLength);
Thread.Sleep(SleepMS);
}
public static void PositionClear(int slvAddr, byte setCMD)
{
byte[] sendData = WriteData(slvAddr, setCMD, 0x00, 0);
{
byte[] reviceData = SendData(slvAddr, setCMD, 0x00, 0, DReviceLength);
}
/// <summary>
/// 设置电机的速度
/// </summary>
......@@ -279,11 +419,12 @@ namespace OnlineStore.DeviceLibrary
/// <param name="setCMD">设置速度的命令号</param>
/// <param name="speedValue">速度值</param>
public static void SetSpeed(int slvAddr, byte setCMD, int speedValue)
{
byte[] sendData = WriteData(slvAddr, setCMD, 0x04, speedValue);
{
byte[] reviceData = SendData(slvAddr, setCMD, 0x04, speedValue, DReviceLength);
Thread.Sleep(10);
}
private static byte[] WriteData(int slvAddr, byte cmd, byte dataLength, int dataValue)
private static byte[] SendData(int slvAddr, byte cmd, byte dataLength, int dataValue, int reviceDataLength)
{
byte[] sendData = new byte[5 + dataLength];
sendData[0] = (byte)slvAddr;
......@@ -303,7 +444,7 @@ namespace OnlineStore.DeviceLibrary
sendData[5] = 0x00;
sendData[6] = 0x00;
string speed = Convert.ToString(dataValue, 16);
byte[] speedByte = SerialBean.StringToByte(speed);
byte[] speedByte = AcSerialBean.StringToByte(speed);
for (int i = 0; i < speedByte.Length; i++)
{
......@@ -315,15 +456,16 @@ namespace OnlineStore.DeviceLibrary
}
}
sendData = buildCheckData(sendData, 3 + dataLength);
SendData(sendData);
return sendData;
byte[] reviceData = SendCommand(sendData, SleepMS, reviceDataLength);
Thread.Sleep(SleepMS);
return reviceData;
}
private static byte[] buildCheckData(byte[] sendData, int length)
{
ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum);
AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr);
byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1)
{
sendData[length] = checkByte[0];
......@@ -414,16 +556,29 @@ namespace OnlineStore.DeviceLibrary
public class ShuoKeInfo
{
public ShuoKeInfo(int slv, int position)
{
this.IsInMove = -1;
this.SlvAddr = slv;
this.LLimit = -1;
this.RLimit = -1;
this.Org = -1;
this.En = -1;
UpdateTime = DateTime.Now;
LastPosition = position;
}
public ShuoKeInfo(int ismove, int slv, int ll, int org, int rl, int en)
{
this.IsInMove = ismove;
this.SlvAddr=slv;
this.LLimit=ll;
this.RLimit=rl;
this.Org=org;
this.En=en;
UpdateTime=DateTime.Now;
this.SlvAddr = slv;
this.LLimit = ll;
this.RLimit = rl;
this.Org = org;
this.En = en;
UpdateTime = DateTime.Now;
LastPosition = 0;
}
public int LastPosition { get; set; }
/// <summary>
/// 驱动器地址
/// </summary>
......@@ -449,6 +604,11 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public int En { get; set; }
public DateTime UpdateTime { get; set; }
public DateTime UpdateTime { get; set; }
public string ToShowStr()
{
return "运动[" + IsInMove + "]左限位[" + LLimit + "]右限位[" + RLimit + "]原点[" + Org + "]使能[" + En + "][" + UpdateTime.ToShortTimeString() + "]";
}
}
}
......@@ -163,18 +163,9 @@ namespace OnlineStore.DeviceLibrary
}
else if (wait.WaitType == 5)
{
if (wait.IsHomeMove)
{
wait.IsEnd = ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime);
}
else
{
wait.IsEnd = ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime);
}
if (!wait.IsEnd)
{
ShuoKeControls.GetStatus(wait.SlvAddr);
}
string msg = "";
wait.IsEnd = ShuoKeIsEnd(wait, out msg);
NotOkMsg = NotOkMsg + " " + msg;
}
if (wait.IsEnd)
{
......@@ -206,7 +197,18 @@ namespace OnlineStore.DeviceLibrary
}
}
private bool ShuoKeIsEnd(WaitResultInfo wait, out string msg)
{
msg = "";
if (wait.IsHomeMove)
{
return ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out msg);
}
else
{
return ShuoKeControls.IsMoveEnd(wait.SlvAddr, wait.TargetPosition, StoreMove.LastSetpTime, out msg);
}
}
#endregion
#region 入库
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!