From: p15692025051 <846603105@qq.com> Date: Mon, 21 Jul 2025 03:43:25 +0000 (+0800) Subject: 柒牌1.5提交 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=7ffb0b3d5ff25628954bf0f9ae53c1d22d7d565f;p=mirrors%2FASR1603_G5.git 柒牌1.5提交 --- diff --git a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py index a60a2a78..f66522a2 100644 --- a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py +++ b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py @@ -30,6 +30,7 @@ import machine import dataCall import constants import versions +from machine import UART try: import VAD except Exception as e: @@ -203,6 +204,34 @@ def set_ipv4_datacall(): print('已经配置为IPv4') else: print('获取PDP Context失败。') +class AI_UART(): + #串口命令通道 + def __init__(self): + self.AI_uart = UART(UART.UART4, 115200, 8, 0, 1, 0) + self.AI_uart.set_callback(self.uart_call) + def uart_call(self,para): + EventMesh.publish("publish_AI_btnInfo",{"func":self.pares_uart_data}) + #print("ai_uart:{}".format(para)) + def pares_uart_data(self): + uart_data = self.AI_uart.read() + print("uart_data:{}",uart_data) + uart_data_str = uart_data.decode('utf-8') + if uart_data_str.find("AI_KEY_PRESS")!= -1: + EventMesh.publish("publish_AI_btnInfo",{"func":self.AI_key_press}) + if uart_data_str.find("AI_PWR_PRESS")!= -1: + EventMesh.publish("publish_AI_btnInfo",{"func":self.pwk_key_release}) + def AI_key_press(self): + self.check_rest_timer_count = 0 + print("AI_key_press") + EventMesh.publish("AI_key_press") + + + + def pwk_key_release(self): + self.check_rest_timer_count = 0 + #print("pwk_key_release") + EventMesh.publish("pwk_key_release") + audio_buf = ['chaobingfatis', 'chenggong', 'didianguanji', 'IMEIhao', 'jianquancuowu', 'key_prompt', 'liuliangtishi', 'Low_power_warning', 'R_CHARGE_FULL', 'R_CHARGE_IN', 'R_CHARGE_OUT', 'R_READ_TIME_0', 'R_READ_TIME_1', 'R_READ_TIME_2', 'R_READ_TIME_3', 'R_READ_TIME_4', 'R_READ_TIME_5', 'R_READ_TIME_6', 'R_READ_TIME_7', 'R_READ_TIME_8', 'R_READ_TIME_9', 'R_READ_TIME_A', 'R_READ_TIME_B', 'R_READ_TIME_C', 'R_READ_TIME_D', 'R_READ_TIME_E', 'R_READ_TIME_F', 'R_READ_TIME_G', 'R_READ_TIME_H', 'R_READ_TIME_I', 'R_READ_TIME_J', 'R_READ_TIME_K', 'R_READ_TIME_L', 'R_READ_TIME_M', 'R_READ_TIME_N', 'R_READ_TIME_O', 'R_READ_TIME_P', 'R_READ_TIME_Q', 'R_READ_TIME_R', 'R_READ_TIME_S', 'R_READ_TIME_T', 'R_READ_TIME_U', 'R_READ_TIME_V', 'R_READ_TIME_W', 'R_READ_TIME_X', 'R_READ_TIME_Y', 'R_READ_TIME_Z', 'send_tone', 'shouhou', 'xinhaoruo1', 'zhengzaiguanji'] class AI_dev(Abstract): # AI @@ -245,8 +274,14 @@ class AI_dev(Abstract): self.extint_AI = ExtInt(ExtInt.GPIO5,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.keyAI_extint_cb) else: self.pwk_key = ExtInt(ExtInt.GPIO41, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.pwk_extint_cb) - #self.extint_AI = ExtInt(ExtInt.GPIO19,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.keyAI_extint_cb) - self.extint_AI = ExtInt(ExtInt.GPIO22,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.keyAI_extint_cb) + self.extint_AI = ExtInt(ExtInt.GPIO19,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.keyAI_extint_cb) + #self.extint_AI = ExtInt(ExtInt.GPIO22,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.keyAI_extint_cb) + #蓝牙唤醒4G中断 + self.extint_wakeup_cta1 = ExtInt(ExtInt.GPIO22,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_DISABLE, self.wakeup_extint_cb) + #4G唤醒蓝牙中断 + self.PIN_wakeup_bt =Pin(Pin.GPIO21, Pin.OUT, Pin.PULL_DISABLE, 0) + self.extint_wakeup_cta1_timer = osTimer() + self.extint_wakeup_cta1.enable() self.extint_AI.enable() self.pwk_key_status = 0 self.pwk_key_timer_count = 0 @@ -290,6 +325,7 @@ class AI_dev(Abstract): #EventMesh.publish("audio_montage_play",["xianyikaiji.mp3"]) #EventMesh.publish("publish_AI_btnInfo",{"func":self.ntptime_cb}) self.check_rest_timer_count = 0 + self.ai_uart = AI_UART() print("AI_dev:end") def ntptime_cb(self): #ntptime.settime(8) @@ -364,6 +400,17 @@ class AI_dev(Abstract): #print("publish_AI_btnInfo 2") def powerKey_callback(self, status): print("powerKey_callback:{}".format(status)) + def wakeup_extint_cb(self,args): + print("wakeup_extint_cb:!!!!!!!!!") + self.PIN_wakeup_bt.write(1) + EventMesh.publish("publish_AI_btnInfo",{"func":self.extint_wakeup_cta1_cb}) + def extint_wakeup_cta1_cb(self): + self.extint_wakeup_cta1_timer.start(100, 1, self.extint_wakeup_cta1_timer_cb) + pass + def extint_wakeup_cta1_timer_cb(self, *args, **kwargs): + if self.extint_wakeup_cta1.read_level() == 0: + self.extint_wakeup_cta1_timer.stop() + self.PIN_wakeup_bt.write(0) def pwk_extint_cb(self,args):#pwk try: