fix(DLPilot): 单实例锁 + 串口占用提示 —— 修复'断不开'的实际根源

This commit is contained in:
2026-09-18 01:13:05 +08:00
parent c8ea5be031
commit e87bf14aaa
3 changed files with 25 additions and 1 deletions
+5 -1
View File
@@ -301,7 +301,11 @@ class DLPC485:
self.ser = None
with self._lock:
self._target = None
self.on_status(f'连接失败: {e}')
et = str(e)
if 'PermissionError' in repr(e) or '拒绝访问' in et \
or 'Access is denied' in et:
et += '(串口被占用: 检查串口助手/另一个本工具实例)'
self.on_status(f'连接失败: {et}')
if self.ser is not None:
try:
item = None