self.extint_wakeup_cta1_timer = osTimer()
self.extint_wakeup_cta1.enable()
else:
- # self.pwk_key = ExtInt(ExtInt.GPIO41, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.pwk_extint_cb)
- self.pwk_key = ExtInt(ExtInt.GPIO26, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.pwk_extint_cb)
+ self.pwk_key = ExtInt(ExtInt.GPIO41, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.pwk_extint_cb)
+ # self.pwk_key = ExtInt(ExtInt.GPIO26, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.pwk_extint_cb)
self.extint_AI = ExtInt(ExtInt.GPIO22,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.keyAI_extint_cb)
self.extint_AI.enable()
try:
#print("AI_btn:keyAI_extint_cb{}".format(args[1]))
#定义最短触发间隔
- MIN_TRIGGER_INTERVAL = 100 # 可根据需求调整,单位ms
+ MIN_TRIGGER_INTERVAL = 1 # 可根据需求调整,单位ms
#记录上次按键触发时间(初始化放类的__init__里:self.last_ai_key_time = 0)
current_time = utime.ticks_ms() # 获取当前毫秒时间
#重复按下,直接返回
url = "http://dmp-global.raisound.com/bz-api/dev/time"
else:
url = "https://dmp-api.qipai.com/qp-dmp-api/dev/time"
- # url = "https://dmp-dev.raisound.com/dmp-api/dev/time"
+ #url = "https://dmp-dev.raisound.com/dmp-api/dev/time"
url = "http://dmp.raisound.com/bz-api/dev/time"#金三
+ print("dev_NTP:{}".format(url))
response = request.get(url,timeout=5)
data = response.json()
print("dev_NTP:{}".format(data))
url = "https://dmp-api.qipai.com/qp-dmp-api/dev/auth/active"
url = "http://dmp.raisound.com/bz-api/dev/auth/active"#金三
# url = "https://dmp-dev.raisound.com/dmp-api/dev/auth/active"
+ print("dev_active:{}".format(url))
data =ujson.dumps(data)
response = None
response_result = 0
# headers_T = {"Content-Type":"application/x-www-form-urlencoded","Accept":"*/*","bz-dt":"{}".format(token)}
# response = request.get(url,headers = headers_T,timeout=5)
# data = response.json()
+ print("dev_sign_in:{}".format(sign_url))
headers_T ={"Content-Type":"application/json"}
response_result = 0
response = 0
# import voiceCall
# voiceCall.callStart("10086")
# return
- self.http_get_config_flag = 1
+ self.http_get_config_flag = 0
if self.http_get_config_flag == 1:
try:
self.http_get_config()#获取/更新配置参数
def AI_key_press(self, event=None, msg = None):#按键按下
if dev_type == "7PIN": #2代产品要延时播放按键音 为了连接蓝牙后不播放按键音的问题
# print("1111111111播放按键音!!!!!!!!!!")
- self.aud.aud_tone_play(10,400)#播放按键音
-
+ # self.aud.aud_tone_play(10,400)#播放按键音
+ self.aud.play(1, 1, 'U:/static/start.mp3') #播放按键音
# 播放状态判定
if self.VC_state >= VC_State_TTSStart and self.VC_state <= VC_State_TTSEnd:
print("【打断播放】设备正在说话,仅中断播放,不发起新对话")
self.AI_TTS_str = "我没听清,请再说一遍"
EventMesh.publish("open_led_blue")
elif jsload_data["event"] == "asr.completed" :#asr 终止的标识
+ self.aud.play(1, 1, 'U:/static/think.mp3') #播放按键音
print("self.commands_mode:{}".format(self.commands_mode))
if self.commands_mode ==2:
ret= self.check_text(self.AI_ASR_str)
EventMesh.publish("system_sleep_rest")#防止黑屏
self.close_timerout += 1
- if self.close_timerout > 60 and self.VC_mode != 1 :#:#20秒没数据就close 长按单次问答模式不关
+ if self.close_timerout > 20 and self.VC_mode != 1 :#:#20秒没数据就close 长按单次问答模式不关
if self.VC_state >= VC_State_SpeechIng:
print("接口无响应,超时退出")
self.AI_ASR_check_timeout = 0
self.AI_ASR_error_timeout = 0
self.LocalRespondingEnded_timerout = 0
+ self.is_ruppt_tts = 0#打断标志位清零
print("ai_VC Close1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
EventMesh.publish("close_led")
self.tts_in_data_len = 0