This commit is contained in:
xyy
2026-03-06 17:12:02 +08:00
parent 3516fd204c
commit 1bffd24c21

View File

@@ -207,6 +207,7 @@ namespace ConductivityApp
// txtSampleDensity.Text = "1800"; // 应由用户输入
}
string COM = ConfigurationManager.AppSettings["COM"];
private void InitializeHardware()
{
try
@@ -590,7 +591,7 @@ namespace ConductivityApp
Thread.Sleep(1000); // 等待1秒
// 2. 重新初始化
string comPort = "COM6"; // 或从配置读取
string comPort = COM; // 或从配置读取
int baudRate = 9600;
_serialPort = new SerialPort(comPort, baudRate, Parity.None, 8, StopBits.One);