This commit is contained in:
xyy
2026-06-17 23:08:06 +08:00
parent 723a5a0ea7
commit 92a480834a
7 changed files with 196 additions and 48 deletions

View File

@@ -43,6 +43,17 @@ namespace AciTester.ViewModels
var protect = await _plcService.ReadFloatAsync(_config.FlowProtectReg);
_calib.FlowLowLimit = protect - 5; // 示例,实际根据协议解析
_calib.FlowHighLimit = protect + 5;
// 读取线圈状态(新增)
_calib.FlowCalibrationEnabled = await _plcService.ReadCoilAsync(_config.FlowCalibrationCoil);
_calib.PumpPressureCalibrationEnabled = await _plcService.ReadCoilAsync(_config.PumpPressureCalibCoil);
_calib.ImpactorPressureCalibrationEnabled = await _plcService.ReadCoilAsync(_config.ImpactorPressureCalibCoil);
}
catch (System.Exception ex)
{
@@ -64,6 +75,19 @@ namespace AciTester.ViewModels
await _plcService.WriteMultipleRegistersAsync(_config.PumpPressureCalibReg, _calib.PumpPressureCalibration);
await _plcService.WriteMultipleRegistersAsync(_config.ImpactorPressureCalibReg, _calib.ImpactorPressureCalibration);
// 写入流量保护值(需根据实际协议拆分高低限)
await _plcService.WriteCoilAsync(_config.FlowCalibrationCoil, _calib.FlowCalibrationEnabled);
await _plcService.WriteCoilAsync(_config.PumpPressureCalibCoil, _calib.PumpPressureCalibrationEnabled);
await _plcService.WriteCoilAsync(_config.ImpactorPressureCalibCoil, _calib.ImpactorPressureCalibrationEnabled);
MessageBox.Show("配置保存成功", "提示");
// 可选:触发重新校准
await _plcService.WriteCoilAsync(_config.ImpactorPressureCalibCoil, true);