侧键关闭拨打sos电话
authordxy <1731678236qq.com>
Tue, 19 Aug 2025 10:11:18 +0000 (18:11 +0800)
committerdxy <1731678236qq.com>
Tue, 19 Aug 2025 10:11:18 +0000 (18:11 +0800)
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py

index 2702766..59f8485 100644 (file)
@@ -716,7 +716,7 @@ class AI_dev(Abstract):
             self.PIN_BT_ON =Pin(Pin.GPIO31, Pin.OUT, Pin.PULL_DISABLE, 1)
             #马达
             self.PIN_MOT=Pin(Pin.GPIO36, Pin.OUT, Pin.PULL_DISABLE, 1)
-            utime.sleep_ms(1000)
+            utime.sleep_ms(500)
             self.PIN_MOT=Pin(Pin.GPIO36, Pin.OUT, Pin.PULL_DISABLE, 0)
 
         self.extint_wakeup_cta1_timer = osTimer()
@@ -878,6 +878,7 @@ class AI_dev(Abstract):
         print("sys_sleep_cb!!!!!!!!!!!!!!!")
         print("sys_sleep_cb!!!!!!!!!!!!!!!")
         print("sys_sleep_cb!!!!!!!!!!!!!!!")
+        EventMesh.publish("sleep_BT")#休眠蓝牙
         self.PIN_wakeup_bt.write(0)
     def sys_up_cb(self,event=None,msg=None):#唤醒前回调
         print("sys_up_cb!!!!!!!!!!!!!!!")
@@ -988,6 +989,7 @@ class AI_dev(Abstract):
                     self.pwk_key_timer.stop()
                     self.pwk_key_timer_count = 0
                     self.pwk_key_press = 0
+                    
             
         except Exception as e: 
             usys.print_exception(e) 
@@ -2905,6 +2907,7 @@ class AI_VC(Abstract):
     def pwk_key_release(self, event, msg):#电源键短按,关闭
         print("pwk_key_release")
         EventMesh.publish("publish_AI_btnInfo",{"func":self.Close}) 
+        EventMesh.publish("stop_sos_call")
         EventMesh.publish("sleep_BT")#休眠蓝牙
 
     def key_prompt(self):
@@ -4301,12 +4304,12 @@ class AI_VC(Abstract):
                         return 0
                     else:
                         EventMesh.publish("publish_AI_btnInfo",{"func":self.Close}) 
-                        EventMesh.publish("sleep_BT")#休眠蓝牙
+                        #EventMesh.publish("sleep_BT")#休眠蓝牙
                         return 1
                 if len(text)<12 and (text.find("关机") != -1 ):
                     if dev_type == "7PIN" or dev_type == "7PIN_coze":#柒牌
                         EventMesh.publish("publish_AI_btnInfo",{"func":self.Close}) 
-                        EventMesh.publish("sleep_BT")#休眠蓝牙
+                        #EventMesh.publish("sleep_BT")#休眠蓝牙
                         return 1
                     EventMesh.publish("publish_AI_btnInfo",{"func":self.Close}) 
                     EventMesh.publish("Power_off")
@@ -4416,7 +4419,7 @@ class AI_VC(Abstract):
                 self.ud_error(["VC",self.VC_taskid])
             else:
                 EventMesh.publish("publish_AI_btnInfo",{"func":self.Close}) 
-                EventMesh.publish("sleep_BT")#休眠蓝牙
+                #EventMesh.publish("sleep_BT")#休眠蓝牙
         
         # print("get_audio_state !!!!!{} {} {}\r\n".format(self.play_end,EventMesh.publish("get_audio_state"),self.play_flag))
         if self.LocalRespondingEnded_timerout>0  :#
@@ -4426,13 +4429,13 @@ class AI_VC(Abstract):
                 self.LocalRespondingEnded_timerout = 0
                 if self.VC_mode == 1 :#长按单次问答模式
                     EventMesh.publish("publish_AI_btnInfo",{"func":self.Close}) 
-                    EventMesh.publish("sleep_BT")#休眠蓝牙
+                    #EventMesh.publish("sleep_BT")#休眠蓝牙
                 else:
                     EventMesh.publish("open_led_blue")
                     if self.Close_flag == 1:
                         self.Close_flag = 0
                         EventMesh.publish("publish_AI_btnInfo",{"func":self.Close}) 
-                        EventMesh.publish("sleep_BT")#休眠蓝牙
+                        #EventMesh.publish("sleep_BT")#休眠蓝牙
                     else:
                         #utime.sleep_ms(1000)
                         EventMesh.publish("publish_AI_btnInfo",{"func":self.VC_Play_End})
index c3d3aff..6d3d19d 100644 (file)
@@ -937,6 +937,7 @@ class sosInfoCallManager(Abstract):
         voiceCall.setCallback(self.voice_callback)
         EventMesh.subscribe("set_sos_info_call", self.set_sos_info_call)
         EventMesh.subscribe("set_sos_list_info",self.set_sos_list_info)
+        EventMesh.subscribe("stop_sos_call",self.stop_sos_call)
         
     def get_sos_flag(self,event,msg):
         return self.sos_flag
@@ -944,6 +945,22 @@ class sosInfoCallManager(Abstract):
         # EventMesh.publish("set_sos_info_call")
     def close_call_timer(self):
         self.sos_timer2.stop()
+        pass
+    def stop_sos_call(self,event,msg): #停止sos拨打
+        EventMesh.publish("publish_AI_btnInfo",{"func":self.stop_sos_call_cb})
+    def stop_sos_call_cb(self):
+        if self.sos_flag  == 0:
+            return
+        self.sos_flag = 0
+        self.num = 0
+        self.call_state = 0
+        self.num=0 #不管有没有拨打sos都清除
+        self.num_len = 0
+        self.sos_flag = 0
+        self.sos_timer2.stop()
+        self.sos_timer1.stop()
+        voiceCall.callEnd() #挂断
+
         pass
     def start_phone110112(self):
         if self.call_state == 0:
@@ -3293,8 +3310,7 @@ class IOTWeb_connect_btProtoCol(ProtoCol):
         if "data" in msg:
             mac = msg["data"]
             # mac = "75:e8:8c:62:9a:df"
-            # mac = "36:72:cc:b4:58:a9"
-            # mac = "a9:58:b4:cc:72:36"
+            # mac = "36:72:cc:e6:dd:e8"
             if len(mac) == 17:
                 ok = 1
                 EventMesh.publish("send_connect_bt_mac",mac)