if dev_type == "7PIN_BK"or dev_type == "7PIN_BK_EU"or dev_type == "7PIN_BK_coze":
key_count = 3
if self.KeyAI_timer_count >= key_count: #防抖200ms
+ if self.KeySOS_timer_flag == 1:
+ self.KeySOS_timer_flag = 0
+ self.KeySos_long_press = 0
+ self.KeySOS_timer.stop()
+ print("KeySOS_timer_flag!!!!!!!!!!!!!!!") #短按两次需要清除标识
+
if self.KeyAI_long_press == 0:
if self.KeySOS_timer_flag == 0:
self.KeySOS_timer_flag = 1
if self.KeySos_long_press == 1 and self.KeySOS_timer_flag == 1:
self.KeySos_long_press=0
self.KeySOS_timer_flag=0
- get_sos_flag = EventMesh.publish("get_sos_flag")
- if get_sos_flag == 0:
- EventMesh.publish("set_sos_info_call")
+
self.KeySos_long_press=0
self.KeySOS_timer_flag = 0
return
self.tts_in_data_len = 0
self.tts_out_data_len = 0
self.VC_satrt_flag = 0
+ self.VC_stop_play_audio_flag = 0
self.VC_satrt_kws_flag = 0
self.session_id = ""
EventMesh.subscribe("AI_key_press", self.AI_key_press)
print("pwk_key_release")
EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
EventMesh.publish("stop_sos_call")
- EventMesh.publish("sleep_BT")#休眠蓝牙
+ #EventMesh.publish("sleep_BT")#休眠蓝牙
+
def key_prompt(self):
EventMesh.publish("audio_montage_play",["key_prompt.mp3"])
print("AI_VC_start1")
EventMesh.publish(constants.EVENT.SYSTEM_UP)#唤醒休眠
self.VC_satrt_flag = 1
+ self.VC_stop_play_audio_flag = 1
self.VC_satrt_kws_flag = 1
if self.VC_Thinking_timerout < 100:
self.VC_Thinking_timerout = 0
print("音频数据还有剩余!!!!!!!!!!!!")
while True:
try:
- if self.AI_audio_queue_thread_lock == 2:
- print("AI_audio_queue_thread 该退出了")
- break
+ if self.AI_audio_queue_thread_lock == 2 or self.VC_stop_play_audio_flag == 0:
+ print("AI_audio_queue_thread 该退出了")
+ break
#
count+=1
if count%500 == 1:
EventMesh.publish("audio_montage_play",["xinhaoruo1.mp3"])
def Close(self):
+ self.VC_stop_play_audio_flag = 0
self.VC_Thinking_timerout = 0
self.AI_ASR_timer.stop()
self._1S_timer.stop()