领胜LDS 键盘AOI检测项目
patrick.xu
2021-01-24 b5e7fa2db4ac36fdb7bf9fd330d12a72ade9d483
src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -400,10 +400,13 @@
        /// <returns></returns>
        private bool SetAxisParam(MovingOption optionPara)
        {
            List<short> resultCode = new List<short>() { 0 };
            List<short> resultCode = new List<short>();
            GTSCardAPI.TTrapPrm trapprm = new GTSCardAPI.TTrapPrm();
            short axisIndex = short.Parse(optionPara.AxisIndexStr);
            resultCode.Add(GTSCardAPI.GT_PrfTrap((short)IConfig.CardNum, axisIndex));
            if (optionPara.VelocityPara.Acc != 0 || optionPara.VelocityPara.Dec != 0)
            {
            resultCode.Add(GTSCardAPI.GT_GetTrapPrm((short)IConfig.CardNum, axisIndex, out trapprm));
            trapprm.smoothTime = 1;
@@ -418,6 +421,7 @@
            }
            resultCode.Add(GTSCardAPI.GT_SetTrapPrm((short)IConfig.CardNum, axisIndex, ref trapprm));
            }
            if (optionPara.VelocityPara.Velocity != 0)
            {
@@ -427,9 +431,10 @@
            var resultOK = resultCode.All(u => u == (short)GTSRetCode.GRCRunOK);
            if (!resultOK)
            {
                throw new ProcessException("轴" + optionPara.AxisIndex + "设置参数异常,错误码:" + string.Join(",", resultCode));
                //throw new ProcessException("轴" + optionPara.AxisIndex + "设置参数异常,错误码:" + string.Join(",", resultCode));
                LogAsync(DateTime.Now, $"轴{optionPara.AxisIndex}设置参数异常,错误码:{string.Join(",", resultCode)}", "");
            }
            return resultOK;
            return true;
        }
        TaskFactory taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning);