更新20260519
This commit is contained in:
@@ -1039,8 +1039,8 @@ namespace TabletTester2025.ViewModels
|
||||
try
|
||||
{
|
||||
_isLoadingFriabilityTime = true;
|
||||
float value = await _plc.ReadFloatAsync(registerAddress);
|
||||
if (float.IsFinite(value) && value > 0)
|
||||
int value = await _plc.ReadIntAsync(registerAddress);
|
||||
if (value > 0)
|
||||
{
|
||||
FriabilityTargetTimeMin = value;
|
||||
}
|
||||
@@ -1108,7 +1108,7 @@ namespace TabletTester2025.ViewModels
|
||||
|
||||
try
|
||||
{
|
||||
await _plc.WriteFloatAsync(registerAddress, (float)value);
|
||||
await _plc.WriteRegisterAsync(registerAddress, ToPlcTimeRegisterValue(value));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
@@ -1233,16 +1233,24 @@ namespace TabletTester2025.ViewModels
|
||||
|
||||
private async Task WriteDisintegrationTimeAsync(double value)
|
||||
{
|
||||
if (_plcConfig.DisintegrationTime == 0 || value <= 0)
|
||||
if (_plcConfig.DisintegrationTime == 0 || value <= 0 || !double.IsFinite(value))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
await _plc.WriteFloatAsync(_plcConfig.DisintegrationTime, (float)value);
|
||||
await _plc.WriteRegisterAsync(_plcConfig.DisintegrationTime, ToPlcTimeRegisterValue(value));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static ushort ToPlcTimeRegisterValue(double value)
|
||||
{
|
||||
return (ushort)Math.Clamp(
|
||||
(int)Math.Round(value, MidpointRounding.AwayFromZero),
|
||||
0,
|
||||
ushort.MaxValue);
|
||||
}
|
||||
|
||||
private async Task WriteDisintegrationSpeedAsync(double value)
|
||||
{
|
||||
if (_plcConfig.DisintegrationSpeed == 0 || value <= 0)
|
||||
|
||||
Reference in New Issue
Block a user