领胜LDS 键盘AOI检测项目
wells.liu
2020-07-11 cda7be2cd01f809f64cfb0e812d38034a456546c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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
{
    public partial class CtrlMotionCardAxisStatus : UserControl
    {
        public CtrlMotionCardAxisStatus()
        {
            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(IDevice device,int axisIndex,string axisName)
        {
            InitializeComponent();
            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;//运动状态
            ioIndicatorCtrl10.IsOn = (axis_sts & 0x10) == 0;//运动出错
 
        }
    }
}