diff --git a/XP.Common/Controls/VirtualJoystick.cs b/XP.Common/Controls/VirtualJoystick.cs
index 3066547..64b6e3b 100644
--- a/XP.Common/Controls/VirtualJoystick.cs
+++ b/XP.Common/Controls/VirtualJoystick.cs
@@ -4,6 +4,7 @@ using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
+using XP.Common.Logging.Interfaces;
namespace XP.Common.Controls
{
@@ -31,13 +32,13 @@ namespace XP.Common.Controls
/// 操控点元素引用 | Thumb element reference
private Ellipse? _thumbElement;
- #endregion
+ #endregion
- #region 构造函数 | Constructor
+ #region 构造函数 | Constructor
- public VirtualJoystick()
+ public VirtualJoystick()
{
- InitializeComponent();
+ InitializeComponent();
// 控件加载完成后绑定操控点的 TranslateTransform | Bind thumb TranslateTransform after control loaded
Loaded += (s, e) =>
@@ -46,8 +47,8 @@ namespace XP.Common.Controls
if (_thumbElement != null)
_thumbElement.RenderTransform = _thumbTransform;
- // 初始化时更新背景和图标可见性 | Update background and icon visibility on init
- UpdateIconVisibility();
+ // 初始化时更新背景和图标可见性 | Update background and icon visibility on init
+ UpdateIconVisibility();
};
}
@@ -152,7 +153,10 @@ namespace XP.Common.Controls
private static void OnSwapMouseButtonsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is VirtualJoystick joystick)
+ {
+ joystick.ActiveMouseButton = MouseButtonType.None;
joystick.UpdateIconVisibility();
+ }
}
#endregion
@@ -363,19 +367,23 @@ namespace XP.Common.Controls
case MouseButtonType.Left:
SetVisibility(Visibility.Collapsed, defaultTop, defaultBottom, defaultLeft, defaultRight);
// 如果交换了左右键,这里显示的是右键图标组
- var leftIcons = SwapMouseButtons ? new[] { rightTop, rightBottom, rightLeft, rightRight } : new[] { leftTop, leftBottom, leftLeft, leftRight };
+ var leftIcons = new[] { leftTop, leftBottom, leftLeft, leftRight };
SetVisibility(Visibility.Visible, leftIcons);
- if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x3A, 0x7B, 0xC8));
+ if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x2D, 0x63, 0x9E)); // 深一点的浅蓝色 | Darker light blue
break;
case MouseButtonType.Right:
SetVisibility(Visibility.Collapsed, defaultTop, defaultBottom, defaultLeft, defaultRight);
// 如果交换了左右键,这里显示的是左键图标组
- var rightIcons = SwapMouseButtons ? new[] { leftTop, leftBottom, leftLeft, leftRight } : new[] { rightTop, rightBottom, rightLeft, rightRight };
+ var rightIcons = new[] { rightTop, rightBottom, rightLeft, rightRight };
SetVisibility(Visibility.Visible, rightIcons);
- if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x5B, 0xA8, 0x5B));
+ if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x45, 0x88, 0x45)); // 深一点的浅绿色 | Darker light green
break;
default:
- if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x4A, 0x90, 0xD9));
+ // 根据 SwapMouseButtons 决定中心按钮颜色 | Determine center button color based on SwapMouseButtons
+ if (_thumbElement != null)
+ _thumbElement.Fill = SwapMouseButtons
+ ? new SolidColorBrush(Color.FromRgb(0x5B, 0xA8, 0x5B)) // 浅绿色 | Light green
+ : new SolidColorBrush(Color.FromRgb(0x4A, 0x90, 0xD9)); // 浅蓝色 | Light blue
break;
}
diff --git a/XP.Hardware.MotionControl/Config/ConfigLoader.cs b/XP.Hardware.MotionControl/Config/ConfigLoader.cs
index 40d81f8..9f08bf1 100644
--- a/XP.Hardware.MotionControl/Config/ConfigLoader.cs
+++ b/XP.Hardware.MotionControl/Config/ConfigLoader.cs
@@ -66,6 +66,11 @@ namespace XP.Hardware.MotionControl.Config
// 运行参数 | Runtime parameters
config.PollingInterval = Int(get($"{P}:PollingInterval", "100"));
config.DefaultVelocity = Int(get($"{P}:DefaultVelocity", "100"));
+
+ // 射线源与探测器Z轴联动配置 | Source-Detector Z-axis linkage configuration
+ config.SourceDetectorZLinkage.Enabled = bool.TryParse(get($"{P}:SourceDetectorZLinkage:Enabled", "false"), out var enabled) && enabled;
+ config.SourceDetectorZLinkage.TriggerThreshold = Dbl(get($"{P}:SourceDetectorZLinkage:TriggerThreshold", "1.0"));
+ config.SourceDetectorZLinkage.SpeedPercent = Int(get($"{P}:SourceDetectorZLinkage:SpeedPercent", "100"));
}
private static LinearAxisConfig LoadLinear(string name, Func get)
diff --git a/XP.Hardware.MotionControl/Config/MotionControlConfig.cs b/XP.Hardware.MotionControl/Config/MotionControlConfig.cs
index f2a2473..9692d67 100644
--- a/XP.Hardware.MotionControl/Config/MotionControlConfig.cs
+++ b/XP.Hardware.MotionControl/Config/MotionControlConfig.cs
@@ -23,6 +23,24 @@ namespace XP.Hardware.MotionControl.Config
/// 默认速度| Default velocity
public int DefaultVelocity { get; set; } = 100;
+
+ /// 射线源与探测器Z轴联动配置 | Source-Detector Z-axis linkage configuration
+ public SourceDetectorZLinkageConfig SourceDetectorZLinkage { get; set; } = new();
+ }
+
+ ///
+ /// 射线源与探测器Z轴联动配置 | Source-Detector Z-axis linkage configuration
+ ///
+ public class SourceDetectorZLinkageConfig
+ {
+ /// 联动启用 | Linkage enabled
+ public bool Enabled { get; set; } = false;
+
+ /// 联动触发的位置变化阈值(mm)| Position change threshold for linkage trigger (mm)
+ public double TriggerThreshold { get; set; } = 1.0;
+
+ /// 联动移动速度百分比(0-100)| Linkage movement speed percentage (0-100)
+ public int SpeedPercent { get; set; } = 100;
}
///
diff --git a/XP.Hardware.MotionControl/Config/MotionSignalNames.cs b/XP.Hardware.MotionControl/Config/MotionSignalNames.cs
index 638e9d8..153e17c 100644
--- a/XP.Hardware.MotionControl/Config/MotionSignalNames.cs
+++ b/XP.Hardware.MotionControl/Config/MotionSignalNames.cs
@@ -6,6 +6,14 @@ namespace XP.Hardware.MotionControl.Config
///
public static class MotionSignalNames
{
+ // ==================== 射线源与探测器Z轴联动 | Source-Detector Z-axis Linkage ====================
+ /// 射线源与探测器Z轴联动使能(写入)| Source-Detector Z-axis linkage enable (write)
+ public const string SourceDetZ_Linkage_Enable = "MC_SourceDetZ_Linkage_Enable";
+ /// 虚拟摇杆使能(写入)| Virtual joystick enable (write)
+ public const string VirtualJoystick_Enable = "MC_VirtualJoystick_Enable";
+ /// 实体摇杆输入激活(读取)| Physical joystick input active (read)
+ public const string Joystick_Active = "MC_Joystick_Active";
+
// ==================== 直线轴 SourceZ | Linear Axis SourceZ ====================
public const string SourceZ_Pos = "MC_SourceZ_Pos";
public const string SourceZ_Target = "MC_SourceZ_Target";
diff --git a/XP.Hardware.MotionControl/Resources/Resources.en-US.resx b/XP.Hardware.MotionControl/Resources/Resources.en-US.resx
index 90aaa7d..5208de7 100644
--- a/XP.Hardware.MotionControl/Resources/Resources.en-US.resx
+++ b/XP.Hardware.MotionControl/Resources/Resources.en-US.resx
@@ -262,25 +262,25 @@ Confirm to filll move matrix?
Axis Positions
- X mm
+ X
- Y mm
+ Y
- SZ mm
+ SZ
- DZ mm
+ DZ
- DT' °
+ DT
- R' °
+ R
- FR' °
+ FR
Safety Parameters
@@ -303,4 +303,16 @@ Confirm to filll move matrix?
Motion Control
+
+ mm
+
+
+ °
+
+
+ Switch the way the virtual joystick is controlled when using the mouse left and right buttons
+
+
+ Error
+
\ No newline at end of file
diff --git a/XP.Hardware.MotionControl/Resources/Resources.resx b/XP.Hardware.MotionControl/Resources/Resources.resx
index 42aa50b..aab981e 100644
--- a/XP.Hardware.MotionControl/Resources/Resources.resx
+++ b/XP.Hardware.MotionControl/Resources/Resources.resx
@@ -361,4 +361,20 @@ DetectorZ → {4:F2}mm
运动控制
header
+
+ mm
+ 长度单位
+
+
+ °
+ 角度单位
+
+
+ 切换虚拟摇杆鼠标左右键控制方式
+ 切换虚拟摇杆鼠标左右键控制方式
+
+
+ 错误
+ 错误
+
\ No newline at end of file
diff --git a/XP.Hardware.MotionControl/Resources/Resources.zh-CN.resx b/XP.Hardware.MotionControl/Resources/Resources.zh-CN.resx
index 067d0d6..5bdc199 100644
--- a/XP.Hardware.MotionControl/Resources/Resources.zh-CN.resx
+++ b/XP.Hardware.MotionControl/Resources/Resources.zh-CN.resx
@@ -262,25 +262,25 @@ DetectorZ → {4:F2}mm
轴位置
- X mm
+ X
- Y mm
+ Y
- SZ mm
+ SZ
- DZ mm
+ DZ
- DT' °
+ DT
- R' °
+ R
- FR' °
+ FR
安全参数
@@ -303,4 +303,16 @@ DetectorZ → {4:F2}mm
运动控制
+
+ mm
+
+
+ °
+
+
+ 切换虚拟摇杆鼠标左右键控制方式
+
+
+ 错误
+
\ No newline at end of file
diff --git a/XP.Hardware.MotionControl/Resources/Resources.zh-TW.resx b/XP.Hardware.MotionControl/Resources/Resources.zh-TW.resx
index 390cd2a..c8b9b06 100644
--- a/XP.Hardware.MotionControl/Resources/Resources.zh-TW.resx
+++ b/XP.Hardware.MotionControl/Resources/Resources.zh-TW.resx
@@ -262,25 +262,25 @@ DetectorZ → {4:F2}mm
軸位置
- X mm
+ X
- Y mm
+ Y
- SZ mm
+ SZ
- DZ mm
+ DZ
- DT' °
+ DT
- R' °
+ R
- FR' °
+ FR
安全參數
@@ -303,4 +303,16 @@ DetectorZ → {4:F2}mm
運動控制
+
+ mm
+
+
+ °
+
+
+ 切換虛擬搖杆喺使用滑鼠左右鍵控制時嘅方式
+
+
+ 錯誤
+
\ No newline at end of file
diff --git a/XP.Hardware.MotionControl/Resources/SZDZLockDisable.png b/XP.Hardware.MotionControl/Resources/SZDZLockDisable.png
new file mode 100644
index 0000000..7644999
Binary files /dev/null and b/XP.Hardware.MotionControl/Resources/SZDZLockDisable.png differ
diff --git a/XP.Hardware.MotionControl/Resources/SZDZLockEnable.png b/XP.Hardware.MotionControl/Resources/SZDZLockEnable.png
new file mode 100644
index 0000000..ad1ea9b
Binary files /dev/null and b/XP.Hardware.MotionControl/Resources/SZDZLockEnable.png differ
diff --git a/XP.Hardware.MotionControl/Services/IMotionControlService.cs b/XP.Hardware.MotionControl/Services/IMotionControlService.cs
index 30dcc76..a6d9cf1 100644
--- a/XP.Hardware.MotionControl/Services/IMotionControlService.cs
+++ b/XP.Hardware.MotionControl/Services/IMotionControlService.cs
@@ -186,5 +186,23 @@ namespace XP.Hardware.MotionControl.Services
MotionResult ApplyGeometryByMagnification(double targetFOD, double magnification);
#endregion
+
+ #region 射线源与探测器Z轴联动 | Source-Detector Z-axis Linkage
+
+ ///
+ /// 启用/禁用射线源与探测器Z轴联动 | Enable/disable Source-Detector Z-axis linkage
+ ///
+ /// true=启用联动,false=禁用联动 | true=enable linkage, false=disable linkage
+ /// 操作结果 | Operation result
+ MotionResult SetSourceDetectorZLinkage(bool enabled);
+
+ ///
+ /// 设置虚拟摇杆使能 | Set virtual joystick enable
+ ///
+ /// true=启用虚拟摇杆,false=禁用虚拟摇杆 | true=enable virtual joystick, false=disable virtual joystick
+ /// 操作结果 | Operation result
+ MotionResult SetVirtualJoystickEnable(bool enabled);
+
+ #endregion
}
}
diff --git a/XP.Hardware.MotionControl/Services/MotionControlService.cs b/XP.Hardware.MotionControl/Services/MotionControlService.cs
index 870af8b..de58499 100644
--- a/XP.Hardware.MotionControl/Services/MotionControlService.cs
+++ b/XP.Hardware.MotionControl/Services/MotionControlService.cs
@@ -1,9 +1,10 @@
-using System;
+using Emgu.CV.Dnn;
+using Prism.Events;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows;
-using Prism.Events;
using XP.Common.Localization;
using XP.Common.Logging.Interfaces;
using XP.Hardware.MotionControl.Abstractions;
@@ -27,9 +28,10 @@ namespace XP.Hardware.MotionControl.Services
private readonly IEventAggregator _eventAggregator;
private readonly ILoggerService _logger;
private readonly IPlcService _plcService;
+ private readonly ISignalDataService _signalService;
- // 轮询定时器 | Polling timer
- private Timer _pollingTimer;
+ // 轮询定时器 | Polling timer
+ private Timer _pollingTimer;
private int _pollErrorCount = 0;
///
@@ -58,7 +60,8 @@ namespace XP.Hardware.MotionControl.Services
MotionControlConfig config,
IEventAggregator eventAggregator,
ILoggerService logger,
- IPlcService plcService)
+ IPlcService plcService,
+ ISignalDataService signalService)
{
_motionSystem = motionSystem ?? throw new ArgumentNullException(nameof(motionSystem));
_geometryCalculator = geometryCalculator ?? throw new ArgumentNullException(nameof(geometryCalculator));
@@ -68,7 +71,8 @@ namespace XP.Hardware.MotionControl.Services
_logger = (logger ?? throw new ArgumentNullException(nameof(logger)))
.ForModule();
_plcService = plcService ?? throw new ArgumentNullException(nameof(plcService));
- }
+ _signalService = signalService ?? throw new ArgumentNullException(nameof(signalService));
+ }
#region 轮询控制 | Polling Control
@@ -544,6 +548,76 @@ namespace XP.Hardware.MotionControl.Services
#endregion
+ #region 射线源与探测器Z轴联动 | Source-Detector Z-axis Linkage
+
+ ///
+ /// 启用/禁用射线源与探测器Z轴联动 | Enable/disable Source-Detector Z-axis linkage
+ ///
+ /// true=启用联动,false=禁用联动 | true=enable linkage, false=disable linkage
+ /// 操作结果 | Operation result
+ public MotionResult SetSourceDetectorZLinkage(bool enabled)
+ {
+ try
+ {
+ var config = _config.SourceDetectorZLinkage;
+ if (!config.Enabled)
+ {
+ _logger.Warn("射线源与探测器Z轴联动未在配置中启用 | Source-Detector Z-axis linkage not enabled in config");
+ return MotionResult.Fail("射线源与探测器Z轴联动未启用 | Source-Detector Z-axis linkage not enabled");
+ }
+
+ // 写入联动使能信号 | Write linkage enable signal
+ var result = _signalService.EnqueueWrite(MotionSignalNames.SourceDetZ_Linkage_Enable, (bool)enabled);
+
+ if (result)
+ {
+ _logger.Info("射线源与探测器Z轴联动已{Enabled} | Source-Detector Z-axis linkage {Enabled}",
+ enabled ? "启用 | enabled" : "禁用 | disabled");
+ }
+ else
+ {
+ _logger.Warn("射线源与探测器Z轴联动使能写入失败 | Source-Detector Z-axis linkage enable write failed");
+ }
+
+ return result ? MotionResult.Ok() : MotionResult.Fail("联动使能写入失败 | Linkage enable write failed");
+ }
+ catch (Exception ex)
+ {
+ _logger.Error(ex, "射线源与探测器Z轴联动设置异常: {Message} | Source-Detector Z-axis linkage setting error: {Message}", ex.Message);
+ return MotionResult.Fail($"联动设置异常: {ex.Message}");
+ }
+ }
+
+ ///
+ /// 设置虚拟摇杆使能 | Set virtual joystick enable
+ ///
+ /// true=启用虚拟摇杆,false=禁用虚拟摇杆 | true=enable virtual joystick, false=disable virtual joystick
+ /// 操作结果 | Operation result
+ public MotionResult SetVirtualJoystickEnable(bool enabled)
+ {
+ try
+ {
+ var result = _signalService.EnqueueWrite(MotionSignalNames.VirtualJoystick_Enable, (bool)enabled);
+ if (result)
+ {
+ _logger.Info("虚拟摇杆已{Enabled} | Virtual joystick {Enabled}",
+ enabled ? "启用 | enabled" : "禁用 | disabled");
+ }
+ else
+ {
+ _logger.Warn("虚拟摇杆使能写入失败 | Virtual joystick enable write failed");
+ }
+
+ return result ? MotionResult.Ok() : MotionResult.Fail("虚拟摇杆使能写入失败 | Virtual joystick enable write failed");
+ }
+ catch (Exception ex)
+ {
+ _logger.Error(ex, "虚拟摇杆使能设置异常: {Message} | Virtual joystick enable setting error: {Message}", ex.Message);
+ return MotionResult.Fail($"虚拟摇杆使能设置异常: {ex.Message}");
+ }
+ }
+ #endregion
+
#region 安全门控制 | Safety Door Control
///
diff --git a/XP.Hardware.MotionControl/ViewModels/AxisControlViewModel.cs b/XP.Hardware.MotionControl/ViewModels/AxisControlViewModel.cs
index 4c7ce5e..bd3272b 100644
--- a/XP.Hardware.MotionControl/ViewModels/AxisControlViewModel.cs
+++ b/XP.Hardware.MotionControl/ViewModels/AxisControlViewModel.cs
@@ -85,9 +85,11 @@ namespace XP.Hardware.MotionControl.ViewModels
ToggleSwapMouseButtonsCommand = new DelegateCommand(ExecuteToggleSwapMouseButtons);
SavePositionsCommand = new DelegateCommand(ExecuteSavePositions);
RestorePositionsCommand = new DelegateCommand(ExecuteRestorePositions, () => _savedPositions != null && IsPlcConnected);
+ // 射线源与探测器Z轴联动命令 | Source-Detector Z-axis linkage command
+ SZDZLockCommand = new DelegateCommand(() => SafeRun(ExecuteSZDZLock), () => IsPlcConnected);
- // 初始化 Jog 状态跟踪字典 | Initialize jog state tracking dictionaries
- foreach (AxisId axisId in Enum.GetValues(typeof(AxisId)))
+ // 初始化 Jog 状态跟踪字典 | Initialize jog state tracking dictionaries
+ foreach (AxisId axisId in Enum.GetValues(typeof(AxisId)))
_linearJogActive[axisId] = false;
foreach (RotaryAxisId axisId in Enum.GetValues(typeof(RotaryAxisId)))
_rotaryJogActive[axisId] = false;
@@ -267,12 +269,16 @@ namespace XP.Hardware.MotionControl.ViewModels
/// 错误提示信息 | Error message
public string ErrorMessage { get => _errorMessage; set => SetProperty(ref _errorMessage, value); }
- #endregion
+ // 射线源与探测器Z轴联动状态 | Source-Detector Z-axis linkage state
+ private bool _szdzLock;
+ public bool SZDZLock { get => _szdzLock; set => SetProperty(ref _szdzLock, value); }
- #region 保存位置状态 | Saved Positions State
+ #endregion
- /// 是否有保存的位置数据 | Whether saved position data exists
- public bool HasSavedPositions => _savedPositions != null;
+ #region 保存位置状态 | Saved Positions State
+
+ /// 是否有保存的位置数据 | Whether saved position data exists
+ public bool HasSavedPositions => _savedPositions != null;
#endregion
@@ -290,14 +296,16 @@ namespace XP.Hardware.MotionControl.ViewModels
/// 恢复保存的轴位置命令 | Restore saved axis positions command
public DelegateCommand RestorePositionsCommand { get; }
- #endregion
+ /// 射线源与探测器Z轴锁定移动命令 | Source-Detector Z-axis lock move command
+ public DelegateCommand SZDZLockCommand { get; }
+ #endregion
- #region 事件回调 | Event Callbacks
+ #region 事件回调 | Event Callbacks
- ///
- /// 几何参数更新回调,刷新轴实际位置 | Geometry updated callback, refresh axis actual positions
- ///
- private void OnGeometryUpdated(GeometryData data)
+ ///
+ /// 几何参数更新回调,刷新轴实际位置 | Geometry updated callback, refresh axis actual positions
+ ///
+ private void OnGeometryUpdated(GeometryData data)
{
try
{
@@ -453,8 +461,24 @@ namespace XP.Hardware.MotionControl.ViewModels
{
IsJoystickEnabled = !IsJoystickEnabled;
_logger.Info("摇杆使能状态切换:{Enabled} | Joystick enable toggled: {Enabled}", IsJoystickEnabled);
- // TODO: 发送使能状态到 PLC(根据实际 PLC 信号定义)| Send enable state to PLC (based on actual PLC signal definition)
- }
+ // 发送使能状态到 PLC(根据实际 PLC 信号定义)| Send enable state to PLC (based on actual PLC signal definition)
+ try
+ {
+ // 设置虚拟摇杆使能 | Set virtual joystick enable
+ var result = _motionControlService.SetVirtualJoystickEnable(IsJoystickEnabled);
+
+ if (!result.Success)
+ {
+ MessageBox.Show(result.ErrorMessage, XP.Common.Localization.LocalizationHelper.Get("MC_Error"),
+ MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, XP.Common.Localization.LocalizationHelper.Get("MC_Error"),
+ MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ }
///
/// 切换左右键交换状态 | Toggle swap mouse buttons state
@@ -515,15 +539,42 @@ namespace XP.Hardware.MotionControl.ViewModels
_logger.Info("轴位置已恢复并发送移动命令 | Axis positions restored and move commands sent");
}
- #endregion
+ /// 射线源与探测器Z轴锁定移动 | Source-Detector Z-axis lock move
+ private void ExecuteSZDZLock()
+ {
+ try
+ {
+ // 切换联动状态 | Toggle linkage state
+ SZDZLock = !SZDZLock;
- #region 摇杆 Jog 映射逻辑 | Joystick Jog Mapping Logic
+ // 调用服务设置联动 | Call service to set linkage
+ var result = _motionControlService.SetSourceDetectorZLinkage(SZDZLock);
- ///
- /// 处理双轴摇杆输出变化,根据当前激活按键映射到对应轴的 Jog 操作
- /// Handle dual joystick output changes, map to corresponding axis jog based on active button
- ///
- private void HandleDualJoystickOutput()
+ if (!result.Success)
+ {
+ // 如果设置失败,恢复状态 | If set failed, restore state
+ SZDZLock = !SZDZLock;
+ MessageBox.Show(result.ErrorMessage, XP.Common.Localization.LocalizationHelper.Get("MC_Error"),
+ MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+ }
+ catch (Exception ex)
+ {
+ // 异常时恢复状态 | Restore state on exception
+ SZDZLock = !SZDZLock;
+ MessageBox.Show(ex.Message, XP.Common.Localization.LocalizationHelper.Get("MC_Error"),
+ MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ }
+ #endregion
+
+ #region 摇杆 Jog 映射逻辑 | Joystick Jog Mapping Logic
+
+ ///
+ /// 处理双轴摇杆输出变化,根据当前激活按键映射到对应轴的 Jog 操作
+ /// Handle dual joystick output changes, map to corresponding axis jog based on active button
+ ///
+ private void HandleDualJoystickOutput()
{
switch (DualJoystickActiveButton)
{
@@ -555,12 +606,20 @@ namespace XP.Hardware.MotionControl.ViewModels
case MouseButtonType.Left:
// 左键:Y→SourceZ Jog | Left button: Y→SourceZ Jog
UpdateLinearJog(AxisId.SourceZ, SingleJoystickOutputY);
+ if (_szdzLock)
+ {
+ UpdateLinearJog(AxisId.DetectorZ, SingleJoystickOutputY);
+ }
break;
case MouseButtonType.Right:
// 右键:Y→DetectorZ Jog | Right button: Y→DetectorZ Jog
- UpdateLinearJog(AxisId.DetectorZ, SingleJoystickOutputY);
- break;
+ UpdateLinearJog(AxisId.DetectorZ, SingleJoystickOutputY);
+ if (_szdzLock)
+ {
+ UpdateLinearJog(AxisId.SourceZ, SingleJoystickOutputY);
+ }
+ break;
}
}
diff --git a/XP.Hardware.MotionControl/Views/AxisControlView.xaml b/XP.Hardware.MotionControl/Views/AxisControlView.xaml
index 325e094..eeefc55 100644
--- a/XP.Hardware.MotionControl/Views/AxisControlView.xaml
+++ b/XP.Hardware.MotionControl/Views/AxisControlView.xaml
@@ -47,6 +47,7 @@
+
@@ -60,26 +61,31 @@
-
-
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
@@ -120,10 +126,12 @@
+
+
-
@@ -148,7 +156,7 @@
-
@@ -156,14 +164,39 @@
+
+
+
+
+
+
+