Merge branch 'jgy-dev-bugfix-2025-01-07' into 'main'
添加电容同步采集功能 See merge request tactilesensor/fingersensorsdk/finger/python!7
This commit is contained in:
@ -12,7 +12,7 @@ DEF_CDC_SYNC_MS = 1000 #电容同步间隔
|
|||||||
DEF_GET_CAP_MS = (30) #读取电容间隔
|
DEF_GET_CAP_MS = (30) #读取电容间隔
|
||||||
DEF_PRO_CYC = 100
|
DEF_PRO_CYC = 100
|
||||||
|
|
||||||
DEF_MAX_FINGER_NUM = 2 # 需要连接的手指数量,最大5个
|
DEF_MAX_FINGER_NUM = 5 # 需要连接的手指数量,最大5个
|
||||||
|
|
||||||
# 定义一个全局的队列,用于线程间通信
|
# 定义一个全局的队列,用于线程间通信
|
||||||
capReadQueue = queue.Queue()
|
capReadQueue = queue.Queue()
|
||||||
@ -166,6 +166,10 @@ class ClassCapRead:
|
|||||||
if connectedSensorCnt > 1 and (time.time() - self.syncTimer) > DEF_CDC_SYNC_MS:
|
if connectedSensorCnt > 1 and (time.time() - self.syncTimer) > DEF_CDC_SYNC_MS:
|
||||||
self.syncTimer = time.time()
|
self.syncTimer = time.time()
|
||||||
self.set_sensor_enable(connectedSensorChan)
|
self.set_sensor_enable(connectedSensorChan)
|
||||||
|
for fingerIndex in range(0, len(self.fingers)):
|
||||||
|
if self.fingers[fingerIndex].connect is True:
|
||||||
|
self.fingers[fingerIndex].snsCmd.setSensorSync(0)
|
||||||
|
break
|
||||||
|
|
||||||
if self.connectStatus == EnumCh341ConnectStatus.CH341_CONNECT_CHECK:
|
if self.connectStatus == EnumCh341ConnectStatus.CH341_CONNECT_CHECK:
|
||||||
capReadTime = time.time()
|
capReadTime = time.time()
|
||||||
|
|||||||
@ -251,5 +251,23 @@ class ClassSensorCmd:
|
|||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# 设置采集同步
|
||||||
|
# addr:传感器地址
|
||||||
|
def setSensorSync(self, addr):
|
||||||
|
_pack = list()
|
||||||
|
_pack.append(0xAA)
|
||||||
|
_pack.append(0x55)
|
||||||
|
_pack.append(0x03)
|
||||||
|
_pack.append(self.CMD_SET_SENSOR_CDC_SYNC)
|
||||||
|
_pack.append(0x00)
|
||||||
|
_pack.append(0x00)
|
||||||
|
_pack.append(0x00)
|
||||||
|
_pack.append(0x00)
|
||||||
|
_pack.append(0x00)
|
||||||
|
self.calcSum(_pack)
|
||||||
|
self._ch341.write(addr, _pack)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user