This commit is contained in:
GukSang.Jin
2026-06-09 13:51:37 +08:00
parent c76838c24c
commit 945ff7bc12
2 changed files with 19 additions and 2 deletions

View File

@@ -875,6 +875,7 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button Content="前进" <Button Content="前进"
Tag="SpeedTorqueForward" Tag="SpeedTorqueForward"
@@ -898,16 +899,20 @@
LostTouchCapture="ManualMotionButton_LostTouchCapture" LostTouchCapture="ManualMotionButton_LostTouchCapture"
Margin="8,0,8,0" /> Margin="8,0,8,0" />
<Button Grid.Column="2" <Button Grid.Column="2"
Content="通气阀"
Command="{Binding VentValveCommand}"
Margin="8,0,8,0" />
<Button Grid.Column="3"
Content="启动" Content="启动"
Command="{Binding StartSpeedTorqueCommand}" Command="{Binding StartSpeedTorqueCommand}"
Style="{StaticResource StartButtonStyle}" Style="{StaticResource StartButtonStyle}"
Margin="8,0,8,0" /> Margin="8,0,8,0" />
<Button Grid.Column="3" <Button Grid.Column="4"
Content="停止" Content="停止"
Command="{Binding StopSpeedTorqueCommand}" Command="{Binding StopSpeedTorqueCommand}"
Style="{StaticResource StopButtonStyle}" Style="{StaticResource StopButtonStyle}"
Margin="8,0,8,0" /> Margin="8,0,8,0" />
<Button Grid.Column="4" <Button Grid.Column="5"
Content="{Binding SpeedTorqueResetButtonText}" Content="{Binding SpeedTorqueResetButtonText}"
Command="{Binding ResetSpeedTorqueCommand}" Command="{Binding ResetSpeedTorqueCommand}"
Margin="8,0,0,0" /> Margin="8,0,0,0" />

View File

@@ -28,6 +28,7 @@ public sealed class MainWindowViewModel : ObservableObject
private const ushort SpeedTorqueForwardCoil = 1; private const ushort SpeedTorqueForwardCoil = 1;
private const ushort AxialBackwardCoil = 2; private const ushort AxialBackwardCoil = 2;
private const ushort AxialForwardCoil = 3; private const ushort AxialForwardCoil = 3;
private const ushort VentValveCoil = 6;
private const ushort AxialForceModeCoil = 30; private const ushort AxialForceModeCoil = 30;
private const ushort AxialStartCoil = 70; private const ushort AxialStartCoil = 70;
private const ushort AxialStopCoil = 73; private const ushort AxialStopCoil = 73;
@@ -253,6 +254,7 @@ public sealed class MainWindowViewModel : ObservableObject
SelectAxialJumpForceSetpointModeCommand = new AsyncRelayCommand(SelectAxialJumpForceSetpointModeAsync); SelectAxialJumpForceSetpointModeCommand = new AsyncRelayCommand(SelectAxialJumpForceSetpointModeAsync);
ForwardSpeedTorqueCommand = new AsyncRelayCommand(ForwardSpeedTorqueAsync); ForwardSpeedTorqueCommand = new AsyncRelayCommand(ForwardSpeedTorqueAsync);
BackwardSpeedTorqueCommand = new AsyncRelayCommand(BackwardSpeedTorqueAsync); BackwardSpeedTorqueCommand = new AsyncRelayCommand(BackwardSpeedTorqueAsync);
VentValveCommand = new AsyncRelayCommand(TriggerVentValveAsync);
StartSpeedTorqueCommand = new AsyncRelayCommand(StartSpeedTorqueAsync); StartSpeedTorqueCommand = new AsyncRelayCommand(StartSpeedTorqueAsync);
StopSpeedTorqueCommand = new AsyncRelayCommand(StopSpeedTorqueAsync); StopSpeedTorqueCommand = new AsyncRelayCommand(StopSpeedTorqueAsync);
ResetSpeedTorqueCommand = new AsyncRelayCommand(ResetSpeedTorqueAsync); ResetSpeedTorqueCommand = new AsyncRelayCommand(ResetSpeedTorqueAsync);
@@ -309,6 +311,8 @@ public sealed class MainWindowViewModel : ObservableObject
public IAsyncRelayCommand BackwardSpeedTorqueCommand { get; } public IAsyncRelayCommand BackwardSpeedTorqueCommand { get; }
public IAsyncRelayCommand VentValveCommand { get; }
public IAsyncRelayCommand StartSpeedTorqueCommand { get; } public IAsyncRelayCommand StartSpeedTorqueCommand { get; }
public IAsyncRelayCommand StopSpeedTorqueCommand { get; } public IAsyncRelayCommand StopSpeedTorqueCommand { get; }
@@ -2011,6 +2015,14 @@ public sealed class MainWindowViewModel : ObservableObject
await MoveSpeedTorqueDisplacementAsync("状态:后退"); await MoveSpeedTorqueDisplacementAsync("状态:后退");
} }
private async Task TriggerVentValveAsync()
{
if (await PulsePlcAsync(VentValveCoil, "通气阀"))
{
StatusText = $"通气阀已触发M{VentValveCoil}脉冲完成。";
}
}
private async Task SaveNoLoadSpeedSettingAsync() private async Task SaveNoLoadSpeedSettingAsync()
{ {
if (!TryReadNonNegative(NoLoadSpeedSettingInput, "空载转速设置", out double setting, out string error)) if (!TryReadNonNegative(NoLoadSpeedSettingInput, "空载转速设置", out double setting, out string error))