增加vofa输出
This commit is contained in:
30
cap_read.py
30
cap_read.py
@ -49,8 +49,7 @@ class ClassCapRead:
|
|||||||
self.connectDebug()
|
self.connectDebug()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.vofaClient:
|
self.disConnectDebug()
|
||||||
self.vofaClient.close()
|
|
||||||
self.ch341.disconnect()
|
self.ch341.disconnect()
|
||||||
print("ch341释放")
|
print("ch341释放")
|
||||||
pass
|
pass
|
||||||
@ -62,12 +61,16 @@ class ClassCapRead:
|
|||||||
try:
|
try:
|
||||||
self.vofaClient.connect(addr)
|
self.vofaClient.connect(addr)
|
||||||
# client.send('hello world\r\n'.encode())
|
# client.send('hello world\r\n'.encode())
|
||||||
self.socketConnected = 1
|
self.socketConnected = True
|
||||||
print('连接服务器成功')
|
print('连接服务器成功')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.socketConnected = 0
|
self.socketConnected = False
|
||||||
print('连接服务器失败')
|
print('连接服务器失败')
|
||||||
|
|
||||||
|
def disConnectDebug(self):
|
||||||
|
if self.vofaClient:
|
||||||
|
self.vofaClient.close()
|
||||||
|
|
||||||
def set_sensor_enable(self, idx):
|
def set_sensor_enable(self, idx):
|
||||||
_pack = list()
|
_pack = list()
|
||||||
_pack.append(idx)
|
_pack.append(idx)
|
||||||
@ -126,6 +129,25 @@ class ClassCapRead:
|
|||||||
else:
|
else:
|
||||||
self.fingers[fingerIndex].capRead()
|
self.fingers[fingerIndex].capRead()
|
||||||
connectedSensorCnt += 1
|
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个传感器连接需要设置接近采集序列
|
# 大于1个传感器连接需要设置接近采集序列
|
||||||
if connectedSensorCnt > 1 and (time.time() - self.syncTimer) > DEF_CDC_SYNC_MS:
|
if connectedSensorCnt > 1 and (time.time() - self.syncTimer) > DEF_CDC_SYNC_MS:
|
||||||
|
|||||||
Reference in New Issue
Block a user