From b5e7fa2db4ac36fdb7bf9fd330d12a72ade9d483 Mon Sep 17 00:00:00 2001 From: patrick.xu <patrick.xu@broconcentric.com> Date: 星期日, 24 一月 2021 15:07:26 +0800 Subject: [PATCH] 0124 --- src/Bro.Device.GTSCard/GTSCardDriver.cs | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs index 303ddb4..25ec672 100644 --- a/src/Bro.Device.GTSCard/GTSCardDriver.cs +++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs @@ -400,24 +400,28 @@ /// <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)); - resultCode.Add(GTSCardAPI.GT_GetTrapPrm((short)IConfig.CardNum, axisIndex, out trapprm)); - trapprm.smoothTime = 1; - if (optionPara.VelocityPara.Acc != 0) + if (optionPara.VelocityPara.Acc != 0 || optionPara.VelocityPara.Dec != 0) { - trapprm.acc = optionPara.VelocityPara.Acc; - } + resultCode.Add(GTSCardAPI.GT_GetTrapPrm((short)IConfig.CardNum, axisIndex, out trapprm)); + trapprm.smoothTime = 1; - if (optionPara.VelocityPara.Dec != 0) - { - trapprm.dec = optionPara.VelocityPara.Dec; - } + if (optionPara.VelocityPara.Acc != 0) + { + trapprm.acc = optionPara.VelocityPara.Acc; + } - resultCode.Add(GTSCardAPI.GT_SetTrapPrm((short)IConfig.CardNum, axisIndex, ref trapprm)); + if (optionPara.VelocityPara.Dec != 0) + { + trapprm.dec = optionPara.VelocityPara.Dec; + } + + 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); -- Gitblit v1.8.0