|
|
|
@ -112,6 +112,7 @@ class TCPCommunicator:
|
|
|
|
|
|
|
|
|
|
self.sock.sendall(packet)
|
|
|
|
|
self.packetCounter += 1
|
|
|
|
|
|
|
|
|
|
return current_counter
|
|
|
|
|
except Exception as e:
|
|
|
|
|
logging.error(f"Send error: {e}")
|
|
|
|
@ -299,6 +300,7 @@ class TCPCommunicator:
|
|
|
|
|
def writeAo(self, aoData):
|
|
|
|
|
"""同步写入AO数据并返回结果"""
|
|
|
|
|
packetNum = self.sendCommand(self.CMD_WRITE_AO, aoData)
|
|
|
|
|
# print(packetNum)
|
|
|
|
|
if packetNum is None:
|
|
|
|
|
return False
|
|
|
|
|
return self.waitForResponse(packetNum, self.CMD_WRITE_AO) or False
|
|
|
|
@ -425,7 +427,7 @@ def write_worker(communicator, interval):
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# 写入AO数据
|
|
|
|
|
print(len(ao_data), ao_data)
|
|
|
|
|
# print(len(ao_data), ao_data)
|
|
|
|
|
communicator.writeAo(ao_data)
|
|
|
|
|
|
|
|
|
|
# 等待指定间隔
|
|
|
|
|