虚拟模式下 跳过联锁(Interlock)检查,因为虚拟模式没有真实安全门信

This commit is contained in:
zhengxuan.zhang
2026-05-21 17:15:27 +08:00
parent 43d0e7fa89
commit de4a7121db
5 changed files with 27 additions and 12 deletions
@@ -11,6 +11,7 @@ using XP.Hardware.MotionControl.Abstractions;
using XP.Hardware.MotionControl.Abstractions.Enums;
using XP.Hardware.MotionControl.Abstractions.Events;
using XP.Hardware.MotionControl.Config;
using XP.Hardware.MotionControl.Implementations;
using XP.Hardware.Plc.Abstractions;
namespace XP.Hardware.MotionControl.Services
@@ -105,8 +106,11 @@ namespace XP.Hardware.MotionControl.Services
/// </summary>
private void OnPollingTick(object state)
{
// PLC 连接时跳过轮询 | Skip polling when PLC is not connected
if (!_plcService.IsConnected) return;
// 虚拟运动系统不依赖 PLC 连接 | Simulated motion system does not depend on PLC connection
bool isSimulated = _motionSystem is SimulatedMotionSystem;
// PLC 未连接时跳过轮询(虚拟模式除外)| Skip polling when PLC is not connected (except simulated mode)
if (!isSimulated && !_plcService.IsConnected) return;
// 连续错误过多时降频:每50次轮询才尝试一次 | Throttle when too many consecutive errors
if (_pollErrorCount > 3)