main_controller: add 重量读取线程
This commit is contained in:
@ -79,7 +79,7 @@ class TransmitterController:
|
||||
# 上料斗变送器的信息:
|
||||
IP = "192.168.250.63"
|
||||
PORT = 502
|
||||
TIMEOUT = 5 # 超时时间为 5秒
|
||||
TIMEOUT = 2 # 超时时间为 2秒
|
||||
BUFFER_SIZE= 1024
|
||||
weight = None
|
||||
|
||||
@ -106,9 +106,9 @@ class TransmitterController:
|
||||
print("未收到设备数据")
|
||||
|
||||
except ConnectionRefusedError:
|
||||
print(f"连接失败:{IP}:{PORT} 拒绝连接(设备离线/端口错误)")
|
||||
print(f"变送器连接失败:{IP}:{PORT} 拒绝连接(设备离线/端口错误)")
|
||||
except socket.timeout:
|
||||
print(f"超时:{TIMEOUT}秒内未收到数据")
|
||||
print(f"读取变送器数据超时:{TIMEOUT}秒内未收到数据")
|
||||
except Exception as e:
|
||||
print(f"读取异常:{e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user