From 5b4f414beaedd1bb426fbdcf2b9e182d8a1d8e0a Mon Sep 17 00:00:00 2001 From: "GukSang.Jin" Date: Mon, 15 Jun 2026 18:55:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B01222?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DentistryHandpieces/MainWindowViewModel.cs | 96 ---------------------- 1 file changed, 96 deletions(-) diff --git a/DentistryHandpieces/MainWindowViewModel.cs b/DentistryHandpieces/MainWindowViewModel.cs index 3b73a24..b2cdfe0 100644 --- a/DentistryHandpieces/MainWindowViewModel.cs +++ b/DentistryHandpieces/MainWindowViewModel.cs @@ -233,8 +233,6 @@ public sealed class MainWindowViewModel : ObservableObject private bool _lastRealtimeReadFailed; private bool _hasReportedRunStateCommunicationLoss; private DateTime _lastSuccessfulRealtimeReadAt = DateTime.MinValue; - private bool _isAutoStoppingDisplacement; - private bool _isAutoStoppingSpeedTorque; private bool _isConfirmingDisplacementStop; private bool _isConfirmingSpeedTorqueStop; private bool _isApplyingParameterConfigToInputs; @@ -866,9 +864,6 @@ public sealed class MainWindowViewModel : ObservableObject ReadCoilValue(coilValues, SpeedTorqueEnabledCoil), ReadCoilValue(coilValues, SpeedTorqueDoneCoil)); - await AutoStopIfSetpointReachedAsync(); - await AutoStopIfSpeedTorqueProtectionReachedAsync(); - if (_lastRealtimeReadFailed) { if (HasActiveControlRun()) @@ -2184,8 +2179,6 @@ public sealed class MainWindowViewModel : ObservableObject UpdateParameterSummaries(); UpdateDisplacementDisplay(); UpdateSpeedTorqueDisplay(); - await AutoStopIfSetpointReachedAsync(); - await AutoStopIfSpeedTorqueProtectionReachedAsync(); _hasLoadedParameterConfigFromPlc = true; _parameterRetryTimer.Stop(); @@ -2409,7 +2402,6 @@ public sealed class MainWindowViewModel : ObservableObject AxialForceModeCoil, usePullForceSetpoint ? 1 : 0, GetActiveAxialForceSetpointName()); - await AutoStopIfSetpointReachedAsync(); } catch (Exception ex) { @@ -2552,10 +2544,6 @@ public sealed class MainWindowViewModel : ObservableObject SetTestPageInputStatus($"{fieldName}已自动写入并回读确认:{FormatConfigNumber(confirmedValue)}"); Log.Information("{FieldName}自动写入并回读成功,D{RegisterAddress}={Value}", fieldName, registerAddress, confirmedValue); - if (parameter is TestPageInputParameter.AxialPullForceSetpoint or TestPageInputParameter.AxialJumpForceSetpoint) - { - await AutoStopIfSetpointReachedAsync(); - } } private void ApplyConfirmedTestPageInputToEditor(TestPageInputParameter parameter, double requestedValue, double confirmedValue) @@ -2749,7 +2737,6 @@ public sealed class MainWindowViewModel : ObservableObject _realtimeSpeed, GetScaledTorque(), _speedTorqueDisplacement); - await AutoStopIfSpeedTorqueProtectionReachedAsync(); } private async Task WaitForSpeedTorqueStartAsync() @@ -3015,7 +3002,6 @@ public sealed class MainWindowViewModel : ObservableObject _maxDisplacement = Math.Abs(_relativeDisplacement); UpdateDisplacementDisplay(); Log.Information("轴向测试已启动,起始位移 {Displacement},起始轴向力 {AxialForce}", _relativeDisplacement, GetScaledAxialForce()); - await AutoStopIfSetpointReachedAsync(); } private async Task StopDisplacementAsync() @@ -3365,7 +3351,6 @@ public sealed class MainWindowViewModel : ObservableObject } UpdateSpeedTorqueDisplay(); - await AutoStopIfSpeedTorqueProtectionReachedAsync(); } private async Task MoveAxialDisplacementAsync() @@ -3384,7 +3369,6 @@ public sealed class MainWindowViewModel : ObservableObject } UpdateDisplacementDisplay(); - await AutoStopIfSetpointReachedAsync(); } private async Task UpdateAxialForceFromInputAsync() @@ -3396,50 +3380,6 @@ public sealed class MainWindowViewModel : ObservableObject _axialForce = force; UpdateDisplacementDisplay(); - await AutoStopIfSetpointReachedAsync(); - } - - private async Task AutoStopIfSetpointReachedAsync() - { - if (!_isDisplacementRunning || _isAutoStoppingDisplacement) - { - return; - } - - if (_parameterConfig.AxialDisplacementLimit > 0 - && Math.Abs(_relativeDisplacement) >= _parameterConfig.AxialDisplacementLimit) - { - await AutoStopDisplacementAsync("状态:位移极限保护,已停止"); - return; - } - - double activeAxialForceSetpoint = GetActiveAxialForceSetpoint(); - if (activeAxialForceSetpoint > 0 - && GetScaledAxialForce() >= activeAxialForceSetpoint) - { - await AutoStopDisplacementAsync($"状态:达到{GetActiveAxialForceSetpointName()},已停止"); - return; - } - - if (_parameterConfig.AxialForceProtection > 0 - && GetScaledAxialForce() >= _parameterConfig.AxialForceProtection) - { - await AutoStopDisplacementAsync("状态:轴向力保护,已停止"); - } - } - - private async Task AutoStopDisplacementAsync(string status) - { - _isAutoStoppingDisplacement = true; - try - { - Log.Warning("轴向测试触发自动停止:{Status},位移 {Displacement},轴向力 {AxialForce}", status, _relativeDisplacement, GetScaledAxialForce()); - await StopDisplacementControlAsync(status, "轴向保护停止"); - } - finally - { - _isAutoStoppingDisplacement = false; - } } private async Task StopDisplacementControlAsync(string status, string actionName) @@ -3535,42 +3475,6 @@ public sealed class MainWindowViewModel : ObservableObject _realtimeTorque = torque; UpdateSpeedTorqueDisplay(); - await AutoStopIfSpeedTorqueProtectionReachedAsync(); - } - - private async Task AutoStopIfSpeedTorqueProtectionReachedAsync() - { - if (!_isSpeedTorqueRunning || _isAutoStoppingSpeedTorque) - { - return; - } - - if (_parameterConfig.SpeedTorqueDisplacementLimit > 0 - && Math.Abs(_speedTorqueDisplacement) >= _parameterConfig.SpeedTorqueDisplacementLimit) - { - await AutoStopSpeedTorqueAsync("状态:位移极限保护,已停止"); - return; - } - - if (_parameterConfig.TorqueProtection > 0 - && GetScaledTorque() >= _parameterConfig.TorqueProtection) - { - await AutoStopSpeedTorqueAsync("状态:扭矩保护,已停止"); - } - } - - private async Task AutoStopSpeedTorqueAsync(string status) - { - _isAutoStoppingSpeedTorque = true; - try - { - Log.Warning("转速/扭矩测试触发自动停止:{Status},位移 {Displacement},转速 {Speed},扭矩 {Torque}", status, _speedTorqueDisplacement, _realtimeSpeed, GetScaledTorque()); - await StopSpeedTorqueControlAsync(status, "转速/扭矩保护停止"); - } - finally - { - _isAutoStoppingSpeedTorque = false; - } } private async Task StopSpeedTorqueControlAsync(string status, string actionName)