更新
This commit is contained in:
@@ -1306,7 +1306,10 @@ namespace TabletTester2025.ViewModels
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int count = Math.Max(1, HardnessTestCount);
|
int count = Math.Max(1, HardnessTestCount);
|
||||||
|
ushort startCoil = ResolveHardnessStartCoil();
|
||||||
ushort completeCoil = ResolveHardnessCompleteCoil();
|
ushort completeCoil = ResolveHardnessCompleteCoil();
|
||||||
|
if (startCoil == 0)
|
||||||
|
throw new InvalidOperationException("硬度启动线圈未配置");
|
||||||
if (completeCoil == 0)
|
if (completeCoil == 0)
|
||||||
throw new InvalidOperationException("硬度完成线圈未配置");
|
throw new InvalidOperationException("硬度完成线圈未配置");
|
||||||
if (_plcConfig.HardnessMax == 0)
|
if (_plcConfig.HardnessMax == 0)
|
||||||
@@ -1315,10 +1318,11 @@ namespace TabletTester2025.ViewModels
|
|||||||
await _plc.WriteFloatAsync(_plcConfig.HardnessSudu, (float)HardnessSudu);
|
await _plc.WriteFloatAsync(_plcConfig.HardnessSudu, (float)HardnessSudu);
|
||||||
await _plc.WriteFloatAsync(_plcConfig.HardnessWeiyi, (float)HardnessWeiyi);
|
await _plc.WriteFloatAsync(_plcConfig.HardnessWeiyi, (float)HardnessWeiyi);
|
||||||
|
|
||||||
if (await _plc.ReadCoilAsync(completeCoil))
|
bool completeWasActiveBeforeStart = await _plc.ReadCoilAsync(completeCoil);
|
||||||
await WaitForCoilStateAsync(completeCoil, false, TimeSpan.FromSeconds(10), "硬度完成信号未复位");
|
await PulseCoilAsync(startCoil);
|
||||||
|
|
||||||
await PulseCoilAsync(_plcConfig.HardnessStartCoil);
|
if (completeWasActiveBeforeStart)
|
||||||
|
await WaitForCoilStateAsync(completeCoil, false, TimeSpan.FromSeconds(10), "硬度完成信号未复位");
|
||||||
|
|
||||||
while (Phase == TestPhase.Running && _hardnessResults.Count < count)
|
while (Phase == TestPhase.Running && _hardnessResults.Count < count)
|
||||||
{
|
{
|
||||||
@@ -1357,6 +1361,13 @@ namespace TabletTester2025.ViewModels
|
|||||||
: _plcConfig.HardnessCompleteCoil;
|
: _plcConfig.HardnessCompleteCoil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ushort ResolveHardnessStartCoil()
|
||||||
|
{
|
||||||
|
return _plcConfig.HardnessStartCoil != 0
|
||||||
|
? _plcConfig.HardnessStartCoil
|
||||||
|
: (ushort)70;
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<double> ReadHardnessResultAsync()
|
private async Task<double> ReadHardnessResultAsync()
|
||||||
{
|
{
|
||||||
double value = await _plc.ReadFloatAsync(_plcConfig.HardnessMax);
|
double value = await _plc.ReadFloatAsync(_plcConfig.HardnessMax);
|
||||||
|
|||||||
Reference in New Issue
Block a user