调整scan

This commit is contained in:
2025-05-23 08:53:44 +08:00
parent 6646e6b5e5
commit c02845ddc3
2 changed files with 10 additions and 5 deletions

View File

@@ -63,6 +63,11 @@ namespace RIZO_Helper.Tools
_serialPort.DataReceived += OnSerialDataReceived;
return true;
}
catch (InvalidOperationException ex)
{
Debug.WriteLine($"打开串口 {_serialPort.PortName} 失败: {ex.Message}");
return false;
}
catch (OperationCanceledException) when (_disposeCts.IsCancellationRequested)
{
return false;