From bd676464185d6e4b5bfc04c2031acfbf497b9b52 Mon Sep 17 00:00:00 2001 From: xcd <834800634@qq.com> Date: 星期二, 30 六月 2020 08:54:21 +0800 Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071 --- src/Bro.Device.GTSCard/Bro.Device.GTSCard.csproj | 15 src/Bro.Device.GTSCard/GTSCardDriver.cs | 589 +++++++++++-- /dev/null | 78 - src/Bro.Device.GTSCard/GTS800.cfg | 793 ++++++++++++++++++ src/Bro.Device.GTSCard/gts.dll | 0 src/Bro.Device.GTSCard/packages.config | 4 src/Bro.Common.Model/Helper/EnumHelper.cs | 140 +++ src/Bro.Device.GTSCard/GTSCardConfig.cs | 918 ++++++++++++++++---- 8 files changed, 2,140 insertions(+), 397 deletions(-) diff --git a/src/Bro.Common.Model/Helper/EnumHelper.cs b/src/Bro.Common.Model/Helper/EnumHelper.cs index aa404aa..cc90e89 100644 --- a/src/Bro.Common.Model/Helper/EnumHelper.cs +++ b/src/Bro.Common.Model/Helper/EnumHelper.cs @@ -443,5 +443,145 @@ [Description("鐩告満鍧愭爣绯荤浉瀵硅繍鍔�")] CameraRelativeMove = 12, } + + /// <summary> + /// 椹揪/杩愬姩鏉垮崱杩愯妯″紡 + /// </summary> + public enum MotorMoveMode + { + /// <summary> + /// 鏅�氱偣浣嶈繍鍔� + /// </summary> + [Description("鏅�氱偣浣嶈繍鍔�")] + Normal = 1, + + ///// <summary> + ///// 楂橀�熺瓑璺濊繍鍔� + ///// </summary> + //[Description("楂橀�熺瓑璺濊繍鍔�")] + //HighSpeedStep = 2, + + ///// <summary> + ///// 楂橀�熶笉绛夎窛杩愬姩 + ///// </summary> + //[Description("楂橀�熶笉绛夎窛杩愬姩")] + //HighSpeed = 3, + + /// <summary> + /// 鎵炬闄愪綅杩愬姩 + /// </summary> + [Description("鎵炬闄愪綅杩愬姩")] + FindPositive = 4, + + /// <summary> + /// 绂诲紑姝i檺浣� + /// </summary> + [Description("绂诲紑姝i檺浣�")] + LeavePositive = 5, + + /// <summary> + /// 鎵捐礋闄愪綅杩愬姩 + /// </summary> + [Description("鎵捐礋闄愪綅杩愬姩")] + FindNegative = 6, + + /// <summary> + /// 绂诲紑璐熼檺浣� + /// </summary> + [Description("绂诲紑璐熼檺浣�")] + LeaveNegative = 7, + + /// <summary> + /// 鎵惧師鐐硅繍鍔� + /// </summary> + [Description("鎵惧師鐐硅繍鍔�")] + FindOri = 8, + + /// <summary> + /// Jog妯″紡 + /// </summary> + [Description("Jog妯″紡")] + Jog = 9, + + /// <summary> + /// 璇绘暟澶存壘鍘熺偣鏂瑰紡 + /// </summary> + [Description("璇绘暟澶存壘鍘熺偣鏂瑰紡")] + FindOriIndex = 10, + + /// <summary> + /// 鎻掕ˉ妯″紡 + /// </summary> + [Description("鎻掕ˉ妯″紡")] + Coordinate = 11, + + ///// <summary> + ///// 鍒�鍚戞洿闅忓姛鑳� + ///// </summary> + //[Description("鍒�鍚戞洿闅忓姛鑳�")] + //BufMove = 12, + } + + /// <summary> + /// 椹揪IO瀹氫箟绫诲瀷 + /// </summary> + public enum MotorIODefine + { + Nothing, + InputStartLeft, + InputStartRight, + InputCurtainLeft, + InputCurtainRight, + InputSafeDoor, + InputEmergency, + InputReset, + InputScrew1, + InputScrew2, + InputSuckLeft, + InputSuckRight, + InputSuckXYZ, + InputCylinderLeftLimitFront, + InputCylinderLeftLimitBack, + InputCylinderRightLimitFront, + InputCylinderRightLimitBack, + + + OutputYellow, + OutputGreen, + OutputRed, + OutputBeep, + OutputLight, + OutputMotorPower, + OutputInitOK, + OutputZLock, + OutputLeftCylinder, + OutputRightCylinder, + OutputLeftSuck, + OutputRightSuck, + OutputScrewBlow, + OutputCamera, + OutputScrewSuck, + } + + /// <summary> + /// GTS杩愬姩鏉垮崱鎺у埗杩斿洖鎺у埗鐮� + /// </summary> + public enum GTSRetCode + { + [Description("鎸囦护鎵ц鎴愬姛")] + GRCRunOK = 0, // 鎸囦护鎵ц鎴愬姛 + [Description("鎸囦护鎵ц閿欒")] + GRCRunErr = 1, // 鎸囦护鎵ц閿欒 + [Description("icense涓嶆敮鎸�")] + GRCNotSupport = 2, // icense涓嶆敮鎸� + [Description("鎸囦护鍙傛暟閿欒")] + GRCInvalidParam = 7, // 鎸囦护鍙傛暟閿欒 + [Description("涓绘満鍜岃繍鍔ㄦ帶鍒跺櫒閫氳澶辫触")] + GRCCommErr = -1, // 涓绘満鍜岃繍鍔ㄦ帶鍒跺櫒閫氳澶辫触 + [Description("鎵撳紑鎺у埗鍣ㄥけ璐�")] + GRCOpenErr = -6, // 鎵撳紑鎺у埗鍣ㄥけ璐� + [Description("杩愬姩鎺у埗鍣ㄦ病鏈夊搷搴�")] + GRCNotAck = -7 // 杩愬姩鎺у埗鍣ㄦ病鏈夊搷搴� + } } } diff --git a/src/Bro.Device.GTSCard/Bro.Device.GTSCard.csproj b/src/Bro.Device.GTSCard/Bro.Device.GTSCard.csproj index d26bb8b..88abfb9 100644 --- a/src/Bro.Device.GTSCard/Bro.Device.GTSCard.csproj +++ b/src/Bro.Device.GTSCard/Bro.Device.GTSCard.csproj @@ -31,6 +31,9 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Configuration" /> <Reference Include="System.Core" /> @@ -45,12 +48,7 @@ <ItemGroup> <Compile Include="GTSCardDriver.cs" /> <Compile Include="GTSCardConfig.cs" /> - <Compile Include="GtsCardManager.cs" /> <Compile Include="GTSCardAPI.cs" /> - <Compile Include="GtsIO.cs" /> - <Compile Include="GtsMotionCard.cs" /> - <Compile Include="GtsParameter.cs" /> - <Compile Include="GtsPos.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> @@ -63,5 +61,12 @@ <Name>Bro.Common.Model</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <Content Include="gts.dll" /> + </ItemGroup> + <ItemGroup> + <None Include="GTS800.cfg" /> + <None Include="packages.config" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project> \ No newline at end of file diff --git a/src/Bro.Device.GTSCard/GTS800.cfg b/src/Bro.Device.GTSCard/GTS800.cfg new file mode 100644 index 0000000..ac68f46 --- /dev/null +++ b/src/Bro.Device.GTSCard/GTS800.cfg @@ -0,0 +1,793 @@ +[profile1] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile2] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile3] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile4] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile5] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile6] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile7] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile8] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[axis1] +active=1 +alarmType=2 +alarmIndex=1 +limitPositiveType=0 +limitPositiveIndex=1 +limitNegativeType=1 +limitNegativeIndex=1 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=5 +prfMap=0x1 +encMap=0x1 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis2] +active=1 +alarmType=2 +alarmIndex=2 +limitPositiveType=0 +limitPositiveIndex=2 +limitNegativeType=1 +limitNegativeIndex=2 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=5 +prfMap=0x2 +encMap=0x2 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis3] +active=1 +alarmType=2 +alarmIndex=3 +limitPositiveType=0 +limitPositiveIndex=3 +limitNegativeType=1 +limitNegativeIndex=3 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=5 +prfMap=0x4 +encMap=0x4 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis4] +active=1 +alarmType=2 +alarmIndex=4 +limitPositiveType=0 +limitPositiveIndex=4 +limitNegativeType=1 +limitNegativeIndex=4 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=5 +prfMap=0x8 +encMap=0x8 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis5] +active=1 +alarmType=2 +alarmIndex=5 +limitPositiveType=0 +limitPositiveIndex=5 +limitNegativeType=1 +limitNegativeIndex=5 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x10 +encMap=0x10 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis6] +active=1 +alarmType=2 +alarmIndex=6 +limitPositiveType=0 +limitPositiveIndex=6 +limitNegativeType=1 +limitNegativeIndex=6 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x20 +encMap=0x20 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis7] +active=1 +alarmType=2 +alarmIndex=7 +limitPositiveType=0 +limitPositiveIndex=7 +limitNegativeType=1 +limitNegativeIndex=7 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x40 +encMap=0x40 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis8] +active=1 +alarmType=2 +alarmIndex=8 +limitPositiveType=0 +limitPositiveIndex=8 +limitNegativeType=1 +limitNegativeIndex=8 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x80 +encMap=0x80 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[dac1] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac2] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac3] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac4] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac5] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac6] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac7] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac8] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac9] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac10] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac11] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac12] +active=1 +control=-1 +reverse=0 +bias=0 +limit=32767 +[step1] +active=1 +axis=1 +mode=0 +parameter=0 +reverse=0 +[step2] +active=1 +axis=2 +mode=0 +parameter=0 +reverse=0 +[step3] +active=1 +axis=3 +mode=0 +parameter=0 +reverse=0 +[step4] +active=1 +axis=4 +mode=0 +parameter=0 +reverse=0 +[encoder1] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder2] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder3] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder4] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder5] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder6] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder7] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder8] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder9] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder10] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder11] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[enable1] +active=1 +axis=1 +axisItem=-1 +reverse=1 +[enable2] +active=1 +axis=2 +axisItem=-1 +reverse=1 +[enable3] +active=1 +axis=3 +axisItem=-1 +reverse=1 +[enable4] +active=1 +axis=4 +axisItem=-1 +reverse=1 +[enable5] +active=1 +axis=5 +axisItem=-1 +reverse=1 +[enable6] +active=1 +axis=6 +axisItem=-1 +reverse=1 +[enable7] +active=1 +axis=7 +axisItem=-1 +reverse=1 +[enable8] +active=1 +axis=8 +axisItem=-1 +reverse=1 +[clear1] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear2] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear3] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear4] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear5] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear6] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear7] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear8] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo1] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo2] +active=1 +axis=-1 +axisItem=-1 +reverse=1 +[gpo3] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo4] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo5] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo6] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo7] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo8] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo9] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo10] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo11] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo12] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo13] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo14] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo15] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo16] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[limitPositive1] +active=1 +reverse=0 +filterTime=3 +[limitPositive2] +active=1 +reverse=0 +filterTime=3 +[limitPositive3] +active=1 +reverse=0 +filterTime=3 +[limitPositive4] +active=1 +reverse=0 +filterTime=3 +[limitPositive5] +active=1 +reverse=0 +filterTime=3 +[limitPositive6] +active=1 +reverse=0 +filterTime=3 +[limitPositive7] +active=1 +reverse=0 +filterTime=3 +[limitPositive8] +active=1 +reverse=0 +filterTime=3 +[limitNegative1] +active=1 +reverse=0 +filterTime=3 +[limitNegative2] +active=1 +reverse=0 +filterTime=3 +[limitNegative3] +active=1 +reverse=0 +filterTime=3 +[limitNegative4] +active=1 +reverse=0 +filterTime=3 +[limitNegative5] +active=1 +reverse=0 +filterTime=3 +[limitNegative6] +active=1 +reverse=0 +filterTime=3 +[limitNegative7] +active=1 +reverse=0 +filterTime=3 +[limitNegative8] +active=1 +reverse=0 +filterTime=3 +[alarm1] +active=1 +reverse=0 +filterTime=3 +[alarm2] +active=1 +reverse=0 +filterTime=3 +[alarm3] +active=1 +reverse=0 +filterTime=3 +[alarm4] +active=1 +reverse=0 +filterTime=3 +[alarm5] +active=1 +reverse=0 +filterTime=3 +[alarm6] +active=1 +reverse=0 +filterTime=3 +[alarm7] +active=1 +reverse=0 +filterTime=3 +[alarm8] +active=1 +reverse=0 +filterTime=3 +[home1] +active=1 +reverse=0 +filterTime=3 +[home2] +active=1 +reverse=0 +filterTime=3 +[home3] +active=1 +reverse=0 +filterTime=3 +[home4] +active=1 +reverse=0 +filterTime=3 +[home5] +active=1 +reverse=0 +filterTime=3 +[home6] +active=1 +reverse=0 +filterTime=3 +[home7] +active=1 +reverse=0 +filterTime=3 +[home8] +active=1 +reverse=0 +filterTime=3 +[gpi1] +active=1 +reverse=0 +filterTime=3 +[gpi2] +active=1 +reverse=0 +filterTime=3 +[gpi3] +active=1 +reverse=0 +filterTime=3 +[gpi4] +active=1 +reverse=0 +filterTime=3 +[gpi5] +active=1 +reverse=0 +filterTime=3 +[gpi6] +active=1 +reverse=0 +filterTime=3 +[gpi7] +active=1 +reverse=0 +filterTime=3 +[gpi8] +active=1 +reverse=0 +filterTime=3 +[gpi9] +active=1 +reverse=0 +filterTime=3 +[gpi10] +active=1 +reverse=0 +filterTime=3 +[gpi11] +active=1 +reverse=0 +filterTime=3 +[gpi12] +active=1 +reverse=0 +filterTime=3 +[gpi13] +active=1 +reverse=0 +filterTime=3 +[gpi14] +active=1 +reverse=0 +filterTime=3 +[gpi15] +active=1 +reverse=0 +filterTime=3 +[gpi16] +active=1 +reverse=0 +filterTime=3 +[arrive1] +active=1 +reverse=0 +filterTime=3 +[arrive2] +active=1 +reverse=0 +filterTime=3 +[arrive3] +active=1 +reverse=0 +filterTime=3 +[arrive4] +active=1 +reverse=0 +filterTime=3 +[arrive5] +active=1 +reverse=0 +filterTime=3 +[arrive6] +active=1 +reverse=0 +filterTime=3 +[arrive7] +active=1 +reverse=0 +filterTime=3 +[arrive8] +active=1 +reverse=0 +filterTime=3 +[mpg1] +active=1 +reverse=0 +filterTime=3 +[mpg2] +active=1 +reverse=0 +filterTime=3 +[mpg3] +active=1 +reverse=0 +filterTime=3 +[mpg4] +active=1 +reverse=0 +filterTime=3 +[mpg5] +active=1 +reverse=0 +filterTime=3 +[mpg6] +active=1 +reverse=0 +filterTime=3 +[mpg7] +active=1 +reverse=0 +filterTime=3 diff --git a/src/Bro.Device.GTSCard/GTSCardConfig.cs b/src/Bro.Device.GTSCard/GTSCardConfig.cs index 49d9c60..e56fd79 100644 --- a/src/Bro.Device.GTSCard/GTSCardConfig.cs +++ b/src/Bro.Device.GTSCard/GTSCardConfig.cs @@ -1,247 +1,739 @@ 锘縰sing Bro.Common.Base; using Bro.Common.Helper; using Bro.Common.Interface; +using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel; using System.Configuration; using System.Drawing.Design; +using System.Linq; +using System.Threading; +using static Bro.Common.Helper.EnumHelper; namespace Bro.Device.GTSCard { - public abstract class GTSCardOperationConfigBase : OperationConfigBase + + [Device("GTSCard", "鍥洪珮鏉垮崱", EnumHelper.DeviceAttributeType.OperationConfig)] + public class GTSCardOperationConfig : OperationConfigBase, IComplexDisplay { - ///// <summary> - ///// 闇�瑕佹搷浣滅殑PLC椤� - ///// </summary> - //public List<PLCItem> Items { get; set; } = new List<PLCItem>(); + [Category("鏉垮崱杩愬姩閰嶇疆")] + [DisplayName("杩愬姩閰嶇疆闆嗗悎")] + [Description("MovingOps锛氳繍鍔ㄩ厤缃泦鍚�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<MovingOption>), typeof(UITypeEditor))] + public ObservableCollection<MovingOption> MovingOps { get; set; } = new ObservableCollection<MovingOption>(); + + public string GetDisplayText() + { + return MovingOps.Count() == 0 ? "--" : string.Join(";", MovingOps.Select(m => m.GetDisplayText())); + } } - //public class GTSCardInitialConfigBase : InitialConfigBase, IMonitorConfig - //{ - // [Category("椹卞姩绫诲瀷")] - // [Description("椹卞姩绫诲瀷")] - // [DisplayName("椹卞姩绫诲瀷")] - // [TypeConverter(typeof(PLCTypeConverter))] - // public override string DriverType { get; set; } + [Device("GTSCard", "鍥洪珮鏉垮崱", EnumHelper.DeviceAttributeType.OperationConfig)] + public class GTSCardInitialConfig : InitialConfigBase, IMonitorConfig + { + [Category("鏉垮崱閰嶇疆")] + [DisplayName("鍗″彿")] + [Description("CardNum锛氬崱鍙�")] + public int CardNum { get; set; } - // [Category("璀︽姤閰嶇疆")] - // [Description("璀︽姤閰嶇疆鍒楄〃")] - // [DisplayName("璀︽姤閰嶇疆")] - // [TypeConverter(typeof(CollectionCountConvert))] - // [Editor(typeof(WarningSetsEditor), typeof(UITypeEditor))] - // public List<WarningSet> WarningSetCollection { get; set; } = new List<WarningSet>(); + //[Category("鏉垮崱閰嶇疆")] + //[Description("IO鍗″彿")] + //public int IOCardNum { get; set; } - // #region IMonitorConfig - // [Category("鐩戝惉璁剧疆")] - // [Description("鐩戝惉鎿嶄綔閰嶇疆闆嗗悎")] - // [DisplayName("鐩戝惉閰嶇疆")] - // [TypeConverter(typeof(CollectionCountConvert))] - // [Editor(typeof(ComplexCollectionEditor<MonitorSet>), typeof(UITypeEditor))] - // public List<IMonitorSet> MonitorSetCollection { get; set; } = new List<IMonitorSet>(); + [Category("鏉垮崱閰嶇疆")] + [DisplayName("鍒濆閰嶇疆鏂囦欢璺緞")] + [Description("InitialConfigFilePath锛氬垵濮嬮厤缃枃浠惰矾寰�")] + [Editor(typeof(FileDialogEditor), typeof(UITypeEditor))] + public string InitialConfigFilePath { get; set; } - // [Category("鐩戝惉璁剧疆")] - // [Description("true锛氬惎鍔ㄧ洃鍚� false锛氬叧闂洃鍚�")] - // [DisplayName("鐩戝惉鍚敤")] - // public bool IsEnableMonitor { get; set; } = true; + [Category("IO鎵弿閰嶇疆")] + [DisplayName("鎵弿闂撮殧")] + [Description("ScanInterval锛氭壂鎻忛棿闅旓紝浠ユ绉掍负鍗曚綅")] + public int ScanInterval { get; set; } = 100; - // [Category("鐩戝惉璁剧疆")] - // [Description("鎵弿闂撮殧鏃堕棿锛屽崟浣嶏細ms")] - // [DisplayName("鎵弿闂撮殧")] - // public int MonitorInterval { get; set; } = 100; + [Category("杞撮厤缃�")] + [DisplayName("杞存暟閲�")] + [Description("AxisNum锛氳酱鏁伴噺")] + public int AxisNum { get; set; } = 2; - // [Category("鐩戝惉璁剧疆")] - // [Description("瓒呮椂璁剧疆锛屽崟浣嶏細ms")] - // [DisplayName("鐩戝惉瓒呮椂")] - // public int MonitorTimeout { get; set; } = 500; + [Category("杞撮厤缃�")] + [DisplayName("杞撮厤缃俊鎭泦鍚�")] + [Description("AxisSettings锛氳酱閰嶇疆淇℃伅闆嗗悎")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<AxisSetting>), typeof(UITypeEditor))] + public List<AxisSetting> AxisSettings { get; set; } = new List<AxisSetting>(); - // [Category("浜嬩欢鍦板潃璁剧疆")] - // [Description("浜嬩欢寮�濮嬪湴鍧�锛孭LC鐨勫疄闄呭瘎瀛樺櫒鍦板潃銆傚崄杩涘埗锛屼笉鍖呭惈鍔熻兘鐮併��")] - // [DisplayName("鐩戝惉寮�濮嬪湴鍧�")] - // public int EventStartAddress { get; set; } = 8000; + [Category("杞撮厤缃�")] + [DisplayName("杞撮�熷害姣旂巼")] + [Description("AxisVelocityRatio锛氳酱閫熷害姣旂巼")] + public double AxisVelocityRatio { get; set; } = 1; - // [Category("浜嬩欢鍦板潃璁剧疆")] - // [Description("浜嬩欢鍦板潃闀垮害锛屾渶澶ч暱搴�128")] - // [DisplayName("鐩戝惉闀垮害")] - // public int EventLength { get; set; } = 120; + [Category("寤舵椂閰嶇疆")] + [DisplayName("鍔ㄤ綔瀹屾垚鍚庡欢杩�")] + [Description("ActionAfterDelay锛氬姩浣滃畬鎴愬悗寤惰繜")] + public int ActionAfterDelay { get; set; } = 100; - // public List<IMonitorSet> GetAllMonitorSet() - // { - // WarningSetCollection.ForEach(m => m.Source = this.Name); + public bool IsEnableMonitor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public int MonitorInterval { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public int MonitorTimeout { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public List<IMonitorSet> MonitorSetCollection { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } - // MonitorSetCollection.ForEach(m => m.SourceDevice = this.Id); - // return MonitorSetCollection; - // } - // #endregion - - // #region IMotion Related - // [Category("杩愬姩閰嶇疆")] - // [Description("杩愬姩杞寸姸鎬侀泦鍚�")] - // [DisplayName("杩愬姩杞寸姸鎬侀泦鍚�")] - // [TypeConverter(typeof(CollectionCountConvert))] - // [Editor(typeof(ComplexCollectionEditor<PLCMotionDefinition_State>), typeof(UITypeEditor))] - // public List<PLCMotionDefinition_State> MotionStateCollection { get; set; } = new List<PLCMotionDefinition_State>(); - // #endregion - //} + public List<IMonitorSet> GetAllMonitorSet() + { + throw new NotImplementedException(); + } + } /// <summary> - /// 鐐逛綅绫诲瀷 + /// 杞撮厤缃� /// </summary> - public enum PosType + public class AxisSetting : IComplexDisplay { - /// <summary> - /// 鐩寸嚎鎻掕ˉ - /// </summary> - Line = 1, - /// <summary> - /// 鍦嗗姬鎻掕ˉ(鍗婂緞) - /// </summary> - CircleRadius, - /// <summary> - /// 鍦嗗姬鎻掕ˉ(鍦嗗績) - /// </summary> - CircleCenter + [Category("杞撮厤缃�")] + [DisplayName("杞村彿绱㈠紩")] + [Description("AxisIndex锛氳酱鍙风储寮�")] + public int AxisIndex { get; set; } + + [Category("杞撮厤缃�")] + [DisplayName("杞村悕绉�")] + [Description("AxisName锛氳酱鍚嶇О")] + public string AxisName { get; set; } + + [Category("杞撮厤缃�")] + [DisplayName("杞存槸鍚﹀惎鐢�")] + [Description("IsAxisEnabled锛氳酱鏄惁鍚敤")] + public bool IsAxisEnabled { get; set; } = false; + + [Category("鎹㈢畻閰嶇疆")] + [DisplayName("鑴夊啿鏁版崲绠楁瘮渚�")] + [Description("鑴夊啿鏁板拰鍏朵粬璁¢噺鍗曚綅鐨勬崲绠楁瘮渚嬶紝渚嬪璁剧疆涓�1000锛岃〃绀�1000涓剦鍐茬瓑浜�1uint")] + public int PulseRatio { get; set; } = 1; + + [Category("閫熷害閰嶇疆")] + [DisplayName("榛樿閫熷害鍙傛暟")] + [Description("VelocityPara锛氶粯璁ら�熷害鍙傛暟")] + [TypeConverter(typeof(ComplexObjectConvert))] + [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + public VelocityPara VelocityPara { get; set; } = new VelocityPara(); + + [Category("鍥炲師鐐硅缃�")] + [DisplayName("鍥炲師鐐规ā寮�")] + [Description("HomeMode锛氬洖鍘熺偣妯″紡銆�0锛氫竴鑸ā寮� 1锛氭瀬闄愰檺浣嶆ā寮� 2锛氬閮ㄨЕ鍙戞ā寮�")] + public int HomeMode { get; set; } = 0; + + [Category("鍥炲師鐐硅缃�")] + [DisplayName("鍥炲師鐐规柟鍚�")] + [Description("IsHomePositive锛氬洖鍘熺偣鏂瑰悜銆� true锛氭鏂瑰悜寮�濮� false锛氳礋鏂瑰悜寮�濮�")] + public bool IsHomePositive { get; set; } = true; + + [Category("鍥炲師鐐硅缃�")] + [DisplayName("鏄惁鑷姩鍥炲師鐐�")] + [Description("IsAutoGoHome锛氭槸鍚﹁嚜鍔ㄥ洖鍘熺偣銆� true锛氭槸 false锛氬惁")] + public bool IsAutoGoHome { get; set; } = false; + + [Category("瓒呮椂璁剧疆")] + [DisplayName("鍥炲師鐐硅秴鏃�")] + [Description("TimeOutHome锛氬洖鍘熺偣瓒呮椂锛屽崟浣嶆绉�")] + public int TimeOutHome { get; set; } = 30000; + + [Category("瓒呮椂璁剧疆")] + [DisplayName("杩愬姩瓒呮椂")] + [Description("TimeOutMove锛氳繍鍔ㄨ秴鏃讹紝鍗曚綅姣")] + public int TimeOutMove { get; set; } = 10000; + + [Category("寮�闂幆璁剧疆")] + [DisplayName("鏄惁浣跨敤Cmmd鍥為")] + [Description("IsUseCmmdPosition锛氭槸鍚︿娇鐢–mmd鍥為")] + public bool IsUseCmmdPosition { get; set; } = false; + + [Category("寮�闂幆璁剧疆")] + [DisplayName("鏄惁浣跨敤鏉垮崱鍙嶉鍋滄淇″彿")] + [Description("IsUseMDNStopSignal锛氭槸鍚︿娇鐢ㄦ澘鍗″弽棣堝仠姝俊鍙�")] + public bool IsUseMDNStopSignal { get; set; } = false; + + [Category("寮�闂幆璁剧疆")] + [DisplayName("鏄惁鍚敤鎶ヨ")] + [Description("IsUseWarning锛氭槸鍚﹀惎鐢ㄦ姤璀�")] + public bool IsUseWarning { get; set; } = false; + + [Category("鏆傚仠閰嶇疆")] + [DisplayName("鏄惁鍚敤绔嬪嵆鏆傚仠")] + [Description("IsImmediatePause锛氭槸鍚﹀惎鐢ㄧ珛鍗虫殏鍋�")] + public bool IsImmediatePause { get; set; } = false; + + [Category("鏆傚仠閰嶇疆")] + [DisplayName("杞翠綅缃浜庡尯闂村唴鏃堕�傜敤鐨勬殏鍋滄搷浣�")] + [Description("ImmediatePauseSections锛氬綋杞翠綅缃浜庡尯闂村唴鏃堕�傜敤鐨勬殏鍋滄搷浣�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<Section>), typeof(UITypeEditor))] + public List<Section> ImmediatePauseSections { get; set; } = new List<Section>(); + + public string GetDisplayText() + { + return AxisIndex + "-" + AxisName + "-" + (IsAxisEnabled ? "鍚敤" : "绂佺敤"); + } } - public static class GTSCardParameter + /// <summary> + /// 浣嶇疆瀵硅薄 + /// </summary> + public class Section : IComplexDisplay { - #region 杩愬姩鍙傛暟 - public static int Dangliang = 1; - public static int AxisCount = 2;//杩愬姩杞存暟閲� - public static short CardNum = Convert.ToInt16(ConfigurationManager.AppSettings["cardNum"]); - public static short fifo = Convert.ToInt16(ConfigurationManager.AppSettings["fifo"]); - public static int FlySpeed = Convert.ToInt32(ConfigurationManager.AppSettings["flySpeed"]); - public static double FlyAcc = Convert.ToDouble(ConfigurationManager.AppSettings["flyAcc"]); - public static int P2PSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["p2pSpeed"]); - public static double P2PAcc = Convert.ToDouble(ConfigurationManager.AppSettings["p2pAcc"]); - public static double P2PDec = Convert.ToDouble(ConfigurationManager.AppSettings["p2pDec"]); - public static int FreeSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["freeSpeed"]); - public static int VelEnd = Convert.ToInt32(ConfigurationManager.AppSettings["velEnd"]);//椋炴媿缁撴潫閫熷害 - public static int HomeSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["homeSpeed"]); - public static int Loading = Convert.ToInt32(ConfigurationManager.AppSettings["loading"]); - //public const short cardn = 0;//杩愬姩鎺у埗鍣ㄥ崱鍙� 榛樿涓猴細0 - //public const short crdn = 1;//鍧愭爣绯诲彿 鍙栧�艰寖鍥达細[1, 2] - //public const short fifo = 0;//鎻掕ˉ缂撳瓨鍖哄彿 鍙栧�艰寖鍥达細[0, 1]锛岄粯璁ゅ�间负锛�0 - //public const int flySpeed = 250;//椋炴媿閫熷害 - //public const double flyAcc = 0.5;//椋炴媿鍔犻�熷害 - //public const int gocatorSpeed = 150;//3D妫�娴嬭酱杩愬姩閫熷害 - //public const int p2pSpeed = 250;//P2P閫熷害 - //public const double p2pAcc = 1;//P2P鍔犻�熷害 - //public const double p2pDec = 1;//P2P鍑忛�熷害 - //public const int calibrationSpeed = 10;//鏍囧畾閫熷害 - //public const int calibrationZ = 19336;//鏍囧畾Z杞撮珮搴� - //public const int barcodeSpeed = 250;//鏉$爜妫�娴嬭酱杩愬姩閫熷害 - //public const int freeSpeed = 250;//闈炴娴嬫椂杞磋繍鍔ㄩ�熷害 - //public const int velEnd = 0;//椋炴媿缁撴潫閫熷害 - //public const int homeSpeed = 50;//鍥為浂閫熷害 - //public const int loading = 80000;//涓婃枡浣嶇疆 - #endregion + [Category("鏆傚仠鍖洪棿")] + [DisplayName("璧峰浣嶇疆")] + [Description("StartPosition锛氳捣濮嬩綅缃�")] + public int StartPosition { get; set; } - #region IO - /// <summary> - /// 杈撳叆IO榛樿鍊� - /// </summary> - public const int InDefaultValue = 0xFFDA; - /// <summary> - /// 澶圭揣姘旂几 - /// </summary> - public const short EXO_1 = 100;//澶圭揣姘旂几 - /// <summary> - /// 鏃ュ厜鐏� - /// </summary> - public const short EXO_2 = 101;//鏃ュ厜鐏� - /// <summary> - /// 鍏夋簮鍒囨崲 - /// </summary> - public const short EXO_3 = 102;//鍏夋簮鍒囨崲 - /// <summary> - /// 绾㈢伅 - /// </summary> - public const short EXO_4 = 103;//绾㈢伅 - /// <summary> - /// 榛勭伅 - /// </summary> - public const short EXO_5 = 104;//榛勭伅 - /// <summary> - /// 缁跨伅 - /// </summary> - public const short EXO_6 = 105;//缁跨伅 - /// <summary> - /// 铚傞福鍣� - /// </summary> - public const short EXO_7 = 106;//铚傞福鍣� - /// <summary> - /// Gocator X - /// </summary> - public const short EXO_8 = 107;//Gocator X + [Category("鏆傚仠鍖洪棿")] + [DisplayName("缁撴潫浣嶇疆")] + [Description("EndPosition锛氱粨鏉熶綅缃�")] + public int EndPosition { get; set; } - /// <summary> - /// 姝i潰鍏�(宸�) - /// </summary> - public const short EXO_9 = 108;//姝i潰鍏�(宸�) - - /// <summary> - /// 姝i潰鍏�(鍚�) - /// </summary> - public const short EXO_10 = 109;//姝i潰鍏�(鍚�) - - /// <summary> - /// 姝i潰鍏�(鍙�) - /// </summary> - public const short EXO_11 = 110;//姝i潰鍏�(鍙�) - - /// <summary> - /// 姝i潰鍏�(鍓�) - /// </summary> - public const short EXO_12 = 111;//姝i潰鍏�(鍓�) - - /// <summary> - /// Gocator Y - /// </summary> - public const short EXO_16 = 115;//Gocator Y - - /// <summary> - /// 杈撳嚭IO榛樿鍊� - /// </summary> - public const int OutDefaultValue = 0xFFF; - /// <summary> - /// 宸﹀惎鍔� - /// </summary> - public const short EXI0 = 0;//宸﹁捣鍔� - /// <summary> - /// 鍙冲惎鍔� - /// </summary> - public const short EXI1 = 1;//鍙宠捣鍔� - /// <summary> - /// 鍋滄 - /// </summary> - public const short EXI2 = 2;//鍋滄 - /// <summary> - /// 澶嶄綅 - /// </summary> - public const short EXI3 = 3;//澶嶄綅 - /// <summary> - /// 鎬ュ仠 - /// </summary> - public const short EXI4 = 4;//鎬ュ仠 - /// <summary> - /// 闂ㄥ紑鍏� - /// </summary> - public const short EXI5 = 5;//闂ㄥ紑鍏� - /// <summary> - /// 瀹夊叏鍏夊箷 - /// </summary> - public const short EXI6 = 6;//瀹夊叏鍏夊箷 - - public const short EXI7 = 7;// - /// <summary> - /// 澶圭揣姘旂几鍘熶綅 - /// </summary> - public const short EXI8 = 8;//澶圭揣姘旂几鍘熶綅 - /// <summary> - /// 澶圭揣姘旂几鍒颁綅 - /// </summary> - public const short EXI9 = 9;//澶圭揣姘旂几鍒颁綅 - #endregion + public string GetDisplayText() + { + return $"{StartPosition}--{EndPosition}"; + } } + + /// <summary> + /// 閫熷害鍙傛暟瀵硅薄 + /// </summary> + public class VelocityPara + { + [Category("閫熷害閰嶇疆")] + [DisplayName("閫熷害")] + [Description("Velocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + public double Velocity { get; set; } = 0; + + [Category("閫熷害閰嶇疆")] + [DisplayName("鍔犻�熷害")] + [Description("Acc锛氬姞閫熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + public double Acc { get; set; } = 0; + + [Category("閫熷害閰嶇疆")] + [DisplayName("鍑忛�熷害")] + [Description("鍑忛�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆銆傚洖鍘熺偣妯″紡鏃惰缃负鏇茬嚎鍙傛暟")] + public double Dec { get; set; } = 0; + } + + /// <summary> + /// 鍥炲師鐐瑰弬鏁板璞� + /// </summary> + public class GoHomePara + { + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规柟寮�")] + [Description("HomeMode锛氬洖鍘熺偣鏂瑰紡 锛圚OME_MODE_LIMIT = 10; HOME_MODE_LIMIT_HOME = 11; HOME_MODE_LIMIT_INDEX = 12; HOME_MODE_LIMIT_HOME_INDEX = 13;HOME_MODE_HOME = 20;HOME_MODE_HOME_INDEX = 22;HOME_MODE_INDEX = 30;")] + public short HomeMode { get; set; } = 11; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规柟鍚�")] + [Description("HomeDir锛�1 姝e悜锛�-1 璐熷悜")] + public short HomeDir { get; set; } = 1; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规柟鍚�")] + [Description("HomeDir锛�1 姝e悜锛�-1 璐熷悜")] + public short Edge { get; set; } = 0; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规渶浣庨�熷害")] + [Description("LowVelocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + public double LowVelocity { get; set; } = 50; + + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规渶楂橀�熷害")] + [Description("HighVelocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + public double HighVelocity { get; set; } = 50; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鎼滄悳璺濈")] + [Description("SearchHomeDistance锛氭悳鎼滆窛绂�")] + public int SearchHomeDistance { get; set; } = 9999999; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍋忕Щ璺濈")] + [Description("HomeOffset锛氬亸绉昏窛绂�")] + public int HomeOffset { get; set; } = 0; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("璺宠繃姝ラ暱")] + [Description("EscapeStep锛氳烦杩囨闀�")] + public int EscapeStep { get; set; } = 1000; + + } + + /// <summary> + /// 杩愬姩瀵硅薄 + /// </summary> + public class MovingOption : INotifyPropertyChanged, IComplexDisplay + { + private int axisIndex = 0; + [Category("杩愬姩閰嶇疆")] + [DisplayName("杩愬姩杞寸储寮�")] + [Description("AxisIndex锛氳繍鍔ㄨ酱绱㈠紩")] + [TypeConverter(typeof(AxisIndexConvert))] + public int AxisIndex + { + get => axisIndex; + set + { + if (axisIndex != value) + { + axisIndex = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("AxisIndex")); + } + axisIndex = value; + } + } + + private MotorMoveMode moveMode = MotorMoveMode.Normal; + [Category("杩愬姩閰嶇疆")] + [DisplayName("杩愬姩妯″紡")] + [Description("MoveMode锛氳繍鍔ㄦā寮�")] + public MotorMoveMode MoveMode + { + get => moveMode; + set + { + if (moveMode != value) + { + moveMode = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MoveMode")); + } + + moveMode = value; + } + } + + private bool isAbsolute = true; + [Category("杩愬姩閰嶇疆")] + [DisplayName("鏄惁缁濆杩愬姩")] + [Description("IsAbsolute锛氭槸鍚︾粷瀵硅繍鍔�")] + public bool IsAbsolute + { + get => isAbsolute; + set + { + if (isAbsolute != value) + { + isAbsolute = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsAbsolute")); + } + + isAbsolute = value; + } + } + + private int destination = 0; + [Category("杩愬姩閰嶇疆")] + [DisplayName("鐩殑鍦�")] + [Description("Destination锛氱洰鐨勫湴")] + public int Destination + { + get => destination; + set + { + if (destination != value) + { + destination = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Destination")); + } + + destination = value; + } + } + + private VelocityPara velocityPara = new VelocityPara(); + [Category("杩愬姩閰嶇疆")] + [DisplayName("閫熷害鍙傛暟")] + [Description("VelocityPara锛氶�熷害鍙傛暟")] + [TypeConverter(typeof(ComplexObjectConvert))] + [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + public VelocityPara VelocityPara + { + get => velocityPara; + set + { + velocityPara = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("VelocityPara")); + } + } + + private GoHomePara goHomePara = new GoHomePara(); + [Category("杩愬姩閰嶇疆")] + [DisplayName("鍥炲師鐐瑰弬鏁�")] + [Description("GoHomePara锛氶�熷害鍙傛暟")] + [TypeConverter(typeof(ComplexObjectConvert))] + [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + public GoHomePara GoHomePara + { + get => goHomePara; + set + { + goHomePara = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("GoHomePara")); + } + } + + internal List<AxisSetting> _axisSettingList = new List<AxisSetting>(); + public void SetAxisSetting(List<AxisSetting> settings) + { + if (settings != null) + _axisSettingList = settings; + } + + public string GetDisplayText() + { + string axisName = AxisIndex.ToString(); + var axisSet = _axisSettingList.FirstOrDefault(a => a.AxisIndex == AxisIndex); + if (axisSet != null) + { + axisName += ("-" + axisSet.AxisName); + } + return axisName + "," + MoveMode.ToString() + "," + (IsAbsolute ? "Abs" : "Rel") + "," + Destination; + } + public event PropertyChangedEventHandler PropertyChanged; + } + + public class AxisIndexConvert : TypeConverter + { + Dictionary<int, string> _indexNameDict = new Dictionary<int, string>(); + + public override bool GetStandardValuesSupported(ITypeDescriptorContext context) + { + return true; + } + + public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + { + MovingOption mo = context.Instance as MovingOption; + + _indexNameDict = mo._axisSettingList.ToDictionary(a => a.AxisIndex, a => a.AxisIndex + "-" + a.AxisName); + + return new StandardValuesCollection(_indexNameDict.Keys); + } + + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(string)) + { + return true; + } + return base.CanConvertFrom(context, sourceType); + } + + public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v) + { + if (v is string) + { + foreach (var indexName in _indexNameDict) + { + if (indexName.Value == v.ToString()) + { + return indexName.Key; + } + } + return Convert.ToInt32(v); + } + return base.ConvertFrom(context, culture, v); + } + + public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v, Type destinationType) + { + if (destinationType == typeof(string)) + { + if (_indexNameDict.ContainsKey(Convert.ToInt32(v))) + { + return _indexNameDict[Convert.ToInt32(v)]; + } + } + return base.ConvertTo(context, culture, v, destinationType); + } + + public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) + { + return false; + } + } + + public class AxisConflictSet : IComplexDisplay + { + [Category("1.杞村啿绐佹潯浠�")] + [Description("杞村啿绐佹潯浠讹紝婊¤冻鍏ㄩ儴鏉′欢鏃惰酱杩愬姩闇�瑕佹鏌ュ啿绐�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<AxisLimit>), typeof(UITypeEditor))] + public List<AxisLimit> AxisOptions { get; set; } = new List<AxisLimit>(); + + [Category("1.杞村啿绐佹潯浠�")] + [Description("IO鍐茬獊鏉′欢锛屾弧瓒冲叏閮ㄦ潯浠舵椂杞磋繍鍔ㄩ渶瑕佹鏌ュ啿绐�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<IOLimit>), typeof(UITypeEditor))] + public List<IOLimit> IOOptions { get; set; } = new List<IOLimit>(); + + [Category("2.杞村啿绐侀檺鍒�")] + [Description("杞村啿绐侀檺鍒讹紝杞磋繍鍔ㄥ厑璁稿尯闂�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<AxisLimit>), typeof(UITypeEditor))] + public List<AxisLimit> AxisLimits { get; set; } = new List<AxisLimit>(); + + [Category("2.杞村啿绐侀檺鍒�")] + [Description("IO鍏佽鏉′欢锛屽厑璁歌緭鍑虹殑IO")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<IOLimit>), typeof(UITypeEditor))] + public List<IOLimit> IOOutputs { get; set; } = new List<IOLimit>(); + + [Category("3.杞村啿绐佸惎鐢�")] + [Description("true锛氬惎鐢ㄨ酱鍐茬獊闄愬埗 false锛氫笉鍚敤杞村啿绐侀檺鍒�")] + public bool IsEnabled { get; set; } = true; + + public string GetDisplayText() + { + string optionStr = "Options:" + String.Join(";", AxisOptions.Select(a => a.GetDisplayText())); + string limitStr = "Limits:" + String.Join(";", AxisLimits.Select(a => a.GetDisplayText())); + + return optionStr + "|" + limitStr; + } + } + + public class AxisLimit : IComplexDisplay + { + [Category("1.杞村彿")] + [Description("1.杞村彿")] + public int AxisIndex { get; set; } + + [Category("2.杞存渶灏忛檺鍒�")] + [Description("2.杞存渶灏忛檺鍒�")] + public int LimitMin { get; set; } + + [Category("3.杞存渶澶ч檺鍒�")] + [Description("3.杞存渶澶ч檺鍒�")] + public int LimitMax { get; set; } + + private int currentPosition = 0; + [Browsable(false)] + [JsonIgnore] + public int CurrentPosition + { + get => currentPosition; + set + { + if (currentPosition != value) + { + if (value >= LimitMin && value <= LimitMax) + { + IsInLimit = true; + } + else + { + IsInLimit = false; + } + } + + currentPosition = value; + } + } + + [Browsable(false)] + [JsonIgnore] + public bool IsInLimit { get; set; } + + public string GetDisplayText() + { + return String.Format("Index:{0},{1}->{2}", AxisIndex, LimitMin, LimitMax); + } + } + + public class IOLimit : IComplexDisplay + { + [Category("1.IO闄愬埗")] + [Description("IO绱㈠紩")] + public int IOIndex { get; set; } + + [Category("1.IO闄愬埗")] + [Description("IO闄愬埗鍊笺�傝緭鍏ュ垽鏂椂璇ュ�间綔涓哄惎鐢ㄥ垽鏂�硷紝杈撳嚭鍒ゆ柇鏃惰鍊间綔涓哄厑璁歌緭鍑哄��")] + public bool IOSignal { get; set; } + + public string GetDisplayText() + { + return IOIndex + "--" + IOSignal.ToString(); + } + } + + public class AxisMovingStay + { + public int Position { get; set; } + + public int Velocity { get; set; } + + public AutoResetEvent MoveHandle { get; set; } = new AutoResetEvent(false); + + public AutoResetEvent MoveSendHandle { get; set; } = new AutoResetEvent(false); + } + + ///// <summary> + ///// 鐐逛綅绫诲瀷 + ///// </summary> + //public enum PosType + //{ + // /// <summary> + // /// 鐩寸嚎鎻掕ˉ + // /// </summary> + // Line = 1, + // /// <summary> + // /// 鍦嗗姬鎻掕ˉ(鍗婂緞) + // /// </summary> + // CircleRadius, + // /// <summary> + // /// 鍦嗗姬鎻掕ˉ(鍦嗗績) + // /// </summary> + // CircleCenter + //} + + + //public static class GTSCardParameter + //{ + // #region 杩愬姩鍙傛暟 + // public static int Dangliang = 1; + // public static int AxisCount = 2;//杩愬姩杞存暟閲� + // public static short CardNum = Convert.ToInt16(ConfigurationManager.AppSettings["cardNum"]); + // public static short fifo = Convert.ToInt16(ConfigurationManager.AppSettings["fifo"]); + // public static int FlySpeed = Convert.ToInt32(ConfigurationManager.AppSettings["flySpeed"]); + // public static double FlyAcc = Convert.ToDouble(ConfigurationManager.AppSettings["flyAcc"]); + // public static int P2PSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["p2pSpeed"]); + // public static double P2PAcc = Convert.ToDouble(ConfigurationManager.AppSettings["p2pAcc"]); + // public static double P2PDec = Convert.ToDouble(ConfigurationManager.AppSettings["p2pDec"]); + // public static int FreeSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["freeSpeed"]); + // public static int VelEnd = Convert.ToInt32(ConfigurationManager.AppSettings["velEnd"]);//椋炴媿缁撴潫閫熷害 + // public static int HomeSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["homeSpeed"]); + // public static int Loading = Convert.ToInt32(ConfigurationManager.AppSettings["loading"]); + // //public const short cardn = 0;//杩愬姩鎺у埗鍣ㄥ崱鍙� 榛樿涓猴細0 + // //public const short crdn = 1;//鍧愭爣绯诲彿 鍙栧�艰寖鍥达細[1, 2] + // //public const short fifo = 0;//鎻掕ˉ缂撳瓨鍖哄彿 鍙栧�艰寖鍥达細[0, 1]锛岄粯璁ゅ�间负锛�0 + // //public const int flySpeed = 250;//椋炴媿閫熷害 + // //public const double flyAcc = 0.5;//椋炴媿鍔犻�熷害 + // //public const int gocatorSpeed = 150;//3D妫�娴嬭酱杩愬姩閫熷害 + // //public const int p2pSpeed = 250;//P2P閫熷害 + // //public const double p2pAcc = 1;//P2P鍔犻�熷害 + // //public const double p2pDec = 1;//P2P鍑忛�熷害 + // //public const int calibrationSpeed = 10;//鏍囧畾閫熷害 + // //public const int calibrationZ = 19336;//鏍囧畾Z杞撮珮搴� + // //public const int barcodeSpeed = 250;//鏉$爜妫�娴嬭酱杩愬姩閫熷害 + // //public const int freeSpeed = 250;//闈炴娴嬫椂杞磋繍鍔ㄩ�熷害 + // //public const int velEnd = 0;//椋炴媿缁撴潫閫熷害 + // //public const int homeSpeed = 50;//鍥為浂閫熷害 + // //public const int loading = 80000;//涓婃枡浣嶇疆 + // #endregion + + // #region IO + // /// <summary> + // /// 杈撳叆IO榛樿鍊� + // /// </summary> + // public const int InDefaultValue = 0xFFDA; + // /// <summary> + // /// 澶圭揣姘旂几 + // /// </summary> + // public const short EXO_1 = 100;//澶圭揣姘旂几 + // /// <summary> + // /// 鏃ュ厜鐏� + // /// </summary> + // public const short EXO_2 = 101;//鏃ュ厜鐏� + // /// <summary> + // /// 鍏夋簮鍒囨崲 + // /// </summary> + // public const short EXO_3 = 102;//鍏夋簮鍒囨崲 + // /// <summary> + // /// 绾㈢伅 + // /// </summary> + // public const short EXO_4 = 103;//绾㈢伅 + // /// <summary> + // /// 榛勭伅 + // /// </summary> + // public const short EXO_5 = 104;//榛勭伅 + // /// <summary> + // /// 缁跨伅 + // /// </summary> + // public const short EXO_6 = 105;//缁跨伅 + // /// <summary> + // /// 铚傞福鍣� + // /// </summary> + // public const short EXO_7 = 106;//铚傞福鍣� + // /// <summary> + // /// Gocator X + // /// </summary> + // public const short EXO_8 = 107;//Gocator X + + // /// <summary> + // /// 姝i潰鍏�(宸�) + // /// </summary> + // public const short EXO_9 = 108;//姝i潰鍏�(宸�) + + // /// <summary> + // /// 姝i潰鍏�(鍚�) + // /// </summary> + // public const short EXO_10 = 109;//姝i潰鍏�(鍚�) + + // /// <summary> + // /// 姝i潰鍏�(鍙�) + // /// </summary> + // public const short EXO_11 = 110;//姝i潰鍏�(鍙�) + + // /// <summary> + // /// 姝i潰鍏�(鍓�) + // /// </summary> + // public const short EXO_12 = 111;//姝i潰鍏�(鍓�) + + // /// <summary> + // /// Gocator Y + // /// </summary> + // public const short EXO_16 = 115;//Gocator Y + + // /// <summary> + // /// 杈撳嚭IO榛樿鍊� + // /// </summary> + // public const int OutDefaultValue = 0xFFF; + // /// <summary> + // /// 宸﹀惎鍔� + // /// </summary> + // public const short EXI0 = 0;//宸﹁捣鍔� + // /// <summary> + // /// 鍙冲惎鍔� + // /// </summary> + // public const short EXI1 = 1;//鍙宠捣鍔� + // /// <summary> + // /// 鍋滄 + // /// </summary> + // public const short EXI2 = 2;//鍋滄 + // /// <summary> + // /// 澶嶄綅 + // /// </summary> + // public const short EXI3 = 3;//澶嶄綅 + // /// <summary> + // /// 鎬ュ仠 + // /// </summary> + // public const short EXI4 = 4;//鎬ュ仠 + // /// <summary> + // /// 闂ㄥ紑鍏� + // /// </summary> + // public const short EXI5 = 5;//闂ㄥ紑鍏� + // /// <summary> + // /// 瀹夊叏鍏夊箷 + // /// </summary> + // public const short EXI6 = 6;//瀹夊叏鍏夊箷 + + // public const short EXI7 = 7;// + // /// <summary> + // /// 澶圭揣姘旂几鍘熶綅 + // /// </summary> + // public const short EXI8 = 8;//澶圭揣姘旂几鍘熶綅 + // /// <summary> + // /// 澶圭揣姘旂几鍒颁綅 + // /// </summary> + // public const short EXI9 = 9;//澶圭揣姘旂几鍒颁綅 + // #endregion + //} } diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs index a51429e..d4eea2e 100644 --- a/src/Bro.Device.GTSCard/GTSCardDriver.cs +++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs @@ -1,27 +1,59 @@ 锘縰sing Bro.Common.Base; +using Bro.Common.Helper; using Bro.Common.Interface; using Bro.Common.Model; using System; +using System.Collections.Concurrent; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Drawing; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; +using static Bro.Common.Helper.EnumHelper; namespace Bro.Device.GTSCard { - public class GTSCardDriver : DeviceBase,IMonitor, IMotion + [Device("GTSCard", "鍥洪珮鏉垮崱", EnumHelper.DeviceAttributeType.Device)] + public class GTSCardDriver : DeviceBase, IMonitor, IMotion { public event Action<DateTime, string, IDevice, MonitorSet> OnMonitorInvoke; public event Action<DateTime, IDevice, WarningSet> OnMonitorAlarm; + + public delegate bool OnAxisStartToCheckDelegate(int axisIndex, int startPosition, int endPosition); + // 寮傚父浜嬩欢 + public Action<Exception> OnExceptionRaised; + + public GTSCardInitialConfig IConfig + { + get + { + return InitialConfig as GTSCardInitialConfig; + } + } + + static object moveLock = new object(); + /// <summary> + /// 鏄惁澶嶄綅鏍囧織 + /// </summary> + bool _isResetting = false; + + public void SetResetFlag(bool isReset) + { + _isResetting = isReset; + } public List<AxisInfo> GetCurrentAxisInfo(params string[] axisName) { throw new NotImplementedException(); } + #region DeviceBase + protected override void Init() { - throw new NotImplementedException(); + InitialMotionCard(); } protected override void Pause() @@ -43,43 +75,448 @@ { throw new NotImplementedException(); } + #endregion + + #region GTSCard /// <summary> - /// 鐐逛綅鍒扮偣浣� 杩愬姩 + /// Load Motion Card parameter from file /// </summary> - /// <param name="cardNum">鍗″彿</param> - /// <param name="axisNum">杞村彿</param> - /// <param name="prfPosition">瑙勫垝浣嶇疆,鍗曚綅姣背</param> - /// <param name="prfVelocity">瑙勫垝閫熷害,鍗曚綅绫虫瘡绉�</param> - public void P2P(short cardNum, short axisNum, int prfPosition, int prfVelocity) + /// <param name="fileName">Invalid Parameter</param> + /// <returns></returns> + public void InitialMotionCard() { - GTSCardAPI.TTrapPrm trapprm; - GTSCardAPI.GT_PrfTrap(cardNum, axisNum); - GTSCardAPI.GT_GetTrapPrm(cardNum, axisNum, out trapprm); - trapprm.acc = GTSCardParameter.P2PAcc; - trapprm.dec = GTSCardParameter.P2PDec; - trapprm.smoothTime = 1; - GTSCardAPI.GT_SetTrapPrm(cardNum, axisNum, ref trapprm); - GTSCardAPI.GT_SetPos(cardNum, axisNum, prfPosition * GTSCardParameter.Dangliang); - GTSCardAPI.GT_SetVel(cardNum, axisNum, prfVelocity * GTSCardParameter.Dangliang); - GTSCardAPI.GT_Update(cardNum, 1 << (axisNum - 1)); + var res = GTSCardAPI.GT_Open((short)IConfig.CardNum, 0, 1); //鎵撳紑杩愬姩鎺у埗鍣ㄣ�傚弬鏁板繀椤讳负锛�0,1锛夛紝涓嶈兘淇敼銆� + res += GTSCardAPI.GT_LoadConfig((short)IConfig.CardNum, IConfig.InitialConfigFilePath); + res += GTSCardAPI.GT_ClrSts(0, 1, 8); + if (res != (short)GTSRetCode.GRCRunOK) + { + throw new Exception("鏉垮崱杞藉叆閰嶇疆鏂囦欢寮傚父锛岄敊璇爜锛�" + res); + } } /// <summary> - /// Jog杩愬姩 + /// 鐐逛綅鍒扮偣浣嶈繍鍔� /// </summary> - /// <param name="cardNum"></param> - /// <param name="axisNum"></param> - /// <param name="velocity">瑙勫垝閫熷害锛屽崟浣嶇背姣忕</param> - public void Jog(short cardNum, short axisNum, double velocity) + /// <param name="item">杩愬姩瀵硅薄</param> + /// <returns>杩愬姩鎺у埗+鍋滄鍒ゆ柇</returns> + public bool MoveToPoint(IOperationConfig opConfig) + { + bool resultOK = false; + var gtsOperationConfig = opConfig as GTSCardOperationConfig; + List<Task<bool>> taskList = new List<Task<bool>>(); + //TaskFactory factory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.None); + // 濡傛灉鏄涓酱鐨勮繍鍔� 绛夋瘡涓酱杩愬姩缁撴潫 + foreach (var movingOp in gtsOperationConfig.MovingOps) + { + //var task = factory.StartNew<bool>((op) => + //{ + // return SingleAxisMoving(op as MovingOption); + //}, movingOp); + var task = SingleAxisMoving(movingOp); + taskList.Add(task); + } + Task.WaitAll(taskList.ToArray()); + resultOK = taskList.All(u => u.GetAwaiter().GetResult()); + + return resultOK; + } + + /// <summary> + /// Set AxisParam + /// </summary> + /// <param name="optionPara">杩愬姩鍙傛暟瀵硅薄</param> + /// <returns></returns> + private bool SetAxisParam(MovingOption optionPara) + { + List<short> resultCode = new List<short>() { 0 }; + GTSCardAPI.TTrapPrm trapprm; + resultCode.Add(GTSCardAPI.GT_PrfTrap((short)IConfig.CardNum, (short)optionPara.AxisIndex)); + resultCode.Add(GTSCardAPI.GT_GetTrapPrm((short)IConfig.CardNum, (short)optionPara.AxisIndex, out trapprm)); + trapprm.smoothTime = 1; + trapprm.acc = optionPara.VelocityPara.Acc != 0 ? optionPara.VelocityPara.Acc : 1; + trapprm.dec = optionPara.VelocityPara.Dec != 0 ? optionPara.VelocityPara.Dec : 1; + + resultCode.Add(GTSCardAPI.GT_SetTrapPrm((short)IConfig.CardNum, (short)optionPara.AxisIndex, ref trapprm)); + resultCode.Add(GTSCardAPI.GT_SetVel((short)IConfig.CardNum, (short)optionPara.AxisIndex, optionPara.VelocityPara.Velocity * IConfig.AxisVelocityRatio)); + + var resultOK = resultCode.All(u => u == (short)GTSRetCode.GRCRunOK); + if (!resultOK) + { + throw new Exception("杞�" + optionPara.AxisIndex + "璁剧疆鍙傛暟寮傚父锛岄敊璇爜锛�" + string.Join(",", resultCode)); + } + return resultOK; + } + + /// <summary> + /// 鍗曚釜杞� 鐐逛綅鍒扮偣浣嶈繍鍔� + /// </summary> + /// <param name="optionPara">杩愬姩鍙傛暟瀵硅薄</param> + public async Task<bool> SingleAxisMoving(MovingOption optionPara) + { + return await Task.Run(() => + { + bool isSuccessAndStop = false; + if (IConfig.AxisSettings.FirstOrDefault(a => a.AxisIndex == optionPara.AxisIndex)?.IsAxisEnabled ?? false) + { + string _position = ""; + string motionType = optionPara.MoveMode == EnumHelper.MotorMoveMode.Normal ? (optionPara.IsAbsolute ? "Abs" : "Rel") : optionPara.MoveMode.ToString(); + + _position = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")},{optionPara.AxisIndex},{motionType},{GetPosition(optionPara.AxisIndex).ToString()},{GetPrfPosition(optionPara.AxisIndex).ToString()},{optionPara.Destination},"; + + switch (optionPara.MoveMode) + { + case MotorMoveMode.Normal: + { + if (_isResetting) + { + LogAsync(DateTime.Now, "澶嶄綅涓惎鍔ㄨ繍鍔ㄥ紓甯�", optionPara.AxisIndex + "鍚姩杩愬姩寮傚父"); + return false; + } + //璁剧疆 杩愬姩鍙傛暟 + var isSuccess = SetAxisParam(optionPara); + if (isSuccess) + { + if (optionPara.IsAbsolute) + { + isSuccessAndStop = MoveAbs(optionPara); + } + else + { + isSuccessAndStop = MoveRel(optionPara); + } + } + } + break; + case MotorMoveMode.FindOri: + { + isSuccessAndStop = GoHome(optionPara); + } + break; + } + _position += $"{GetPosition(optionPara.AxisIndex)},"; + _position += $"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}"; + LogAsync(DateTime.Now, "", _position); + } + return isSuccessAndStop; + }); + } + + /// <summary> + /// 鑾峰彇瑙勫垝浣嶇疆锛堣鍘荤殑浣嶇疆锛� + /// </summary> + /// <param name="axisNum">Axis number</param> + /// <returns></returns> + public double GetPrfPosition(int axisNum) + { + lock (moveLock) + { + double position = 0; + double prfpos = 0; uint pclock = 0; + var ret = GTSCardAPI.GT_GetPrfPos((short)IConfig.CardNum, (short)axisNum, out prfpos, 1, out pclock); + if (ret != (short)GTSRetCode.GRCRunOK) + { + throw new Exception("杞�" + axisNum + "鑾峰彇瑙勫垝浣嶇疆寮傚父锛岄敊璇爜锛�" + ret); + } + position = prfpos / IConfig.AxisVelocityRatio; + return position; + } + } + + /// <summary> + /// 鑾峰彇鐩墠褰撳墠浣嶇疆 + /// </summary> + /// <param name="axisNum">Axis number</param> + /// <returns></returns> + public double GetPosition(int axisNum) + { + lock (moveLock) + { + double position = 0; + int pPos = 0; + var ret = GTSCardAPI.GT_GetPos((short)IConfig.CardNum, (short)axisNum, out pPos); + if (ret != (short)GTSRetCode.GRCRunOK) + { + throw new Exception("杞�" + axisNum + "鑾峰彇鐩爣浣嶇疆寮傚父锛岄敊璇爜锛�" + ret); + } + position = pPos / IConfig.AxisVelocityRatio; + return position; + } + } + + + /// <summary> + /// Set Single Axis Do Jog Move + /// </summary> + /// <param name="axisNum">AxisNo</param> + /// <param name="nDirection">Motion Direction 0: Negative, 1: Positive</param> + /// <param name="nMaxVel">max velocity</param> + /// <returns></returns> + public bool StartJog(int axisNum, int nDirection, int velocity) { GTSCardAPI.TJogPrm jogprm = new GTSCardAPI.TJogPrm(); - short rtn = GTSCardAPI.GT_PrfJog(cardNum, axisNum); + short rtn = GTSCardAPI.GT_PrfJog((short)IConfig.CardNum, (short)axisNum); jogprm.acc = 1; jogprm.dec = 1; - GTSCardAPI.GT_SetJogPrm(cardNum, axisNum, ref jogprm);//璁剧疆jog杩愬姩鍙傛暟 - GTSCardAPI.GT_SetVel(cardNum, axisNum, velocity);//璁剧疆鐩爣閫熷害 - GTSCardAPI.GT_Update(cardNum, 1 << (axisNum - 1));//鏇存柊杞磋繍鍔� + GTSCardAPI.GT_SetJogPrm((short)IConfig.CardNum, (short)axisNum, ref jogprm);//璁剧疆jog杩愬姩鍙傛暟 + GTSCardAPI.GT_SetVel((short)IConfig.CardNum, (short)axisNum, velocity);//璁剧疆鐩爣閫熷害 + int ret = GTSCardAPI.GT_Update((short)IConfig.CardNum, 1 << (axisNum - 1));//鏇存柊杞磋繍鍔� + + if (ret != (int)GTSRetCode.GRCRunOK) + { + return false; + } + return true; + } + + /// <summary> + /// Set Single Axis Do stop Jog Move + /// </summary> + /// <param name="axisNum">AxisNo</param> + /// <returns></returns> + public bool StopJog(int axisNum) + { + //鍋滄杩愬姩 + MoveStop(axisNum, 0); + //杩愬姩寮�濮嬪悗 妫�鏌ヨ繍鍔ㄦ槸鍚﹀仠姝� + bool isStop = false; + int repeatTime = 1000; + do + { + isStop = IsStop((short)IConfig.CardNum, (short)axisNum); + Thread.Sleep(50); + repeatTime--; + } while (!isStop && repeatTime > 0); + + return isStop; + } + + /// <summary> + /// 鐩稿浣嶇疆杩愬姩 + /// </summary> + /// <param name="axisNum">AxisNo</param> + /// <param name="nDistance">run distance</param> + /// <returns></returns> + public bool MoveRel(MovingOption optionPara) + { + try + { + if (_isResetting) + { + LogAsync(DateTime.Now, "澶嶄綅杩囩▼寮傚父", "杞�" + optionPara.AxisIndex + "璇曞浘鍦ㄥ浣嶈繃绋嬩腑杩愬姩"); + throw new Exception("杞�" + optionPara.AxisIndex + "璇曞浘鍦ㄥ浣嶈繃绋嬩腑杩愬姩"); + } + + int repeatTime = 30; + while (CurrentState != EnumHelper.DeviceState.DSOpen && repeatTime > 0) + { + Thread.Sleep(10); + repeatTime--; + } + + if (CurrentState == EnumHelper.DeviceState.DSExcept) + { + LogAsync(DateTime.Now, "鏉垮崱寮傚父鐘舵��", "杞�" + optionPara.AxisIndex + "璇曞浘寮傚父鐘舵�佽繍鍔�"); + return false; + } + + if (CurrentState != EnumHelper.DeviceState.DSOpen) + { + LogAsync(DateTime.Now, "闈炴甯哥姸鎬佸紓甯�", "杞�" + optionPara.AxisIndex + "璇曞浘鍦ㄩ潪姝e父鐘舵�佽繍鍔�"); + throw new Exception("杞�" + optionPara.AxisIndex + "璇曞浘鍦ㄩ潪姝e父鐘舵�佽繍鍔�", null); + } + + LogAsync(DateTime.Now, "杞�" + optionPara.AxisIndex + "寮�濮嬭繍鍔�", "鐩爣鍧愭爣锛�" + optionPara.Destination); + short ret = 0; + repeatTime = 1000; + int currentPosition = (int)GetPosition(optionPara.AxisIndex); + int dPosition = optionPara.Destination + currentPosition; + do + { + ret = GTSCardAPI.GT_SetPrfPos((short)IConfig.CardNum, (short)optionPara.AxisIndex, (int)(dPosition * IConfig.AxisVelocityRatio));// 璁剧疆瑙勫垝浣嶇疆 + ret = GTSCardAPI.GT_Update((short)IConfig.CardNum, 1 << (optionPara.AxisIndex - 1));//鏇存柊杩愬姩 + + if (ret != (short)GTSRetCode.GRCRunOK) + { + LogAsync(DateTime.Now, "杞�" + optionPara.AxisIndex + "APS_absolute_move寮傚父", "閿欒鐮侊細" + ret + ";" + "閲嶈瘯娆℃暟锛�" + repeatTime); + Thread.Sleep(50); + } + repeatTime--; + } while (ret != (short)GTSRetCode.GRCRunOK && repeatTime > 0); + + //杩愬姩寮�濮嬪悗 妫�鏌ヨ繍鍔ㄦ槸鍚﹀仠姝� + bool isStop = false; + repeatTime = 1000; + do + { + isStop = IsStop((short)IConfig.CardNum, (short)optionPara.AxisIndex); + Thread.Sleep(50); + repeatTime--; + } while (!isStop && repeatTime > 0); + + return (ret == (short)GTSRetCode.GRCRunOK) && isStop; + } + catch (Exception ex) + { + AllMoveStop(true); + OnExceptionRaised?.Invoke(ex); + return false; + } + } + + /// <summary> + /// 缁濆浣嶇疆杩愬姩 + /// </summary> + /// <param name="optionPara">杩愬姩鍙傛暟瀵硅薄</param> + public bool MoveAbs(MovingOption optionPara) + { + try + { + if (_isResetting) + { + LogAsync(DateTime.Now, "澶嶄綅杩囩▼寮傚父", "杞�" + optionPara.AxisIndex + "璇曞浘鍦ㄥ浣嶈繃绋嬩腑杩愬姩"); + throw new Exception("杞�" + optionPara.AxisIndex + "璇曞浘鍦ㄥ浣嶈繃绋嬩腑杩愬姩"); + } + int repeatTime = 30; + while (CurrentState != EnumHelper.DeviceState.DSOpen && repeatTime > 0) + { + Thread.Sleep(10); + repeatTime--; + } + if (CurrentState == EnumHelper.DeviceState.DSExcept) + { + LogAsync(DateTime.Now, "鏉垮崱寮傚父鐘舵��", "杞�" + optionPara.AxisIndex + "璇曞浘寮傚父鐘舵�佽繍鍔�"); + return false; + } + + if (CurrentState != EnumHelper.DeviceState.DSOpen) + { + LogAsync(DateTime.Now, "闈炴甯哥姸鎬佸紓甯�", "杞�" + optionPara.AxisIndex + "璇曞浘鍦ㄩ潪姝e父鐘舵�佽繍鍔�"); + throw new Exception("杞�" + optionPara.AxisIndex + "璇曞浘鍦ㄩ潪姝e父鐘舵�佽繍鍔�", null); + } + LogAsync(DateTime.Now, "杞�" + optionPara.AxisIndex + "寮�濮嬭繍鍔�", "鐩爣鍧愭爣锛�" + optionPara.Destination); + short ret = 0; + repeatTime = 1000; + do + { + ret = GTSCardAPI.GT_SetPrfPos((short)IConfig.CardNum, (short)optionPara.AxisIndex, (int)(optionPara.Destination * IConfig.AxisVelocityRatio));// 璁剧疆瑙勫垝浣嶇疆 + ret = GTSCardAPI.GT_Update((short)IConfig.CardNum, 1 << (optionPara.AxisIndex - 1));//鏇存柊杩愬姩 + + if (ret != (short)GTSRetCode.GRCRunOK) + { + LogAsync(DateTime.Now, "杞�" + optionPara.AxisIndex + "APS_absolute_move寮傚父", "閿欒鐮侊細" + ret + ";" + "閲嶈瘯娆℃暟锛�" + repeatTime); + Thread.Sleep(50); + } + repeatTime--; + } while (ret != (short)GTSRetCode.GRCRunOK && repeatTime > 0); + + bool isStop = false; + repeatTime = 1000; + do + { + isStop = IsStop((short)IConfig.CardNum, (short)optionPara.AxisIndex); + Thread.Sleep(50); + repeatTime--; + } while (!isStop && repeatTime > 0); + + return (ret == (short)GTSRetCode.GRCRunOK) && isStop; + } + catch (Exception ex) + { + AllMoveStop(true); + OnExceptionRaised?.Invoke(ex); + return false; + } + } + + /// <summary> + /// 杩愬姩鍋滄 + /// </summary> + /// <param name="axisNum">axisNo</param> + /// <param name="option">0琛ㄧず骞虫粦鍋滄锛�1琛ㄧず绱ф�ュ仠姝�</param> + /// <returns></returns> + public void MoveStop(int axisNum, int option) + { + if (option == 1) + { + StateChange(EnumHelper.DeviceState.DSExcept); + } + var ret = GTSCardAPI.GT_Stop((short)IConfig.CardNum, 1 << (axisNum - 1), option); + if (ret != (short)GTSRetCode.GRCRunOK) + { + LogAsync(DateTime.Now, "杞�" + axisNum + "杩愬姩鍋滄寮傚父", "閿欒鐮侊細" + ret); + throw new Exception("杞�" + axisNum + "杩愬姩鍋滄寮傚父锛岄敊璇爜锛�" + ret); + } + else + { + LogAsync(DateTime.Now, "杞�" + axisNum + "杩愬姩鍋滄", ""); + } + } + + /// <summary> + /// 鎵�鏈夊紑鍚殑杞村叧闂� + /// </summary> + /// <param name="emergencyStop"></param> + public void AllMoveStop(bool emergencyStop = false) + { + int option = emergencyStop ? 1 : 0; + + IConfig.AxisSettings.Where(a => a.IsAxisEnabled).ToList().ForEach(axisNum => + { + MoveStop(axisNum.AxisIndex, option); + }); + } + + /// <summary> + /// 鍥炲師鐐� + /// </summary> + /// <param name="movingOption">鍗″彿</param> + /// <param name="axisn">杞村彿</param> + /// <param name="homests">杞村洖鍘熺偣鐘舵��</param> + public bool GoHome(MovingOption movingOption) + { + try + { + GTSCardAPI.GT_ZeroPos((short)IConfig.CardNum, (short)movingOption.AxisIndex, 1); + GTSCardAPI.THomePrm thomeprm; + GTSCardAPI.THomeStatus homests; + short rtn = GTSCardAPI.GT_GetHomePrm((short)IConfig.CardNum, (short)movingOption.AxisIndex, out thomeprm); + thomeprm.mode = movingOption.GoHomePara.HomeMode;//鍥為浂鏂瑰紡 + thomeprm.moveDir = movingOption.GoHomePara.HomeDir;//鍥為浂鏂瑰悜 + thomeprm.edge = movingOption.GoHomePara.Edge; + thomeprm.velHigh = movingOption.GoHomePara.HighVelocity; + thomeprm.velLow = movingOption.GoHomePara.LowVelocity; + thomeprm.acc = movingOption.VelocityPara.Acc; + thomeprm.dec = movingOption.VelocityPara.Dec; + thomeprm.searchHomeDistance = movingOption.GoHomePara.SearchHomeDistance;//鎼滄悳璺濈 + thomeprm.homeOffset = movingOption.GoHomePara.HomeOffset; //鍋忕Щ璺濈 + thomeprm.escapeStep = movingOption.GoHomePara.EscapeStep; + rtn = GTSCardAPI.GT_GoHome((short)IConfig.CardNum, (short)movingOption.AxisIndex, ref thomeprm); //鍚姩鍥為浂 + + bool isStop = false; + int repeatTime = 1000; + do + { + Thread.Sleep(10); + GTSCardAPI.GT_GetHomeStatus((short)IConfig.CardNum, (short)movingOption.AxisIndex, out homests); + + isStop = homests.run == 0; + if (isStop && homests.error == 0) + { + Thread.Sleep(200); + GTSCardAPI.GT_ZeroPos((short)IConfig.CardNum, (short)movingOption.AxisIndex, 1); + } + repeatTime--; + } while (!isStop && repeatTime > 0); + + return isStop; + } + catch (Exception ex) + { + AllMoveStop(true); + OnExceptionRaised?.Invoke(ex); + return false; + } } /// <summary> @@ -99,36 +536,20 @@ /// <summary> /// 杈撳嚭 /// </summary> - /// <param name="cardNumo">鍗″彿</param> + /// <param name="cardNum">鍗″彿</param> /// <param name="index">杈撳嚭鍙�,杩斿洖1-16</param> - /// <param name="value">0琛ㄧず杈撳嚭锛�1琛ㄧず鍏抽棴</param> - public void WriteOut(short cardNumo, short index, bool value) + /// <param name="value">false琛ㄧず杈撳嚭锛宼rue琛ㄧず鍏抽棴</param> + public void WriteOut(short cardNum, short index, bool value) { short outNum = (short)(index % 100 + 1); - switch (value) + if (value) { - case true: - { - GTSCardAPI.GT_SetDoBit(cardNumo, GTSCardAPI.MC_GPO, outNum, 0);//鎸変綅杈撳嚭锛�0琛ㄧず杈撳嚭锛�1琛ㄧず鍏抽棴 - } - break; - case false: - { - GTSCardAPI.GT_SetDoBit(cardNumo, GTSCardAPI.MC_GPO, outNum, 1);//鎸変綅杈撳嚭锛�0琛ㄧず杈撳嚭锛�1琛ㄧず鍏抽棴 - } - break; + GTSCardAPI.GT_SetDoBit(cardNum, GTSCardAPI.MC_GPO, outNum, 0); } - } - - /// <summary> - /// 鍋滄 鏌愪釜杞� - /// </summary> - /// <param name="cardNum"></param> - /// <param name="axisNum"></param> - /// <param name="option">0琛ㄧず骞虫粦鍋滄锛�1琛ㄧず绱ф�ュ仠姝�</param> - public void Stop(short cardNum, short axisNum, short option) - { - GTSCardAPI.GT_Stop(cardNum, 1 << (axisNum - 1), option); + else + { + GTSCardAPI.GT_SetDoBit(cardNum, GTSCardAPI.MC_GPO, outNum, 1); + } } /// <summary> @@ -137,34 +558,15 @@ /// <param name="cardNum"></param> /// <param name="axisNum">杞村彿</param> /// <param name="value">鍋滄鏂瑰紡锛宖alse琛ㄧず骞虫粦鍋滄锛宼rue琛ㄧず绱ф�ュ仠姝�</param> - public void Stop(short cardNum, short axisNum, bool value) + public void Stop(short cardNum, short axisNum, bool emergencyStop) { - switch (value) + if (emergencyStop) { - case false: - { - GTSCardAPI.GT_Stop(cardNum, 1 << (axisNum - 1), 0); - } - break; - case true: - { - GTSCardAPI.GT_Stop(cardNum, 1 << (axisNum - 1), 1 << (axisNum - 1)); - - } - break; + GTSCardAPI.GT_Stop(cardNum, 1 << (axisNum - 1), 1 << (axisNum - 1)); } - } - - /// <summary> - /// 鍋滄 鍏ㄩ儴杞� - /// </summary> - /// <param name="cardNum"></param> - /// <param name="value">鍋滄鏂瑰紡锛宖alse琛ㄧず骞虫粦鍋滄锛宼rue琛ㄧず绱ф�ュ仠姝�</param> - public void StopAll(short cardNum, bool value) - { - for (short i = 1; i <= GTSCardParameter.AxisCount; i++) + else { - Stop(cardNum, i, value); + GTSCardAPI.GT_Stop(cardNum, 1 << (axisNum - 1), 0); } } @@ -190,47 +592,28 @@ /// <summary> /// 璇诲彇IO杈撳嚭鐘舵�� /// </summary> - /// <param name="cardNumo"></param> + /// <param name="cardNum"></param> /// <param name="index"></param> /// <returns></returns> - public bool GetDoSts(short cardNumo, short index) + public bool GetDoSts(short cardNum, short index) { short outNum = 0; int outSts; outNum = (short)(index % 100); - GTSCardAPI.GT_GetDo(cardNumo, GTSCardAPI.MC_GPO, out outSts); + GTSCardAPI.GT_GetDo(cardNum, GTSCardAPI.MC_GPO, out outSts); if ((outSts & (1 << outNum)) == 0) return true; else return false; - } - - static object lockObj = new object(); - - - /// <summary> - /// 璇诲彇褰撳墠鍊� - /// </summary> - /// <param name="cardNum">鍗″彿</param> - /// <param name="axisNum">杞村彿</param> - /// <returns>杩斿洖褰撳墠鍊硷紝鍗曚綅姣背</returns> - public double GetPosMM(short cardNum, short axisNum) - { - lock (lockObj) - { - double prfpos = 0; uint pclock = 0; - GTSCardAPI.GT_GetPrfPos(cardNum, axisNum, out prfpos, 1, out pclock); - return prfpos / GTSCardParameter.Dangliang; - } } /// <summary> /// 璇诲彇杞寸姸鎬侊紝鍒ゆ柇鐢垫満鏄惁鍋滄 /// </summary> - /// <param name="cardNum"></param> - /// <param name="axisNum"></param> + /// <param name="cardNum">鏉垮崱鍙�</param> + /// <param name="axisNum">杞村彿</param> /// <returns></returns> public bool IsStop(short cardNum, short axisNum) { - lock (lockObj) + lock (moveLock) { int sts = 0; uint pclock = 0; @@ -239,6 +622,8 @@ else return false; //杩愯涓繑鍥瀎alse } } + + #endregion public void Monitor() { @@ -249,5 +634,7 @@ { throw new NotImplementedException(); } + + } } diff --git a/src/Bro.Device.GTSCard/GtsCardManager.cs b/src/Bro.Device.GTSCard/GtsCardManager.cs deleted file mode 100644 index 7be0c3f..0000000 --- a/src/Bro.Device.GTSCard/GtsCardManager.cs +++ /dev/null @@ -1,440 +0,0 @@ -锘�//using Bro.Common.PubSub; -//using Broc.AOI.Entity; -//using Broc.AOI.Manager; -//using HalconDotNet; -//using Lmi3d.GoSdk; -//using Lmi3d.Zen; -//using Lmi3d.Zen.Io; -//using System; -//using System.Collections.Generic; -//using System.Configuration; -//using System.Diagnostics; -//using System.IO; -//using System.Linq; -//using System.Runtime.InteropServices; -//using System.Threading; -//using System.Threading.Tasks; -//using static Broc.AOI.Manager.LogHelper; - -//namespace Bro.Device.GTSCard -//{ -// public class GtsCardManager -// { -// GtsMotionCard _gts = new GtsMotionCard(); -// int pCount;//浣嶇疆姣旇緝宸茶緭鍑烘鏁� -// bool canStop = false; -// private static GtsIO curValueIo = new GtsIO(); -// CancellationTokenSource cts = new CancellationTokenSource(); -// private static int lastInputValue = Parameter.InDefaultValue; - -// int StopType = 0; //0锛氭湭鏀跺埌鎵嬪姩鍋滄淇″彿 1锛氭敹鍒版敹鍒板仠姝俊鍙� 2锛氭敹鍒版�ュ仠淇″彿 -// public GtsCardManager(ProductManager productManager) -// { -// try -// { -// _product = productManager.GetProductList().Find(x => x.IsDefault); -// Monitor(); -// InitGocatorIO(); -// PubSubCenter.GetInstance().RemoveSubscribers(MessageType.StopType.ToString()); -// PubSubCenter.GetInstance().Subscribe(MessageType.StopType.ToString(), OnStopType); -// gocatorRecord = new GocatorRecord(); -// //gocatorRecord.OnDataDone = OnGocatorDataDone; -// gocatorRecord.Connect(); -// gocatorRecord.GocatorStop(); -// } -// catch (Exception ex) -// { -// Trace.TraceError(ex.ToString()); -// } -// } - -// private object OnStopType(ISubscriber arg1, object arg2, object arg3) -// { -// StopType = (int)arg2; -// Trace.TraceInformation($"鍋滄淇″彿鍙樻洿涓猴細{StopType}"); -// if (StopType > 0) -// { -// Trace.TraceError("鍋滄鍚庤閲嶅惎杞欢"); -// } -// return null; -// } - -// public void InitGocatorIO() -// { -// _gts.WriteOut(Parameter.cardn, Parameter.EXO_8, false); -// _gts.WriteOut(Parameter.cardn, Parameter.EXO_16, false); -// } - - -// public void DoCompare(List<ST_Point> pointList) -// { -// canStop = !canStop; -// GTSCardAPI.T2DComparePrm prm; -// short t; -// short sRtn; -// GTSCardAPI.T2DCompareData[] dataBuf = new GTSCardAPI.T2DCompareData[1]; -// short pStatus, -// pFifo,//褰撳墠绌洪棽fifo -// pFifoCount,//褰撳墠绌洪棽fifo鍓╀綑绌洪棿 -// pBufCount;//FPGA 涓� FIFO 鍓╀綑绌洪棿锛� FPGA 鐨� FIFO 鎬诲ぇ灏忎负 512锛屽惎鍔ㄤ綅缃瘮杈冧箣鍓嶏紝鍘嬪叆鐨勬暟鎹厛杩涘叆 FPGA 鐨� FIFO - -// sRtn = GTSCardAPI.GT_2DCompareClear(0, 0); -// sRtn = GTSCardAPI.GT_2DCompareMode(0, 0, GTSCardAPI.COMPARE2D_MODE_2D); -// prm.encx = Axisn.X; // X 杞翠负1杞� -// prm.ency = Axisn.Y; // Y 杞翠负2杞� -// prm.maxerr = 500; // 鏈�澶ц宸甈ulse -// prm.outputType = 0; // 杈撳嚭绫诲瀷 = 鑴夊啿 -// prm.source = 1; // 姣旇緝婧�0 锛氳鍒�1锛氱紪鐮佸櫒 -// prm.startLevel = 0; //璧峰鐢靛钩鏂瑰紡0锛氫綅缃瘮杈冭緭鍑哄紩鑴氱數骞冲浣� 1锛氫綅缃瘮杈冭緭鍑哄紩鑴氱數骞冲彇鍙� -// prm.threshold = 0; // 鏈�浼樼偣璁$畻闃堝�� -// prm.time = 50; // 鑴夊啿瀹藉害 us -// sRtn = GTSCardAPI.GT_2DCompareSetPrm(0, 0, ref prm); -// sRtn = GTSCardAPI.GT_SetComparePort(0, GTSCardAPI.COMPARE_PORT_HSIO, 0, 1); -// sRtn = GTSCardAPI.GT_2DCompareStart(0, 0); - -// foreach (var point in pointList) -// { -// dataBuf[0].px = point.X - (pointList[0].X + 2000); -// dataBuf[0].py = point.Y - pointList[0].Y; -// do -// { -// t = GTSCardAPI.GT_2DCompareStatus(0, 0, out pStatus, out pCount, out pFifo, out pFifoCount, out pBufCount); -// t = GTSCardAPI.GT_2DCompareData(0, 0, 1, ref dataBuf[0], pFifo);//鍘嬪叆鏁版嵁 -// } while (t != 0); -// } -// } - -// public void ChaBu(List<ST_Point> pointList) -// { -// short sRtn = -1; //Googol杩斿洖鍊兼煡璇� -// GTSCardAPI.TCrdPrm crdPrm = new GTSCardAPI.TCrdPrm(); //鍧愭爣绯诲弬鏁扮粨鏋勪綋 -// int[] posTest = new int[2]; - -// GTSCardAPI.TCrdData temp = new GTSCardAPI.TCrdData();//瀹氫箟鍓嶇灮缂撳瓨鍖哄ぇ灏忎负200娈� -// GTSCardAPI.TCrdData[] crdData = new GTSCardAPI.TCrdData[400]; -// int size = Marshal.SizeOf(temp) * 400; -// IntPtr pCrdData = Marshal.AllocHGlobal(size); - -// //******绗竴姝ュ缓浜岀淮绔嬪潗鏍囩郴1杞碭浜岃酱Y锛屼娇鐢ㄥ潗鏍囩郴1鐨凢IFO0鍘嬪叆鏁版嵁銆� -// crdPrm.dimension = 3; // 寤虹珛涓夌淮鐨勫潗鏍囩郴 -// crdPrm.synVelMax = 500; // 鍧愭爣绯荤殑鏈�澶у悎鎴愰�熷害鏄�: 500 pulse/ms -// crdPrm.synAccMax = 5; // 鍧愭爣绯荤殑鏈�澶у悎鎴愬姞閫熷害鏄�: 5 pulse/ms^2 -// crdPrm.evenTime = 0; // 鍧愭爣绯荤殑鏈�灏忓寑閫熸椂闂翠负0 -// crdPrm.profile1 = 1; // 瑙勫垝鍣�1瀵瑰簲鍒癤杞� -// crdPrm.profile2 = 2; // 瑙勫垝鍣�2瀵瑰簲鍒癥杞� -// crdPrm.profile3 = 3; -// crdPrm.profile4 = 0; -// crdPrm.profile5 = 0; -// crdPrm.profile6 = 0; -// crdPrm.profile7 = 0; // 鑻rofile7 = 1锛岃鍒掑櫒7瀵瑰簲鍒癤杞� -// crdPrm.profile8 = 0; -// crdPrm.setOriginFlag = 1; // 闇�瑕佽缃姞宸ュ潗鏍囩郴鍘熺偣浣嶇疆 -// crdPrm.originPos1 = 0; // 鍔犲伐鍧愭爣绯诲師鐐逛綅缃湪(0,0)锛屽嵆涓庢満搴婂潗鏍囩郴鍘熺偣閲嶅悎 -// crdPrm.originPos2 = 0; -// crdPrm.originPos3 = 0; -// crdPrm.originPos4 = 0; -// crdPrm.originPos5 = 0; -// crdPrm.originPos6 = 0; -// crdPrm.originPos7 = 0; -// crdPrm.originPos8 = 0; -// sRtn = GTSCardAPI.GT_SetCrdPrm(0, 1, ref crdPrm); //蹇呴』鍦ㄨ酱璋冪敤鍋滄鐘舵�佷笅 -// sRtn = GTSCardAPI.GT_CrdClear(0, 1, 0);//娓呴櫎鍧愭爣绯�1 FIFO1涓殑鏁版嵁缂撳瓨 -// // 鍒濆鍖栧潗鏍囩郴1鐨凢IFO0鐨勫墠鐬绘ā鍧� -// sRtn = GTSCardAPI.GT_InitLookAhead(Parameter.cardn, //鍗″彿 -// Parameter.crdn, //鍧愭爣绯� -// Parameter.fifo, //FIFO -// 5, //鎷愯鏃堕棿T -// 5, //accMax -// 200, //鏁版嵁娈礜 -// pCrdData); //缁撴瀯浣揷rdData - -// //*******绗簩姝ュ帇鍏ユ暟鎹紝瓒呰繃4096娈靛惊鐜帇鍏ャ�� -// foreach (var point in pointList) -// { -// //sRtn = mc.GT_LnXY(Parameter.cardn, Parameter.crdn, point.X, point.Y, Parameter.speed, Parameter.synAcc, Parameter.velEnd, Parameter.fifo); -// sRtn = GTSCardAPI.GT_LnXYZ(Parameter.cardn, Parameter.crdn, point.X, point.Y, point.Z.Value, Parameter.flySpeed, Parameter.flyAcc, Parameter.velEnd, Parameter.fifo); -// } -// sRtn = GTSCardAPI.GT_CrdData(Parameter.cardn, Parameter.crdn, System.IntPtr.Zero, Parameter.fifo); -// GTSCardAPI.GT_CrdStart(0, 1, 0); -// } - -// public void On() -// { -// for (int i = 1; i <= Axisn.Count; i++) -// { -// GTSCardAPI.GT_AxisOn(0, (short)i); -// } -// } - -// public void Off() -// { -// for (int i = 1; i <= Axisn.Count; i++) -// { -// GTSCardAPI.GT_AxisOff(0, (short)i); -// } -// } - -// public void GoHome() -// { -// try -// { -// //娓呴櫎鎶ヨ -// ClearGtsAlarm(); - -// Task.Run(() => -// { -// //鍏抽棴Gocator X Y -// _gts.WriteOut(Parameter.cardn, Parameter.EXO_8, false); -// _gts.WriteOut(Parameter.cardn, Parameter.EXO_16, false); -// ////鍒囨崲Gocator鐨凧ob涓洪暱杈笿ob -// //gocatorRecord.GocatorStop(); -// //gocatorRecord.SwitchJob(_product.JobLong); - -// //Z杞村洖鍘熺偣锛岃繑鍥炵數鏈烘柟鍚�,寰呯粨鏉熷悗鍐嶅姩X銆乊杞达紝閬垮厤纰版挒 -// _gts.GoHome(Parameter.cardn, Axisn.Z, GTSCardAPI.HOME_MODE_LIMIT_HOME, -1, 0); -// //X杞村洖鍘熺偣,杩滅鐢垫満 -// _gts.GoHome(Parameter.cardn, Axisn.X, GTSCardAPI.HOME_MODE_LIMIT_HOME, 1, 0); - -// _gts.GoHome(Parameter.cardn, Axisn.Y, GTSCardAPI.HOME_MODE_LIMIT_HOME, 1, 0); - -// while (true) -// { -// Thread.Sleep(100); -// if (_gts.IsStop(0, Axisn.X) && _gts.IsStop(0, Axisn.Y) && _gts.IsStop(0, Axisn.Z) && StopType == 0) -// { -// //鍓嶅線涓婃枡鐐� -// GoLoading(); -// PubSubCenter.GetInstance().Publish(MessageType.IsHome.ToString(), null, null); -// break; -// } -// } -// }); -// } -// catch (Exception ex) -// { -// Trace.TraceError("GoHome寮傚父锛歿0}", ex); -// } -// } - -// public void GoLoading() -// { -// try -// { -// while (true) -// { -// if (_gts.IsStop(0, Axisn.Y)) -// { -// _gts.P2P(Parameter.cardn, Axisn.Y, Parameter.loading, Parameter.freeSpeed); -// break; -// } -// } -// } -// catch (Exception ex) -// { -// Trace.TraceError("GoLoading寮傚父锛歿0}", ex); -// } - -// } - -// public void ClearGtsAlarm() -// { -// int axis_sts; -// uint clk; - -// GTSCardAPI.GT_ClrSts(Parameter.cardn, 1, Axisn.Count); -// for (short i = Axisn.Count; i > 0; i--) -// { -// GTSCardAPI.GT_GetSts(Parameter.cardn, i, out axis_sts, 1, out clk); -// if ((axis_sts & 0x200) == 0) -// { -// var rst = GTSCardAPI.GT_AxisOn(0, i); -// } - -// // 姝f瀬闄愭姤璀� -// if ((axis_sts & 0x20) != 0) -// { -// // 浣嶇疆璇烽浂 -// GTSCardAPI.GT_ZeroPos(Parameter.cardn, 1, Axisn.Count); -// // 璐熷悜绉诲姩 -// _gts.P2P(Parameter.cardn, i, -50, Parameter.homeSpeed); -// } - -// // 璐熸瀬闄愭姤璀� -// if ((axis_sts & 0x40) != 0) -// { -// // 浣嶇疆璇烽浂 -// GTSCardAPI.GT_ZeroPos(Parameter.cardn, 1, Axisn.Count); -// // 姝e悜绉诲姩 -// _gts.P2P(Parameter.cardn, i, 50, Parameter.homeSpeed); -// } -// } - -// // 娓呴櫎鐘舵�� -// GTSCardAPI.GT_ClrSts(Parameter.cardn, 1, Axisn.Count); -// } - -// public void Stop(bool value) -// { -// Task.Run(() => -// { -// try -// { -// _gts.Stop(Parameter.cardn, Axisn.X, value); -// _gts.Stop(Parameter.cardn, Axisn.Y, value); -// _gts.Stop(Parameter.cardn, Axisn.Z, value); -// } -// catch (Exception ex) -// { - -// } -// }); -// } - -// public void GoToFirst(ST_Point point) -// { -// _gts.P2P(Parameter.cardn, Axisn.X, point.X + 2000, Parameter.p2pSpeed); -// _gts.P2P(Parameter.cardn, Axisn.Y, point.Y, Parameter.p2pSpeed); -// _gts.P2P(Parameter.cardn, Axisn.Z, point.Z.Value, Parameter.p2pSpeed); -// while (true) -// { -// if (_gts.IsStop(0, Axisn.X) && _gts.IsStop(0, Axisn.Y) && _gts.IsStop(0, Axisn.Z)) break; -// } -// } - -// //public void ExistSport(int checkId, string barcode, CameraManager cameraManager, List<ST_Point> pointList, List<ST_CheckItem> checkItemExistList, string path) -// //{ -// // cameraManager.SetExposure(Parameter.existExposure); -// // cameraManager.BeginAcquisition(); -// // int speed = 0; - -// // int i = 1; -// // foreach (var point in pointList) -// // { -// // //鍥涗釜姝i潰鍏夛細true琛ㄧず鐔勭伃銆乫alse琛ㄧず浜捣 -// // if (!string.IsNullOrEmpty(point.Light) && point.Light.Contains(",")) -// // { -// // SetLightOn(point.Light); -// // } - -// // speed = Parameter.p2pSpeed; -// // _gts.P2P(Parameter.cardn, Axisn.X, point.X, speed); -// // _gts.P2P(Parameter.cardn, Axisn.Y, point.Y, speed); -// // _gts.P2P(Parameter.cardn, Axisn.Z, point.Z.Value, speed); -// // while (true) -// // { -// // if (_gts.IsStop(0, Axisn.X) && _gts.IsStop(0, Axisn.Y) && _gts.IsStop(0, Axisn.Z) && StopType == 0) break; -// // } - -// // cameraManager.ExistCheck(checkId, barcode, checkItemExistList, i, point, path); -// // CheckProcess checkProcess = i == 1 ? CheckProcess.Begin : i == pointList.Count ? CheckProcess.CheckEnd : CheckProcess.In; -// // i++; -// // } - -// // //鍥涗釜姝i潰鍏夛細true琛ㄧず鐔勭伃銆乫alse琛ㄧず浜捣 -// // SetLightOff(); - -// //} - -// public void Monitor() -// { -// lastInputValue = Parameter.InDefaultValue; -// Task.Factory.StartNew(() => -// { -// while (!cts.IsCancellationRequested) -// { -// try -// { -// Thread.Sleep(100); -// //mc.GT_GetDi(Parameter.cardn, mc.MC_LIMIT_POSITIVE, out curValueIo.Limpos); -// //mc.GT_GetDi(Parameter.cardn, mc.MC_LIMIT_NEGATIVE, out curValueIo.Limneg); -// //mc.GT_GetDi(Parameter.cardn, mc.MC_HOME, out curValueIo.Home); -// //mc.GT_GetDi(Parameter.cardn, mc.MC_ALARM, out curValueIo.Alarm); -// GTSCardAPI.GT_GetDi(Parameter.cardn, GTSCardAPI.MC_GPI, out curValueIo.Input); -// //mc.GT_GetDo(Parameter.cardn, mc.MC_GPO, out curValueIo.Output); -// //if (_gts.IsAlarm()) -// //{ -// // //鎬ュ仠 -// // _gts.Stop(Parameter.cardn, true); -// // // 寮�鍚彁绀虹孩鐏拰澹伴煶 -// // AlarmLight(AlarmType.Red); -// //} -// if (curValueIo.Input != lastInputValue) -// { -// OnMessageIO(); -// lastInputValue = curValueIo.Input; -// } -// } -// catch (Exception ex) -// { -// Trace.TraceError("Monitor: {0}", ex.Message); -// } -// } -// }, cts.Token); -// } - -// //private void OnMessageIO() -// //{ -// // try -// // { -// // //鏍规嵁淇″彿鎵ц鐩稿簲鍔ㄤ綔 -// // for (var i = 0; i < 16; i++) -// // { -// // if ((lastInputValue & (1 << i)) != (curValueIo.Input & (1 << i))) -// // { -// // // 鏈夊彉鍖栧湪鍙戝竷閫氱煡 InputBitIndex-Value(0/1) -// // byte v = (byte)((curValueIo.Input & (1 << i)) >> i); -// // PubSubCenter.GetInstance().Publish(MessageType.MessageIO.ToString(), i, v); -// // } -// // } -// // } -// // catch (Exception ex) -// // { -// // Trace.TraceError("OnServerMessage: {0}", ex.Message); -// // } -// //} - -// //private void SetLightOn(string lights) -// //{ -// // if (lights.Contains("1")) -// // { -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_9, false); -// // } -// // else -// // { -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_9, true); -// // } -// // if (lights.Contains("2")) -// // { -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_10, false); -// // } -// // else -// // { -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_10, true); -// // } -// // if (lights.Contains("3")) -// // { -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_11, false); -// // } -// // else -// // { -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_11, true); -// // } -// // if (lights.Contains("4")) -// // { -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_12, false); -// // } -// // else -// // { -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_12, true); -// // } -// //} - -// //private void SetLightOff() -// //{ -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_10, true); -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_9, true); -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_11, true); -// // _gts.WriteOut(Parameter.cardn, Parameter.EXO_12, true); -// //} -// } -//} diff --git a/src/Bro.Device.GTSCard/GtsIO.cs b/src/Bro.Device.GTSCard/GtsIO.cs deleted file mode 100644 index de2b527..0000000 --- a/src/Bro.Device.GTSCard/GtsIO.cs +++ /dev/null @@ -1,63 +0,0 @@ -锘�//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using System.Threading.Tasks; - -//namespace Bro.Device.GTSCard -//{ -// public class GtsIO -// { -// /// <summary> -// /// 杈撳叆鐐逛綅 -// /// </summary> -// public int Input; - -// /// <summary> -// /// 杈撳嚭鐐逛綅 -// /// </summary> -// public int Output; - -// /// <summary> -// /// 鍥為浂鐐逛綅 -// /// </summary> -// public int Home; - -// /// <summary> -// /// 姝f瀬闄� -// /// </summary> -// public int Limpos; - -// /// <summary> -// /// 璐熸瀬闄� -// /// </summary> -// public int Limneg; - -// /// <summary> -// /// 鎶ヨ淇℃伅 -// /// </summary> -// public int Alarm; - -// /// <summary> -// /// 杞寸姸鎬� -// /// </summary> -// public int AxisSts; - -// /// <summary> -// /// X杞磋鍒掍綅缃� -// /// </summary> -// public double PrfPosX; -// /// <summary> -// /// Y杞磋鍒掍綅缃� -// /// </summary> -// public double PrfPosY; -// /// <summary> -// /// Z杞磋鍒掍綅缃� -// /// </summary> -// public double PrfPosZ; -// /// <summary> -// /// A杞磋鍒掍綅缃� -// /// </summary> -// public double PrfPosA; -// } -//} diff --git a/src/Bro.Device.GTSCard/GtsMotionCard.cs b/src/Bro.Device.GTSCard/GtsMotionCard.cs deleted file mode 100644 index 4d5a7da..0000000 --- a/src/Bro.Device.GTSCard/GtsMotionCard.cs +++ /dev/null @@ -1,483 +0,0 @@ -锘�//using Broc.AOI.Entity; -//using System; -//using System.Collections.Generic; -//using System.Runtime.InteropServices; -//using System.Threading; - -//namespace Bro.Device.GTSCard -//{ -// public class GtsMotionCard -// { -// private const int dangliang = 1; -// private object lockobj = new object();//绾跨▼閿� -// /// <summary> -// /// 鍒濆鍖栧崱 -// /// </summary> -// /// <returns></returns> -// public bool InitCard() -// { -// short rtn; -// rtn = GTSCardAPI.GT_Open(0, 0, 1); //鎵撳紑杩愬姩鎺у埗鍣ㄣ�傚弬鏁板繀椤讳负锛�0,1锛夛紝涓嶈兘淇敼銆� -// //rtn += mc.GT_Reset(0); -// rtn += GTSCardAPI.GT_LoadConfig(0, AppDomain.CurrentDomain.BaseDirectory + @"Gts800.cfg"); -// rtn += GTSCardAPI.GT_ClrSts(0, 1, 8); -// return rtn == 0; - -// } -// /// <summary> -// /// 鎵╁睍妯″潡鍒濆鍖� -// /// </summary> -// /// <param name="cardNum"></param> -// /// <returns></returns> -// public bool ExtIOModuleInit(short cardNum) -// { -// short rtn = 0; -// rtn += GTSCardAPI.GT_OpenExtMdl(cardNum, "gts.dll"); -// rtn += GTSCardAPI.GT_LoadExtConfig(cardNum, "ExtModule.cfg"); -// rtn += GTSCardAPI.GT_ResetExtMdl(cardNum); -// return rtn == 0; -// } -// /// <summary> -// /// 鍥為浂 -// /// </summary> -// /// <param name="cardNum">鍗″彿</param> -// /// <param name="axisNum">杞村彿</param> -// /// <param name="homests">杞村洖鍘熺偣鐘舵��</param> -// public bool GoHome(short cardNum, short axisNum, short home_mode, short home_dir, int homeoffset) -// { -// GTSCardAPI.GT_ZeroPos(cardNum, axisNum, 1); -// GTSCardAPI.THomePrm thomeprm; -// GTSCardAPI.THomeStatus homests; -// short rtn = GTSCardAPI.GT_GetHomePrm(cardNum, axisNum, out thomeprm); -// thomeprm.mode = home_mode;//鍥為浂鏂瑰紡 -// thomeprm.moveDir = home_dir;//鍥為浂鏂瑰悜 -// thomeprm.edge = 0; -// thomeprm.velHigh = 50; -// thomeprm.velLow = 50; -// thomeprm.acc = 50; -// thomeprm.dec = 50; -// thomeprm.searchHomeDistance = 9999999;//鎼滄悳璺濈 -// thomeprm.homeOffset = 0; //鍋忕Щ璺濈 -// thomeprm.escapeStep = 1000; -// rtn = GTSCardAPI.GT_GoHome(cardNum, axisNum, ref thomeprm); //鍚姩鍥為浂 -// //do -// //{ -// // mc.GT_GetHomeStatus(cardNum, axisNum, out homests);//鑾峰彇鍥炲師鐐圭姸鎬� -// //} while (homests.run == 1); // 绛夊緟鎼滅储鍘熺偣鍋滄 -// //mc.GT_ZeroPos(cardNum, axisNum, 1); -// //return true; - -// while (true) -// { -// Thread.Sleep(5); -// GTSCardAPI.GT_GetHomeStatus(cardNum, axisNum, out homests); -// if (homests.run == 0) -// { -// if (homests.error == 0) -// { -// Thread.Sleep(200); -// GTSCardAPI.GT_ZeroPos(cardNum, axisNum, 1); -// } -// return true; -// } -// } -// } - -// /// <summary> -// /// 鐐逛綅鍒扮偣浣� 杩愬姩 -// /// </summary> -// /// <param name="cardNum">鍗″彿</param> -// /// <param name="axisNum">杞村彿</param> -// /// <param name="prfPosition">瑙勫垝浣嶇疆,鍗曚綅姣背</param> -// /// <param name="prfVelocity">瑙勫垝閫熷害,鍗曚綅绫虫瘡绉�</param> -// public void P2P(short cardNum, short axisNum, int prfPosition, int prfVelocity) -// { -// GTSCardAPI.TTrapPrm trapprm; -// GTSCardAPI.GT_PrfTrap(cardNum, axisNum); -// GTSCardAPI.GT_GetTrapPrm(cardNum, axisNum, out trapprm); -// trapprm.acc = Parameter.p2pAcc; -// trapprm.dec = Parameter.p2pDec; -// trapprm.smoothTime = 1; -// GTSCardAPI.GT_SetTrapPrm(cardNum, axisNum, ref trapprm); -// GTSCardAPI.GT_SetPos(cardNum, axisNum, prfPosition * dangliang); -// GTSCardAPI.GT_SetVel(cardNum, axisNum, prfVelocity * dangliang); -// GTSCardAPI.GT_Update(cardNum, 1 << (axisNum - 1)); -// } - -// /// <summary> -// /// 鍋滄 -// /// </summary> -// /// <param name="cardNum"></param> -// /// <param name="axisNum"></param> -// /// <param name="option">0琛ㄧず骞虫粦鍋滄锛�1琛ㄧず绱ф�ュ仠姝�</param> -// public void Stop(short cardNum, short axisNum, short option) -// { -// GTSCardAPI.GT_Stop(cardNum, 1 << (axisNum - 1), option); -// } - -// /// <summary> -// /// 鍋滄 -// /// </summary> -// /// <param name="cardNum"></param> -// /// <param name="value">鍋滄鏂瑰紡锛宖alse琛ㄧず骞虫粦鍋滄锛宼rue琛ㄧず绱ф�ュ仠姝�</param> -// public void Stop(short cardNum, bool value) -// { -// for (short i = 1; i <= Axisn.Count; i++) -// { -// Stop(cardNum, i, value); -// } -// } - -// /// <summary> -// /// Jog杩愬姩 -// /// </summary> -// /// <param name="cardNum"></param> -// /// <param name="axisNum"></param> -// /// <param name="prfvel_ms">瑙勫垝閫熷害锛屽崟浣嶇背姣忕</param> -// public void Jog(short cardNum, short axisNum, double prfvel_ms) -// { -// GTSCardAPI.TJogPrm jogprm = new GTSCardAPI.TJogPrm(); -// short rtn = GTSCardAPI.GT_PrfJog(cardNum, axisNum); -// jogprm.acc = 1; -// jogprm.dec = 1; -// GTSCardAPI.GT_SetJogPrm(cardNum, axisNum, ref jogprm);//璁剧疆jog杩愬姩鍙傛暟 -// GTSCardAPI.GT_SetVel(cardNum, axisNum, prfvel_ms);//璁剧疆鐩爣閫熷害 -// GTSCardAPI.GT_Update(cardNum, 1 << (axisNum - 1));//鏇存柊杞磋繍鍔� -// } -// /// <summary> -// /// 璇诲彇杈撳叆 -// /// </summary> -// /// <param name="cardNum">鍗″彿</param> -// /// <param name="index">杈撳叆鍙�</param> -// /// <returns>鏈夎緭鍏ヨ繑鍥瀟rue锛屾棤杈撳叆杩斿洖false</returns> -// public bool GetDi(short cardNum, short index) -// { -// int value; -// GTSCardAPI.GT_GetDi(cardNum, GTSCardAPI.MC_GPI, out value); -// if ((value & 1 << index) == 0) return true;//鏈夎緭鍏ヨ繑鍥瀟rue -// else return false; //鏃犺緭鍏ヨ繑鍥瀎alse -// } -// /// <summary> -// /// 璇诲彇姝i檺浣� -// /// </summary> -// /// <param name="cardNum">鍗″彿</param> -// /// <param name="axisNum">杞村彿</param> -// /// <returns>0琛ㄧず瑙﹀彂闄愪綅锛�1琛ㄧず娌℃湁瑙﹀彂</returns> -// public bool GetPosLimit(short cardNum, short axisNum) -// { -// int value; -// GTSCardAPI.GT_GetDi(cardNum, GTSCardAPI.MC_LIMIT_POSITIVE, out value); -// if ((value & 1 << axisNum) == 0) return true;////0琛ㄧず瑙﹀彂闄愪綅,杩斿洖true锛� -// else return false; // //1琛ㄧず娌℃湁瑙﹀彂,杩斿洖false -// } -// /// <summary> -// /// 璇诲彇璐熼檺浣� -// /// </summary> -// /// <param name="cardNum">鍗″彿</param> -// /// <param name="axisNum">杞村彿</param> -// /// <returns>0琛ㄧず瑙﹀彂闄愪綅,杩斿洖true锛�1琛ㄧず娌℃湁瑙﹀彂,杩斿洖false</returns> -// public bool GetNegLimit(short cardNum, short axisNum) -// { -// int value; -// GTSCardAPI.GT_GetDi(cardNum, GTSCardAPI.MC_LIMIT_NEGATIVE, out value); -// if ((value & 1 << axisNum) == 0) return true;//0琛ㄧず瑙﹀彂闄愪綅,杩斿洖true锛� -// else return false; //1琛ㄧず娌℃湁瑙﹀彂,杩斿洖false -// } -// /// <summary> -// /// 杈撳嚭 -// /// </summary> -// /// <param name="cardNumo">鍗″彿</param> -// /// <param name="index">杈撳嚭鍙�,杩斿洖1-16</param> -// /// <param name="value">0琛ㄧず杈撳嚭锛�1琛ㄧず鍏抽棴</param> -// public void WriteOut(short cardNumo, short index, bool value) -// { -// short outNum = 0; -// outNum = (short)(index % 100 + 1); -// switch (value) -// { -// case true: -// { -// GTSCardAPI.GT_SetDoBit(cardNumo, GTSCardAPI.MC_GPO, outNum, 0);//鎸変綅杈撳嚭锛�0琛ㄧず杈撳嚭锛�1琛ㄧず鍏抽棴 -// } -// break; -// case false: -// { -// GTSCardAPI.GT_SetDoBit(cardNumo, GTSCardAPI.MC_GPO, outNum, 1);//鎸変綅杈撳嚭锛�0琛ㄧず杈撳嚭锛�1琛ㄧず鍏抽棴 -// } -// break; -// } -// } -// /// <summary> -// /// 璇诲彇IO杈撳嚭鐘舵�� -// /// </summary> -// /// <param name="cardNumo"></param> -// /// <param name="index"></param> -// /// <returns></returns> -// public bool GetDoSts(short cardNumo, short index) -// { -// short outNum = 0; -// int outSts; -// outNum = (short)(index % 100); -// GTSCardAPI.GT_GetDo(cardNumo, GTSCardAPI.MC_GPO, out outSts); -// if ((outSts & (1 << outNum)) == 0) return true; -// else return false; -// } -// /// <summary> -// /// 璇诲彇褰撳墠鍊� -// /// </summary> -// /// <param name="cardNum">鍗″彿</param> -// /// <param name="axisNum">杞村彿</param> -// /// <returns>杩斿洖褰撳墠鍊硷紝鍗曚綅姣背</returns> -// public double GetPosMM(short cardNum, short axisNum) -// { -// lock (lockobj) -// { -// double prfpos = 0; uint pclock = 0; -// GTSCardAPI.GT_GetPrfPos(cardNum, axisNum, out prfpos, 1, out pclock); -// return prfpos / dangliang; -// } -// } - -// /// <summary> -// /// 璇诲彇杞寸姸鎬侊紝鍒ゆ柇鐢垫満鏄惁鍋滄 -// /// </summary> -// /// <param name="cardNum"></param> -// /// <param name="axisNum"></param> -// /// <returns></returns> -// public bool IsStop(short cardNum, short axisNum) -// { -// lock (lockobj) -// { -// int sts = 0; -// uint pclock = 0; -// GTSCardAPI.GT_GetSts(cardNum, axisNum, out sts, 1, out pclock); -// if ((sts & 0x400) == 0) return true;//鍋滄杩斿洖true -// else return false; //杩愯涓繑鍥瀎alse -// } -// } - -// /// <summary> -// /// 浜岀淮浣嶇疆姣旇緝杈撳嚭 -// /// </summary> -// /// <param name="cardNum"></param> -// /// <param name="output_data"></param> -// public void Compare2DOutput(short cardNum, short chn, int[] output_data) -// { -// GTSCardAPI.GT_2DCompareClear(cardNum, chn); -// GTSCardAPI.GT_2DCompareMode(cardNum, chn, GTSCardAPI.COMPARE2D_MODE_2D); -// GTSCardAPI.GT_SetComparePort(cardNum, GTSCardAPI.COMPARE_PORT_GPO, 0, 1); -// GTSCardAPI.T2DComparePrm Prm; -// Prm.encx = 1; -// Prm.ency = 2; -// Prm.maxerr = 300; -// Prm.outputType = 0; -// Prm.source = 0; -// Prm.startLevel = 0; -// Prm.threshold = 10; -// Prm.time = 10000; -// GTSCardAPI.GT_2DCompareSetPrm(cardNum, chn, ref Prm); -// GTSCardAPI.T2DCompareData[] pBuf = new GTSCardAPI.T2DCompareData[5]; -// for (int i = 0; i < output_data.Length / 2; i += 2) -// { -// pBuf[i].px = 1000; -// pBuf[i + 1].py = 1000; -// } -// GTSCardAPI.GT_2DCompareData(cardNum, chn, (short)(output_data.Length / 2), ref pBuf[0], 0); -// GTSCardAPI.GT_2DCompareStart(cardNum, chn); -// } - -// /// <summary> -// /// 鎸変綅璇诲彇鎵╁睍IO杈撳叆鍙� -// /// </summary> -// /// <param name="cardNum"></param> -// /// <param name="mdl"></param> -// /// <param name="index"></param> -// /// <returns></returns> -// public bool GetDiBit(short cardNum, short mdl, short index) -// { -// ushort pvalue = 0; -// GTSCardAPI.GT_GetExtIoBit(cardNum, mdl, index, out pvalue); -// return pvalue == 0; -// } - -// /// <summary> -// /// IO杈撳嚭 -// /// </summary> -// /// <param name="cardNum">鍗″彿</param> -// /// <param name="mdl">妯″潡鍙�</param> -// /// <param name="index">IO杈撳嚭</param> -// /// <param name="value">true琛ㄧず杈撳嚭锛宖alse琛ㄧず鏃犺緭鍑�</param> -// public void MC_WriteDigitalOutput(short cardNum, short mdl, short index, bool value) -// { -// if (value) -// { -// GTSCardAPI.GT_SetExtIoBit(cardNum, mdl, index, 0); -// } -// else -// { -// GTSCardAPI.GT_SetExtIoBit(cardNum, mdl, index, 1); -// } -// } - -// /// <summary> -// /// 寤虹珛鎻掕ˉ鍧愭爣绯� -// /// </summary> -// /// <param name="crdnum">鍧愭爣绯诲彿</param> -// public void BuildCrd(short cardNum, short crdn, short axis_x, short axis_y, double maxVel, double maxAcc, short evenTime) -// { -// GTSCardAPI.TCrdPrm crdPrm; -// crdPrm.dimension = 2; -// crdPrm.synVelMax = maxVel; -// crdPrm.synAccMax = maxAcc; -// crdPrm.evenTime = evenTime; -// crdPrm.profile1 = 1; -// crdPrm.profile2 = 2; -// crdPrm.profile3 = 0; -// crdPrm.profile4 = 0; -// crdPrm.profile5 = 0; -// crdPrm.profile6 = 0; -// crdPrm.profile7 = 0; -// crdPrm.profile8 = 0; -// crdPrm.setOriginFlag = 1; -// crdPrm.originPos1 = 0; -// crdPrm.originPos2 = 0; -// crdPrm.originPos3 = 0; -// crdPrm.originPos4 = 0; -// crdPrm.originPos5 = 0; -// crdPrm.originPos6 = 0; -// crdPrm.originPos7 = 0; -// crdPrm.originPos8 = 0; -// GTSCardAPI.GT_SetCrdPrm(cardNum, crdn, ref crdPrm); -// GTSCardAPI.GT_CrdClear(cardNum, crdn, 0); -// GTSCardAPI.GT_ClrSts(cardNum, 1, 4); -// } -// /// <summary> -// /// 鐩寸嚎鎻掕ˉ -// /// </summary> -// /// <param name="chabunum"></param> -// public void LnXY(short cardNum, short crdn, short fifon, int[] data, double vel, double prfacc, double endVel) -// { -// short run; -// int segment; -// for (int i = 0; i < data.Length; i += 2) -// { -// run = GTSCardAPI.GT_LnXY(cardNum, crdn, data[i], data[i + 1], vel, prfacc, endVel, fifon); -// } -// run = GTSCardAPI.GT_CrdStart(cardNum, crdn, 0); -// //while (true) -// //{ -// // mc.GT_CrdStatus(cardNum, crdn, out run, out segment, fifon); -// // if (run == 0) -// // { -// // break; -// // } -// //} -// } -// /// <summary> -// /// 浠ュ渾蹇冨仛鍦嗗姬鎻掕ˉ -// /// </summary> -// /// <param name="cardNum"></param> -// /// <param name="crdn"></param> -// /// <param name="fifon"></param> -// /// <param name="data"></param> -// /// <param name="xCenter"></param> -// /// <param name="yCenter"></param> -// /// <param name="dir"></param> -// /// <param name="vel"></param> -// /// <param name="prfacc"></param> -// /// <param name="endVel"></param> -// public void ArcXYC(short cardNum, short crdn, short fifon, int[] data, double xCenter, double yCenter, short dir, double vel, double prfacc, double endVel) -// { -// short run; -// int segment; -// for (int i = 0; i < data.Length; i += 2) -// { -// GTSCardAPI.GT_ArcXYC(cardNum, crdn, data[i], data[i + 1], xCenter, yCenter, dir, vel, prfacc, endVel, fifon); -// } -// GTSCardAPI.GT_CrdStart(cardNum, crdn, 0); -// while (true) -// { -// GTSCardAPI.GT_CrdStatus(cardNum, crdn, out run, out segment, fifon); -// if (run == 0) -// { -// break; -// } -// } -// } -// /// <summary> -// /// 浠ュ崐寰勫仛鍦嗗姬鎻掕ˉ -// /// </summary> -// /// <param name="cardNum"></param> -// /// <param name="crdn"></param> -// /// <param name="fifon"></param> -// /// <param name="data"></param> -// /// <param name="rad"></param> -// /// <param name="dir"></param> -// /// <param name="vel"></param> -// /// <param name="prfacc"></param> -// /// <param name="endVel"></param> -// public void ArcXYR(short cardNum, short crdn, short fifon, int[] data, double rad, short dir, double vel, double prfacc, double endVel) -// { -// short run; -// int segment; -// for (int i = 0; i < data.Length; i += 2) -// { -// GTSCardAPI.GT_ArcXYR(cardNum, crdn, data[i], data[i + 1], rad, dir, vel, prfacc, endVel, fifon); -// } -// GTSCardAPI.GT_CrdStart(cardNum, crdn, 0); -// while (true) -// { -// GTSCardAPI.GT_CrdStatus(cardNum, crdn, out run, out segment, fifon); -// if (run == 0) -// { -// break; -// } -// } -// } -// /// <summary> -// /// 鍋滄杩愬姩 -// /// </summary> -// /// <param name="cardNum"></param> -// /// <param name="axisNum">杞村彿</param> -// /// <param name="value">鍋滄鏂瑰紡锛宖alse琛ㄧず骞虫粦鍋滄锛宼rue琛ㄧず绱ф�ュ仠姝�</param> -// public void Stop(short cardNum, short axisNum, bool value) -// { -// switch (value) -// { -// case false: -// { -// GTSCardAPI.GT_Stop(cardNum, 1 << (axisNum - 1), 0); -// } -// break; -// case true: -// { -// GTSCardAPI.GT_Stop(cardNum, 1 << (axisNum - 1), 1 << (axisNum - 1)); - -// } -// break; -// } - -// } - -// /// <summary> -// /// 鏄惁鎶ヨ -// /// bit 0-鍏夋爡锛宐it 1-闂ㄥ紑鍏筹紝bit 2-鎬ュ仠 -// /// 1100 0000 0101 -// /// </summary> -// /// <returns></returns> -// public bool IsAlarm() -// { -// GTSCardAPI.GT_GetDi(Parameter.cardNum, GTSCardAPI.MC_GPI, out var input); -// var bRet = -// ((input & (1 << Parameter.EXI6)) >> Parameter.EXI6) == 1 || -// //((input & (1 << GlueInCommands.EXI1)) >> GlueInCommands.EXI1) == 0 || todo -// ((input & (1 << Parameter.EXI4)) >> Parameter.EXI4) == 1; -// //var bRet = isAlarm || -// // ((input & (1 << Parameter.EXI6)) >> Parameter.EXI6) == 1 || -// // //((input & (1 << GlueInCommands.EXI1)) >> GlueInCommands.EXI1) == 0 || todo -// // ((input & (1 << Parameter.EXI4)) >> Parameter.EXI4) == 1; - -// return bRet; -// } -// } -//} \ No newline at end of file diff --git a/src/Bro.Device.GTSCard/GtsParameter.cs b/src/Bro.Device.GTSCard/GtsParameter.cs deleted file mode 100644 index 7e4f21d..0000000 --- a/src/Bro.Device.GTSCard/GtsParameter.cs +++ /dev/null @@ -1,194 +0,0 @@ -锘�//using System; -//using System.Collections.Generic; -//using System.Configuration; -//using System.Linq; -//using System.Text; -//using System.Threading.Tasks; - -//namespace Broc.AOI.Entity -//{ -// /// <summary> -// /// 鐐逛綅绫诲瀷 -// /// </summary> -// public enum PointType -// { -// /// <summary> -// /// 鐩寸嚎鎻掕ˉ -// /// </summary> -// Line = 1, -// /// <summary> -// /// 鍦嗗姬鎻掕ˉ(鍗婂緞) -// /// </summary> -// CircleRadius, -// /// <summary> -// /// 鍦嗗姬鎻掕ˉ(鍦嗗績) -// /// </summary> -// CircleCenter -// } - -// public static class Axisn -// { -// public const short X = 1; -// public const short Y = 2; -// public const short Z = 3; -// public const short Count = 4; -// } - -// public static class Parameter -// { -// #region 杩愬姩鍙傛暟 -// public static short cardn = Convert.ToInt16(ConfigurationManager.AppSettings["cardn"]); -// public static short crdn = Convert.ToInt16(ConfigurationManager.AppSettings["crdn"]); -// public static short fifo = Convert.ToInt16(ConfigurationManager.AppSettings["fifo"]); -// public static int flySpeed = Convert.ToInt32(ConfigurationManager.AppSettings["flySpeed"]); -// public static double flyAcc = Convert.ToDouble(ConfigurationManager.AppSettings["flyAcc"]); -// public static int gocatorSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["gocatorSpeed"]); -// public static int p2pSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["p2pSpeed"]); -// public static double p2pAcc = Convert.ToDouble(ConfigurationManager.AppSettings["p2pAcc"]); -// public static double p2pDec = Convert.ToDouble(ConfigurationManager.AppSettings["p2pDec"]); -// public static int calibrationSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["calibrationSpeed"]); -// public static int calibrationZ = Convert.ToInt16(ConfigurationManager.AppSettings["calibrationZ"]); -// public static int barcodeSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["barcodeSpeed"]); -// public static int freeSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["freeSpeed"]); -// public static int velEnd = Convert.ToInt32(ConfigurationManager.AppSettings["velEnd"]); -// public static int homeSpeed = Convert.ToInt32(ConfigurationManager.AppSettings["homeSpeed"]); -// public static int loading = Convert.ToInt32(ConfigurationManager.AppSettings["loading"]); -// //public const short cardn = 0;//杩愬姩鎺у埗鍣ㄥ崱鍙� 榛樿涓猴細0 -// //public const short crdn = 1;//鍧愭爣绯诲彿 鍙栧�艰寖鍥达細[1, 2] -// //public const short fifo = 0;//鎻掕ˉ缂撳瓨鍖哄彿 鍙栧�艰寖鍥达細[0, 1]锛岄粯璁ゅ�间负锛�0 -// //public const int flySpeed = 250;//椋炴媿閫熷害 -// //public const double flyAcc = 0.5;//椋炴媿鍔犻�熷害 -// //public const int gocatorSpeed = 150;//3D妫�娴嬭酱杩愬姩閫熷害 -// //public const int p2pSpeed = 250;//P2P閫熷害 -// //public const double p2pAcc = 1;//P2P鍔犻�熷害 -// //public const double p2pDec = 1;//P2P鍑忛�熷害 -// //public const int calibrationSpeed = 10;//鏍囧畾閫熷害 -// //public const int calibrationZ = 19336;//鏍囧畾Z杞撮珮搴� -// //public const int barcodeSpeed = 250;//鏉$爜妫�娴嬭酱杩愬姩閫熷害 -// //public const int freeSpeed = 250;//闈炴娴嬫椂杞磋繍鍔ㄩ�熷害 -// //public const int velEnd = 0;//椋炴媿缁撴潫閫熷害 -// //public const int homeSpeed = 50;//鍥為浂閫熷害 -// //public const int loading = 80000;//涓婃枡浣嶇疆 -// #endregion - -// #region 鐩告満鍙傛暟 -// public static int flyExposure = Convert.ToInt32(ConfigurationManager.AppSettings["flyExposure"]); -// public static int photoExposure = Convert.ToInt32(ConfigurationManager.AppSettings["photoExposure"]); -// public static int codeExposure = Convert.ToInt32(ConfigurationManager.AppSettings["codeExposure"]); -// public static int existExposure = Convert.ToInt32(ConfigurationManager.AppSettings["existExposure"]); -// public static int holeExposure = Convert.ToInt32(ConfigurationManager.AppSettings["holeExposure"]); -// public static int realTimeExposure = Convert.ToInt32(ConfigurationManager.AppSettings["realTimeExposure"]); - -// //public const int flyExposure = 200;//椋炴媿鏇濆厜 -// //public const int photoExposure = 250000;//鎷嶇収鏇濆厜 -// //public const int codeExposure = 20000;//鏉$爜鏇濆厜 -// //public const int existExposure = 20000;//鏈夋棤妫�娴嬬殑鏇濆厜 -// #endregion - -// #region IO -// /// <summary> -// /// 杈撳叆IO榛樿鍊� -// /// </summary> -// public const int InDefaultValue = 0xFFDA; -// /// <summary> -// /// 澶圭揣姘旂几 -// /// </summary> -// public const short EXO_1 = 100;//澶圭揣姘旂几 -// /// <summary> -// /// 鏃ュ厜鐏� -// /// </summary> -// public const short EXO_2 = 101;//鏃ュ厜鐏� -// /// <summary> -// /// 鍏夋簮鍒囨崲 -// /// </summary> -// public const short EXO_3 = 102;//鍏夋簮鍒囨崲 -// /// <summary> -// /// 绾㈢伅 -// /// </summary> -// public const short EXO_4 = 103;//绾㈢伅 -// /// <summary> -// /// 榛勭伅 -// /// </summary> -// public const short EXO_5 = 104;//榛勭伅 -// /// <summary> -// /// 缁跨伅 -// /// </summary> -// public const short EXO_6 = 105;//缁跨伅 -// /// <summary> -// /// 铚傞福鍣� -// /// </summary> -// public const short EXO_7 = 106;//铚傞福鍣� -// /// <summary> -// /// Gocator X -// /// </summary> -// public const short EXO_8 = 107;//Gocator X - -// /// <summary> -// /// 姝i潰鍏�(宸�) -// /// </summary> -// public const short EXO_9 = 108;//姝i潰鍏�(宸�) - -// /// <summary> -// /// 姝i潰鍏�(鍚�) -// /// </summary> -// public const short EXO_10 = 109;//姝i潰鍏�(鍚�) - -// /// <summary> -// /// 姝i潰鍏�(鍙�) -// /// </summary> -// public const short EXO_11 = 110;//姝i潰鍏�(鍙�) - -// /// <summary> -// /// 姝i潰鍏�(鍓�) -// /// </summary> -// public const short EXO_12 = 111;//姝i潰鍏�(鍓�) - -// /// <summary> -// /// Gocator Y -// /// </summary> -// public const short EXO_16 = 115;//Gocator Y - -// /// <summary> -// /// 杈撳嚭IO榛樿鍊� -// /// </summary> -// public const int OutDefaultValue = 0xFFF; -// /// <summary> -// /// 宸﹀惎鍔� -// /// </summary> -// public const short EXI0 = 0;//宸﹁捣鍔� -// /// <summary> -// /// 鍙冲惎鍔� -// /// </summary> -// public const short EXI1 = 1;//鍙宠捣鍔� -// /// <summary> -// /// 鍋滄 -// /// </summary> -// public const short EXI2 = 2;//鍋滄 -// /// <summary> -// /// 澶嶄綅 -// /// </summary> -// public const short EXI3 = 3;//澶嶄綅 -// /// <summary> -// /// 鎬ュ仠 -// /// </summary> -// public const short EXI4 = 4;//鎬ュ仠 -// /// <summary> -// /// 闂ㄥ紑鍏� -// /// </summary> -// public const short EXI5 = 5;//闂ㄥ紑鍏� -// /// <summary> -// /// 瀹夊叏鍏夊箷 -// /// </summary> -// public const short EXI6 = 6;//瀹夊叏鍏夊箷 -// public const short EXI7 = 7;// -// /// <summary> -// /// 澶圭揣姘旂几鍘熶綅 -// /// </summary> -// public const short EXI8 = 8;//澶圭揣姘旂几鍘熶綅 -// /// <summary> -// /// 澶圭揣姘旂几鍒颁綅 -// /// </summary> -// public const short EXI9 = 9;//澶圭揣姘旂几鍒颁綅 -// #endregion -// } -//} diff --git a/src/Bro.Device.GTSCard/GtsPos.cs b/src/Bro.Device.GTSCard/GtsPos.cs deleted file mode 100644 index 8882cf2..0000000 --- a/src/Bro.Device.GTSCard/GtsPos.cs +++ /dev/null @@ -1,78 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Bro.Device.GTSCard -{ - /// <summary> - /// 鍥洪珮鐐逛綅缁撴瀯 - /// </summary> - public class GtsPos - { - /// <summary> - /// 鐐逛綅绫诲瀷 - /// </summary> - public PosType Type; - - /// <summary> - /// 鎻掕ˉ娈� x 杞寸粓鐐瑰潗鏍囧��,鍙栧�艰寖鍥达細[-1073741823, 1073741823]锛屽崟浣嶏細pulse - /// </summary> - public int X; - - /// <summary> - /// 鎻掕ˉ娈� y 杞寸粓鐐瑰潗鏍囧�笺�傚彇鍊艰寖鍥达細[-1073741823, 1073741823]锛屽崟浣嶏細pulse - /// </summary> - public int Y; - - /// <summary> - /// 鎻掕ˉ娈� z 杞寸粓鐐瑰潗鏍囧�笺�傚彇鍊艰寖鍥达細[-1073741823, 1073741823]锛屽崟浣嶏細pulse - /// </summary> - public int Z; - - /// <summary> - /// 鍦嗗姬鎻掕ˉ鐨勫渾蹇� x 鏂瑰悜鐩稿浜庤捣鐐逛綅缃殑鍋忕Щ閲忋�� - /// </summary> - public double CenterX; - - /// <summary> - /// 鍦嗗姬鎻掕ˉ鐨勫渾蹇� y 鏂瑰悜鐩稿浜庤捣鐐逛綅缃殑鍋忕Щ閲� - /// </summary> - public double CenterY; - - /// <summary> - /// 鍦嗗姬鎻掕ˉ鐨勫渾寮у崐寰勫�笺�傚彇鍊艰寖鍥达細[-1073741823, 1073741823]锛屽崟浣嶏細pulse銆� - /// 鍗婂緞涓烘鏃讹紝琛ㄧず鍦嗗姬涓哄皬浜庣瓑浜� 180掳鍦嗗姬銆� - /// 鍗婂緞涓鸿礋鏃讹紝琛ㄧず鍦嗗姬涓哄ぇ浜� 180掳鍦嗗姬銆� - /// 鍗婂緞鎻忚堪鏂瑰紡涓嶈兘鐢ㄦ潵鎻忚堪鏁村渾銆� - /// </summary> - public double Radius; - - /// <summary> - /// 鍦嗗姬鐨勬棆杞柟鍚戙�� 0锛氶『鏃堕拡鍦嗗姬銆� 1锛氶�嗘椂閽堝渾寮� - /// </summary> - public short CircleDir; - - /// <summary> - /// 鎻掕ˉ娈电殑鐩爣鍚堟垚閫熷害銆傚彇鍊艰寖鍥达細(0, 32767)锛屽崟浣嶏細pulse/ms銆� - /// </summary> - public double Vel; - - /// <summary> - /// 鎻掕ˉ娈电殑鍚堟垚鍔犻�熷害銆傚彇鍊艰寖鍥达細(0, 32767)锛屽崟浣嶏細pulse/ms2銆� - /// </summary> - public double Acc; - - /// <summary> - /// 鎻掕ˉ娈电殑缁堢偣閫熷害銆傚彇鍊艰寖鍥达細[0, 32767)锛屽崟浣嶏細pulse/ms銆� - /// 璇ュ�煎彧鏈夊湪娌℃湁浣跨敤 鍓嶇灮棰勫鐞嗗姛鑳芥椂鎵嶆湁鎰忎箟锛屽惁鍒欒鍊兼棤鏁堛�傞粯璁ゅ�间负锛�0銆� - /// </summary> - public double EndVel; - - /// <summary> - /// 鍏宠仈瀛楁 - /// </summary> - public int CameraPoSq { get; set; } - } -} diff --git a/src/Bro.Device.GTSCard/gts.dll b/src/Bro.Device.GTSCard/gts.dll new file mode 100644 index 0000000..bc0d7d1 --- /dev/null +++ b/src/Bro.Device.GTSCard/gts.dll Binary files differ diff --git a/src/Bro.Device.GTSCard/packages.config b/src/Bro.Device.GTSCard/packages.config new file mode 100644 index 0000000..07e3593 --- /dev/null +++ b/src/Bro.Device.GTSCard/packages.config @@ -0,0 +1,4 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net452" /> +</packages> \ No newline at end of file -- Gitblit v1.8.0