This commit is contained in:
xyy
2026-01-07 14:27:03 +08:00
parent 213fe7fbaf
commit 607ebee5fb
2 changed files with 3 additions and 2 deletions

View File

@@ -103,7 +103,7 @@ namespace 外科辅料和患者防护罩激光抗性测试仪
if (_modbusMaster == null || _tcpClient == null || !_tcpClient.Connected) if (_modbusMaster == null || _tcpClient == null || !_tcpClient.Connected)
{ {
return; return;
} }
float value = float.Parse(uiLabel23.Text); float value = float.Parse(uiLabel23.Text);
await _modbusMaster.WriteMultipleRegistersAsync(1, 74, c.SplitFloatToUShortArray((float)value)); await _modbusMaster.WriteMultipleRegistersAsync(1, 74, c.SplitFloatToUShortArray((float)value));
//}); //});
@@ -111,6 +111,7 @@ namespace 外科辅料和患者防护罩激光抗性测试仪
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.Message);
//ShowError($"读取数据失败:{ex.Message}"); //ShowError($"读取数据失败:{ex.Message}");
} }
} }
@@ -1104,7 +1105,7 @@ namespace 外科辅料和患者防护罩激光抗性测试仪
if (double.TryParse(trimmedLine, NumberStyles.Float, CultureInfo.InvariantCulture, out double powerValue)) if (double.TryParse(trimmedLine, NumberStyles.Float, CultureInfo.InvariantCulture, out double powerValue))
{ {
uiLabel23.Text = $"{powerValue:F3} W"; uiLabel23.Text = $"{powerValue:F3}";
_waitingResponse = false; _waitingResponse = false;
} }
else if (trimmedLine.Contains(".") && trimmedLine.Length > 0) else if (trimmedLine.Contains(".") && trimmedLine.Length > 0)