更新
This commit is contained in:
@@ -2057,26 +2057,6 @@ public sealed class MainWindowViewModel : ObservableObject
|
|||||||
Log.Information("PLC参数写入并回读确认成功,参数 {FieldName},D{RegisterAddress}={Value}", fieldName, registerAddress, confirmedValue);
|
Log.Information("PLC参数写入并回读确认成功,参数 {FieldName},D{RegisterAddress}={Value}", fieldName, registerAddress, confirmedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task WriteChangedTenthsAsync(ushort registerAddress, string fieldName, double oldValue, double newValue)
|
|
||||||
{
|
|
||||||
ushort oldRaw = ScaleTenthsToPlc(oldValue, fieldName);
|
|
||||||
ushort newRaw = ScaleTenthsToPlc(newValue, fieldName);
|
|
||||||
if (oldRaw == newRaw)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await _plcRegisterService.WriteUInt16Async(plcConfig, registerAddress, newRaw);
|
|
||||||
ushort confirmedRawValue = await _plcRegisterService.ReadUInt16Async(plcConfig, registerAddress);
|
|
||||||
if (confirmedRawValue != newRaw)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"{fieldName} D{registerAddress} 写入后回读不一致。");
|
|
||||||
}
|
|
||||||
|
|
||||||
changedItems.Add(fieldName);
|
|
||||||
Log.Information("PLC参数写入并回读确认成功,参数 {FieldName},D{RegisterAddress}={Value}", fieldName, registerAddress, ScaleTenthsFromPlc(confirmedRawValue));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryReadParameterPageConfig(out TestParameterConfig config, out string error)
|
private bool TryReadParameterPageConfig(out TestParameterConfig config, out string error)
|
||||||
|
|||||||
Reference in New Issue
Block a user