From eafdcc5ad6a55d3dfdec6c4787c3f3a9f32efc7f Mon Sep 17 00:00:00 2001 From: xcd <834800634@qq.com> Date: 星期二, 29 九月 2020 13:27:50 +0800 Subject: [PATCH] 1. M071B机台配置 2. GTS板卡添加回原点捕获模式和输入信号模式 3. CameraBase使用Dictionary类型做图片缓存 4. M071流程显式Copy,原来是为了避免内存泄漏,但目前来看不是这方面原因 5. Gocator驱动添加GoDataSet之类KObject资源显式回收,怀疑其中也有非托管对象资源,测试确实起到内存回收作用 --- src/Bro.Device.GTSCard/GTSCardDriver.cs | 40 ++++++++++++++++++++++++++++++---------- 1 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs index a721273..d0c3dff 100644 --- a/src/Bro.Device.GTSCard/GTSCardDriver.cs +++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs @@ -907,16 +907,19 @@ // 璁剧疆鐐逛綅妯″紡杩愬姩鍙傛暟 sRtn = GTSCardAPI.GT_SetTrapPrm((short)IConfig.CardNum, (short)movingOption.AxisIndex, ref trapPrm); // 璁剧疆鐐逛綅妯″紡鐩爣閫熷害锛屽嵆鍥炲師鐐归�熷害 - sRtn = GTSCardAPI.GT_SetVel((short)IConfig.CardNum, (short)movingOption.AxisIndex, goHomePara.HighVelocity); + sRtn = GTSCardAPI.GT_SetVel((short)IConfig.CardNum, (short)movingOption.AxisIndex, goHomePara.HomeVelocity); do { PositionReset(movingOption.AxisIndex, 1); ClearStatus(movingOption.AxisIndex, 1); - //鎼滅储璺濈 闃舵1 - // 鍚姩Home鎹曡幏 - sRtn = GTSCardAPI.GT_SetCaptureMode((short)IConfig.CardNum, (short)movingOption.AxisIndex, GTSCardAPI.CAPTURE_HOME); + if (goHomePara.IsCaptureMode) + { + //鎼滅储璺濈 闃舵1 + // 鍚姩Home鎹曡幏 + sRtn = GTSCardAPI.GT_SetCaptureMode((short)IConfig.CardNum, (short)movingOption.AxisIndex, GTSCardAPI.CAPTURE_HOME); + } // 璁剧疆鐐逛綅妯″紡鐩爣浣嶇疆锛屽嵆鍘熺偣鎼滅储璺濈 sRtn = GTSCardAPI.GT_SetPos((short)IConfig.CardNum, (short)movingOption.AxisIndex, homeDirection ? 99999999 : -99999999); @@ -926,15 +929,32 @@ int repeatTime = goHomePara.GoHomeTimeOut * 1000; bool isStop = false; - int pos; + int pos = 0; uint clk;//鏃堕挓鍙傛暟 + + int checkInterval = IConfig.MonitorInterval; + if (IConfig.MonitorInterval <= 0) + { + checkInterval = 10; + } + do { - Thread.Sleep(IConfig.MonitorInterval * 5); - // 璇诲彇鎹曡幏鐘舵�� - GTSCardAPI.GT_GetCaptureStatus((short)IConfig.CardNum, (short)movingOption.AxisIndex, out capture, out pos, 1, out clk); + Thread.Sleep(checkInterval * 2); + + if (goHomePara.IsCaptureMode) + { + // 璇诲彇鎹曡幏鐘舵�� + GTSCardAPI.GT_GetCaptureStatus((short)IConfig.CardNum, (short)movingOption.AxisIndex, out capture, out pos, 1, out clk); + } + else + { + GTSCardAPI.GT_GetDi((short)IConfig.CardNum, GTSCardAPI.MC_HOME, out int pValue); + + capture = (short)((pValue & (1 << (movingOption.AxisIndex - 1))) == 0 ? 1 : 0); + } isStop = IsStop((short)movingOption.AxisIndex); - repeatTime -= IConfig.MonitorInterval * 5; + repeatTime -= checkInterval * 2; } while (!(isStop || capture == 1 || repeatTime <= 0)); if (repeatTime <= 0) @@ -1253,7 +1273,7 @@ var newValues = GetMonitorValues(); //var newAxisMovingStatus = GetAxisMovingStatus(); - if (newValues == null || newValues.Count == 0 ) + if (newValues == null || newValues.Count == 0) continue; //Stopwatch sw = new Stopwatch(); -- Gitblit v1.8.0