This commit is contained in:
@@ -121,8 +121,16 @@ namespace MembranePoreTester.ViewModels
|
||||
{
|
||||
if (SetProperty(ref _pressureUpperLimit, value))
|
||||
{
|
||||
if (HighLowPressure == "低压")
|
||||
{
|
||||
if (value > 200)
|
||||
{
|
||||
MessageBox.Show("低压模式,加压上限不能超过200!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 值改变时写入PLC
|
||||
_ = WriteFloatAsync(_plcConfig.PressureUpperLimit, (float)value);
|
||||
_ = _plcService.WriteMultipleRegistersAsync(_plcConfig.PressureUpperLimit, (float)value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,7 +143,7 @@ namespace MembranePoreTester.ViewModels
|
||||
if (SetProperty(ref _pressureRate, value))
|
||||
{
|
||||
// 值改变时写入PLC
|
||||
_ = WriteFloatAsync(_plcConfig.PressureRate, (float)value);
|
||||
_ = _plcService.WriteMultipleRegistersAsync(_plcConfig.PressureRate, (float)value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,6 +156,9 @@ namespace MembranePoreTester.ViewModels
|
||||
float upperLimit = await _plcService.ReadFloatAsync(_plcConfig.PressureUpperLimit);
|
||||
float rate = await _plcService.ReadFloatAsync(_plcConfig.PressureRate);
|
||||
|
||||
|
||||
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
PressureUpperLimit = upperLimit;
|
||||
@@ -204,7 +215,7 @@ namespace MembranePoreTester.ViewModels
|
||||
// 启动定时器,每秒读取一次 M21 状态
|
||||
_timer = new System.Windows.Threading.DispatcherTimer();
|
||||
_timer.Interval = TimeSpan.FromSeconds(1);
|
||||
_timer.Tick += async (s, e) =>
|
||||
_timer.Tick += async (s, e) =>
|
||||
{
|
||||
await ReadEnableStatusAsync();
|
||||
await ReadPressureParametersAsync(); // 新增:读取压力参数
|
||||
|
||||
Reference in New Issue
Block a user