增加vofa输出
This commit is contained in:
30
cap_read.py
30
cap_read.py
@ -49,8 +49,7 @@ class ClassCapRead:
|
||||
self.connectDebug()
|
||||
|
||||
def __del__(self):
|
||||
if self.vofaClient:
|
||||
self.vofaClient.close()
|
||||
self.disConnectDebug()
|
||||
self.ch341.disconnect()
|
||||
print("ch341释放")
|
||||
pass
|
||||
@ -62,12 +61,16 @@ class ClassCapRead:
|
||||
try:
|
||||
self.vofaClient.connect(addr)
|
||||
# client.send('hello world\r\n'.encode())
|
||||
self.socketConnected = 1
|
||||
self.socketConnected = True
|
||||
print('连接服务器成功')
|
||||
except Exception as e:
|
||||
self.socketConnected = 0
|
||||
self.socketConnected = False
|
||||
print('连接服务器失败')
|
||||
|
||||
def disConnectDebug(self):
|
||||
if self.vofaClient:
|
||||
self.vofaClient.close()
|
||||
|
||||
def set_sensor_enable(self, idx):
|
||||
_pack = list()
|
||||
_pack.append(idx)
|
||||
@ -127,6 +130,25 @@ class ClassCapRead:
|
||||
self.fingers[fingerIndex].capRead()
|
||||
connectedSensorCnt += 1
|
||||
|
||||
if self.socketConnected == True:
|
||||
_log1 = ""
|
||||
# 输出原始通道数值
|
||||
for index in range(0, self.fingers[fingerIndex].projectPara.sensor_num):
|
||||
_log1 += str(self.fingers[fingerIndex].readData.channelCapData[index])
|
||||
_log1 += ','
|
||||
for index in range(0, self.fingers[fingerIndex].projectPara.ydds_num):
|
||||
_log1 += str(int(self.fingers[fingerIndex].readData.nf[index]*1000))
|
||||
_log1 += ','
|
||||
_log1 += str(int(self.fingers[fingerIndex].readData.tf[index]*1000))
|
||||
_log1 += ','
|
||||
_log1 += str(self.fingers[fingerIndex].readData.tfDir[index])
|
||||
_log1 += ','
|
||||
_log1 += str(0)
|
||||
_log1 += '\r\n'
|
||||
#print(_log1)
|
||||
if self.socketConnected == 1:
|
||||
self.vofaClient.send(_log1.encode())
|
||||
|
||||
# 大于1个传感器连接需要设置接近采集序列
|
||||
if connectedSensorCnt > 1 and (time.time() - self.syncTimer) > DEF_CDC_SYNC_MS:
|
||||
self.syncTimer = time.time()
|
||||
|
||||
Reference in New Issue
Block a user