领胜LDS 键盘AOI检测项目
wells.liu
2020-07-11 cda7be2cd01f809f64cfb0e812d38034a456546c
io优化
4个文件已修改
53 ■■■■■ 已修改文件
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs
@@ -1,5 +1,8 @@
using Bro.Common.Model;
using Bro.Common.Base;
using Bro.Common.Interface;
using Bro.Common.Model;
using System;
using System.Linq;
using System.Windows.Forms;
namespace Bro.UI.Device.Winform
@@ -11,27 +14,40 @@
            InitializeComponent();
        }
        public IDevice Device { get; set; }
        protected MotionCardBase MotionCard
        {
            get => Device as MotionCardBase;
        }
        private int _axisIndex { get; set; }
        private string _axisName { get; set; }
        public AxisMovingStatus _axisMovingStatus = new AxisMovingStatus();
        public CtrlMotionCardAxisStatus(AxisMovingStatus axisMovingStatus)
        public CtrlMotionCardAxisStatus(IDevice device,int axisIndex,string axisName)
        {
            InitializeComponent();
            _axisMovingStatus = axisMovingStatus;
            groupBoxAxisStatus.Text = $"运动轴:{_axisMovingStatus.AxisIndex}-{_axisMovingStatus.AxisName}";
            Device = device;
            _axisIndex = axisIndex;
            _axisName = axisName;
            groupBoxAxisStatus.Text = $"运动轴:{axisIndex}-{axisName}";
        }
        private void RefreshStatus(object sender, EventArgs e)
        {
            _axisMovingStatus = MotionCard.AxisStatusList.FirstOrDefault(u => u.AxisIndex == _axisIndex);
            textBoxPrfPositon.Text = _axisMovingStatus.Destination.ToString();
            textBoxCurPosition.Text = _axisMovingStatus.CurPosition.ToString();
            textBoxPrfVel.Text = _axisMovingStatus.PrfVelocity.ToString();
            textBoxCurVel.Text = _axisMovingStatus.CurVelocity.ToString();
            int axis_sts = _axisMovingStatus.AxisStatus;
            ioIndicatorCtrl1.IsOn = (axis_sts & 0x2) == 0;//驱动报警
            ioIndicatorCtrl2.IsOn = (axis_sts & 0x200) == 0;//伺服使能
            ioIndicatorCtrl6.IsOn = (axis_sts & 0x20) == 0;//正限位
            ioIndicatorCtrl8.IsOn = (axis_sts & 0x40) == 0;//负限位
            ioIndicatorCtrl9.IsOn =(axis_sts & 0x400) == 0;//运动状态
            ioIndicatorCtrl9.IsOn = (axis_sts & 0x400) == 0;//运动状态
            ioIndicatorCtrl10.IsOn = (axis_sts & 0x10) == 0;//运动出错
        }
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs
@@ -31,11 +31,10 @@
            get => Device as MotionCardBase;
        }
        public CtrlMotionCardIOStatus(IDevice device, List<IOItem> monitorValues)
        public CtrlMotionCardIOStatus(IDevice device)
        {
            InitializeComponent();
            Device = device;
            _monitorValues = monitorValues;
            InitIOEvent();
        }
@@ -51,14 +50,15 @@
            }
        }
        private void IoOut_DoubleClick(string desc, bool isOn)
        private void IoOut_DoubleClick(string name, bool isOn)
        {
            var index = Convert.ToInt16(desc.Substring(3));
            var index = Convert.ToInt16(name.Substring(6));
            MotionCard.WriteOutput(index, isOn ? IOValue.TRUE : IOValue.FALSE);
        }
        private void RefreshIOStatus(object sender, EventArgs e)
        {
            _monitorValues = MotionCard.MonitorValues;
            foreach (var ioItem in _monitorValues)
            {
                if (ioItem.IOType == Common.Helper.EnumHelper.IOType.INPUT)
@@ -67,7 +67,7 @@
                    if (ioInArray != null && ioInArray.Length == 1)
                    {
                        var ioIn = ioInArray[0] as IOIndicatorCtrl;
                        ioIn.IsOn = ioItem.Value == IOValue.TRUE;
                        ioIn.IsOn = ioItem.Value == IOValue.FALSE;
                    }
                }
                else
@@ -76,7 +76,7 @@
                    if (ioOutArray != null && ioOutArray.Length == 1)
                    {
                        var ioOut = ioOutArray[0] as IOIndicatorCtrl;
                        ioOut.IsOn = ioItem.Value == IOValue.TRUE;
                        ioOut.IsOn = ioItem.Value == IOValue.FALSE;
                    }
                }
            }
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs
@@ -44,16 +44,11 @@
        {
            foreach (var axisConfig in MotionCard.IConfig.AxisSettings.FindAll(u => u.IsAxisEnabled))
            {
                var axisMovingStatus = MotionCard.AxisStatusList.FirstOrDefault(u => u.AxisIndex == axisConfig.AxisIndex);
                if (axisMovingStatus == null)
                {
                    axisMovingStatus = new AxisMovingStatus();
                }
                CtrlMotionCardAxisStatus ctrlMotionCardAxisStatus = new CtrlMotionCardAxisStatus(axisMovingStatus);
                CtrlMotionCardAxisStatus ctrlMotionCardAxisStatus = new CtrlMotionCardAxisStatus(Device,axisConfig.AxisIndex, axisConfig.AxisName);
                flowLayoutPanel1.Controls.Add(ctrlMotionCardAxisStatus);
            }
            CtrlMotionCardIOStatus ctrlMotionCardIOStatus = new CtrlMotionCardIOStatus(Device, MotionCard.MonitorValues);
            CtrlMotionCardIOStatus ctrlMotionCardIOStatus = new CtrlMotionCardIOStatus(Device);
            flowLayoutPanel2.Controls.Add(ctrlMotionCardIOStatus);
        }
src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs
@@ -108,7 +108,7 @@
        {
            if (IsOn != null)
            {
                OnIODoubleClick?.Invoke(Desc,IsOn.Value);
                OnIODoubleClick?.Invoke(Name,IsOn.Value);
            }
        }
@@ -116,7 +116,7 @@
        {
            if (IsOn != null)
            {
                OnIODoubleClick?.Invoke(Desc, IsOn.Value);
                OnIODoubleClick?.Invoke(Name, IsOn.Value);
            }
        }
    }