From cdb21907288c2291698df47b3456f579d7b78b38 Mon Sep 17 00:00:00 2001 From: "GukSang.Jin" Date: Wed, 27 May 2026 14:59:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B020260527?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConeRadiationSettingsViewModel.cs | 76 +++++++++--- .../Views/ConeRadiationSettingsView.xaml | 116 ++++++++---------- ConeCalorimeter/Views/TestPageView.xaml | 15 ++- 3 files changed, 125 insertions(+), 82 deletions(-) diff --git a/ConeCalorimeter/ViewModels/ConeRadiationSettingsViewModel.cs b/ConeCalorimeter/ViewModels/ConeRadiationSettingsViewModel.cs index 369ce8a..f28b695 100644 --- a/ConeCalorimeter/ViewModels/ConeRadiationSettingsViewModel.cs +++ b/ConeCalorimeter/ViewModels/ConeRadiationSettingsViewModel.cs @@ -38,7 +38,9 @@ public sealed class ConeRadiationSettingsViewModel : PageViewModel private const double HeatingNoRiseTolerance = 1; private const double HeatingAtTargetTolerance = 2; private const double TargetTemperatureMismatchTolerance = 0.05; - private const ushort AlarmCoil = 91; + private const ushort YellowLampCoil = 57; + private const ushort GreenLampCoil = 58; + private const ushort RedLampCoil = 59; private const ushort CirculatingWaterCoil = 49; private const ushort HeatingCoil = 102; private const ushort StartHeatingCoil = 100; @@ -67,7 +69,9 @@ public sealed class ConeRadiationSettingsViewModel : PageViewModel private string _targetTemperatureText = ""; private string _heatTransferText = ""; private string _lastAction = "待机"; - private bool _alarmActive; + private bool _yellowLampActive; + private bool _greenLampActive; + private bool _redLampActive; private bool _circulatingWaterActive; private bool _heatingActive; private bool _isEditingConeParameters; @@ -148,25 +152,67 @@ public sealed class ConeRadiationSettingsViewModel : PageViewModel private set => SetProperty(ref _lastAction, value); } - public bool AlarmActive + public bool YellowLampActive { - get => _alarmActive; - private set => SetProperty(ref _alarmActive, value); + get => _yellowLampActive; + private set + { + if (SetProperty(ref _yellowLampActive, value)) + { + OnPropertyChanged(nameof(LampStatusText)); + } + } + } + + public bool GreenLampActive + { + get => _greenLampActive; + private set + { + if (SetProperty(ref _greenLampActive, value)) + { + OnPropertyChanged(nameof(LampStatusText)); + } + } + } + + public bool RedLampActive + { + get => _redLampActive; + private set + { + if (SetProperty(ref _redLampActive, value)) + { + OnPropertyChanged(nameof(LampStatusText)); + } + } + } + + public string LampStatusText + { + get + { + if (RedLampActive) + { + return "M59 红灯"; + } + + if (YellowLampActive) + { + return "M57 黄灯"; + } + + return GreenLampActive ? "M58 绿灯" : "未触发"; + } } public bool CirculatingWaterActive { get => _circulatingWaterActive; - private set - { - if (SetProperty(ref _circulatingWaterActive, value)) - { - OnPropertyChanged(nameof(CirculatingWaterButtonText)); - } - } + private set => SetProperty(ref _circulatingWaterActive, value); } - public string CirculatingWaterButtonText => CirculatingWaterActive ? "循环水:开启" : "循环水:关闭"; + public string CirculatingWaterButtonText => CirculatingWaterAction; public bool HeatingActive { @@ -263,7 +309,9 @@ public sealed class ConeRadiationSettingsViewModel : PageViewModel } } - AlarmActive = _tcpDeviceConnectionService.TryReadCoil(AlarmCoil, out var alarmActive) && alarmActive; + YellowLampActive = _tcpDeviceConnectionService.TryReadCoil(YellowLampCoil, out var yellowLampActive) && yellowLampActive; + GreenLampActive = _tcpDeviceConnectionService.TryReadCoil(GreenLampCoil, out var greenLampActive) && greenLampActive; + RedLampActive = _tcpDeviceConnectionService.TryReadCoil(RedLampCoil, out var redLampActive) && redLampActive; HeatingActive = _tcpDeviceConnectionService.TryReadCoil(HeatingCoil, out var heatingActive) && heatingActive; LogHeatingDiagnosticIfNeeded(HeatingActive); if (_tcpDeviceConnectionService.TryReadCoil(CirculatingWaterCoil, out var circulatingWaterActive)) diff --git a/ConeCalorimeter/Views/ConeRadiationSettingsView.xaml b/ConeCalorimeter/Views/ConeRadiationSettingsView.xaml index c998d27..f5831ec 100644 --- a/ConeCalorimeter/Views/ConeRadiationSettingsView.xaml +++ b/ConeCalorimeter/Views/ConeRadiationSettingsView.xaml @@ -43,7 +43,7 @@ - + - - - - - - - - - - - + - + + @@ -292,39 +283,32 @@ CommandParameter="停止升温" Width="140" Height="42" + Margin="0,0,10,0" Style="{StaticResource InstrumentButtonStyle}" /> + - - - - - - - - - - diff --git a/ConeCalorimeter/Views/TestPageView.xaml b/ConeCalorimeter/Views/TestPageView.xaml index 5d5e857..4370e25 100644 --- a/ConeCalorimeter/Views/TestPageView.xaml +++ b/ConeCalorimeter/Views/TestPageView.xaml @@ -191,8 +191,19 @@ FontWeight="SemiBold" Foreground="#162321" /> + FontSize="16"> + + + +