From be33a18112638699efe66912889f56302f9bcff8 Mon Sep 17 00:00:00 2001 From: wells.liu <wells.liu@broconcentric.com> Date: 星期六, 11 七月 2020 17:09:04 +0800 Subject: [PATCH] 板卡 操作 --- src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs | 52 +++++++++++++++++++++++++++++++++++----------------- 1 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs index d7df378..77966fd 100644 --- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs +++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs @@ -1,5 +1,8 @@ -锘縰sing Bro.Common.Model; +锘縰sing 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,29 +14,44 @@ InitializeComponent(); } - public AxisMovingStatus _axisMovingStatus = new AxisMovingStatus(); - public CtrlMotionCardAxisStatus(AxisMovingStatus axisMovingStatus) + 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; + 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) { - 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;//姝i檺浣� - ioIndicatorCtrl8.IsOn = (axis_sts & 0x40) == 0;//璐熼檺浣� - ioIndicatorCtrl9.IsOn =(axis_sts & 0x400) == 0;//杩愬姩鐘舵�� - ioIndicatorCtrl10.IsOn = (axis_sts & 0x10) == 0;//杩愬姩鍑洪敊 + _axisMovingStatus = MotionCard.AxisStatusList.FirstOrDefault(u => u.AxisIndex == _axisIndex); + if (_axisMovingStatus != null) + { + textBoxPrfPositon.Text = _axisMovingStatus.Destination.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) == 1;//浼烘湇浣胯兘 1涓哄紑鍚� + ioIndicatorCtrl6.IsOn = (axis_sts & 0x20) == 0;//姝i檺浣� + ioIndicatorCtrl8.IsOn = (axis_sts & 0x40) == 0;//璐熼檺浣� + ioIndicatorCtrl9.IsOn = (axis_sts & 0x400) == 0;//杩愬姩鐘舵�� + ioIndicatorCtrl10.IsOn = (axis_sts & 0x10) == 0;//杩愬姩鍑洪敊 + + } } } } -- Gitblit v1.8.0