页面逻辑添加
This commit is contained in:
@@ -78,7 +78,7 @@ namespace TabletTester2025.ViewModels
|
||||
[ObservableProperty] private bool _friabilityCounterClockwise;
|
||||
[ObservableProperty] private double _friabilityCurrentRpm;
|
||||
[ObservableProperty] private int _friabilityRemainingRounds = 100;
|
||||
|
||||
public IAsyncRelayCommand StopHardnessCommand { get; }
|
||||
public IAsyncRelayCommand StopFriabilityCommand { get; }
|
||||
public IAsyncRelayCommand ResetFriabilityCommand { get; }
|
||||
public IAsyncRelayCommand PrintFriabilityCommand { get; }
|
||||
@@ -153,8 +153,13 @@ namespace TabletTester2025.ViewModels
|
||||
await _plc.WriteCoilAsync(0x21, false);
|
||||
});
|
||||
|
||||
HardnessResetCommand = new AsyncRelayCommand(() =>
|
||||
//复位
|
||||
HardnessResetCommand = new AsyncRelayCommand(async () =>
|
||||
{
|
||||
// 1. 标准PLC按钮脉冲逻辑:置1 → 延时 → 置0(模拟按下再松开按钮)
|
||||
await _plc.WriteCoilAsync(_plcConfig.HardnessStartReset, true);
|
||||
await Task.Delay(100); // 脉冲宽度,可根据PLC程序调整20~100ms
|
||||
await _plc.WriteCoilAsync(_plcConfig.HardnessStartReset, false);
|
||||
_hardnessResults.Clear();
|
||||
HardnessValue = 0;
|
||||
HardnessAvg = 0;
|
||||
@@ -163,14 +168,25 @@ namespace TabletTester2025.ViewModels
|
||||
HardnessMax = 0;
|
||||
HardnessMin = 0;
|
||||
Phase = TestPhase.Idle;
|
||||
return Task.CompletedTask;
|
||||
|
||||
});
|
||||
|
||||
PrintHardnessCommand = new AsyncRelayCommand(async () => await PrintReport("硬度"));
|
||||
|
||||
// 硬度命令停止
|
||||
StopHardnessCommand = new AsyncRelayCommand(async() => {
|
||||
|
||||
await _plc.WriteCoilAsync(_plcConfig.HardnessStartStop, true);
|
||||
await Task.Delay(100); // 脉冲宽度,可根据PLC程序调整20~100ms
|
||||
await _plc.WriteCoilAsync(_plcConfig.HardnessStartStop, false);
|
||||
|
||||
Phase = TestPhase.Idle;
|
||||
});
|
||||
// 脆碎度命令
|
||||
StopFriabilityCommand = new AsyncRelayCommand(() => {
|
||||
|
||||
//测试停止
|
||||
|
||||
Phase = TestPhase.Idle; return Task.CompletedTask;
|
||||
});
|
||||
ResetFriabilityCommand = new AsyncRelayCommand(() =>
|
||||
|
||||
Reference in New Issue
Block a user