#print("pwk_key_release")
EventMesh.publish("pwk_key_release")
def send_get_versions(self,event=None,msg=None):
+ EventMesh.publish(constants.EVENT.SYSTEM_UP)#唤醒休眠
#self.read_ack_flag = 0
json_data = \
{
print("send_get_versions{}".format(json_str))
print("send_get_versions{}".format(json_str))
self.send_data(json_str,1)
+ #self.AI_uart.write(json_str)
count =1000
while True:
count -=1
self.is_wdt = 0 #是否开启看门狗
#AT+QDAI=1,0,0,1,0,0,1,1PCM音频输出设置为主模式、短同步、16 kHz采样率和256 kHz时钟频率,采样位深为16bit,使用的时间间隙数量为1,并且使用第一个时间间隙。
if dev_type == "7PIN_1_5" :
- audio.set_qdai_cfg(1,0,0,2,0,1,1,1)
+ #蓝牙电源
+ self.PIN_BT_ON =Pin(Pin.GPIO31, Pin.OUT, Pin.PULL_DISABLE, 0)
+ #马达
+ self.PIN_MOT=Pin(Pin.GPIO36, Pin.OUT, Pin.PULL_DISABLE, 1)
+
+ # #马达
+ # self.PIN_MOT.write(1)
+
+ utime.sleep_ms(200)
+ self.PIN_MOT.write(0)
+ self.PIN_BT_ON.write(1)
+ audio.set_qdai_cfg(1,0,0,2,0,1,1,1)#用iis做音频输入输出
self.VBATT_tab = {"charge_full":4300,"100" :4250 , "90":4179 , "80":4070, "60": 3883, "40":3770, "20":3699, "10":3652,"5":3600,}
self.KeyAI_status = 0
self.KeyAI_timer_count = 0
self.extint_wakeup_cta1 = ExtInt(ExtInt.GPIO22,ExtInt.IRQ_RISING, ExtInt.PULL_DISABLE, self.wakeup_extint_cb)
#4G唤醒蓝牙中断
self.PIN_wakeup_bt =Pin(Pin.GPIO21, Pin.OUT, Pin.PULL_DISABLE, 0)
- #马达
- self.PIN_MOT=Pin(Pin.GPIO36, Pin.OUT, Pin.PULL_DISABLE, 0)
- #蓝牙电源
- self.PIN_BT_ON =Pin(Pin.GPIO31, Pin.OUT, Pin.PULL_DISABLE, 0)
- #马达
- self.PIN_MOT.write(1)
- utime.sleep_ms(200)
- self.PIN_MOT.write(0)
- self.PIN_BT_ON.write(1)
+
+
self.extint_wakeup_cta1_timer = osTimer()
self.extint_wakeup_cta1.enable()
else:
self.Keycall1_press_count = 0
self.ble_switch_flag_time = osTimer()
- self.ble_switch_flag_time.start(10000, 0, self.ble_switch_flag_time_init)
+ self.ble_switch_flag_time.start(20000, 0, self.ble_switch_flag_time_init)
def ble_switch_flag_time_init(self,*args):
EventMesh.publish("publish_AI_btnInfo",{"func":self.ble_switch_flag_time_cb})
def ble_switch_flag_time_cb(self,*args):
self.key_state = 1
if PRESS_AUDIO_MODE == 1:
if dev_type == "7PIN" or dev_type == "7PIN_1_5":
- self.ai_key_press_audio.stop()
- self.ai_key_press_audio.start(300, 0, self.ai_key_press_audio_cb1)
- # self.aud.aud_tone_play(10,200)#播放按键音
+ if dev_type == "7PIN_1_5":
+ self.ai_key_press_audio.stop()
+ self.ai_key_press_audio.start(300, 0, self.ai_key_press_audio_cb1)
+ # self.aud.aud_tone_play(10,200)#播放按键音
+ else:
+ self.aud.aud_tone_play(10,200)#播放按键音
self.Close()
if PRESS_AUDIO_MODE == 0:
if dev_type == "7PIN" or dev_type == "7PIN_1_5":
- self.ai_key_press_audio.stop()
- self.ai_key_press_audio.start(200, 0, self.ai_key_press_audio_cb2)
- # self.chenggong_tone()
+ if dev_type == "7PIN_1_5":
+ self.ai_key_press_audio.stop()
+ self.ai_key_press_audio.start(200, 0, self.ai_key_press_audio_cb2)
+ # self.chenggong_tone()
+ else:
+ self.chenggong_tone()
+
# if dev_type == "7PIN":
# self.chenggong_tone()
#self.aud.aud_tone_play(10,200)#播放按键音