将Feature/XP.Common和Feature/XP.Hardware分支合并至Develop/XP.forHardwareAndCommon,完善XPapp注册和相关硬件类库通用类库功能。
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using XP.Hardware.MotionControl.Abstractions;
|
||||
using XP.Hardware.MotionControl.Config;
|
||||
using XP.Hardware.Plc.Abstractions;
|
||||
|
||||
namespace XP.Hardware.MotionControl.Implementations
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于 PLC 的轴复位实现 | PLC-based Axis Reset Implementation
|
||||
/// 写入复位信号,读取复位完成信号 | Writes reset signal, reads reset-done signal
|
||||
/// </summary>
|
||||
public class PlcAxisReset : IAxisReset
|
||||
{
|
||||
private readonly ISignalDataService _signalService;
|
||||
private bool _isResetDone;
|
||||
|
||||
public PlcAxisReset(ISignalDataService signalService)
|
||||
{
|
||||
_signalService = signalService ?? throw new ArgumentNullException(nameof(signalService));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsResetDone => _isResetDone;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public MotionResult Reset()
|
||||
{
|
||||
_signalService.EnqueueWrite(MotionSignalNames.Axis_Reset, true);
|
||||
return MotionResult.Ok();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void UpdateStatus()
|
||||
{
|
||||
_isResetDone = _signalService.GetValueByName<bool>(MotionSignalNames.Axis_ResetDone);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user