优化按键触发sos功能
authordxy <1731678236qq.com>
Fri, 15 Aug 2025 10:40:14 +0000 (18:40 +0800)
committerdxy <1731678236qq.com>
Fri, 15 Aug 2025 10:40:14 +0000 (18:40 +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 ce77c5b..9c5f2e0 100644 (file)
@@ -645,6 +645,7 @@ class AI_dev(Abstract):
         self.KeyAI_timer = osTimer()
         self.KeySOS_timer = osTimer()
         self.KeySOS_timer_count = 0
+        self.KeySOS_timer_flag = 0
         if dev_type == "G10" :
             self.extint_AI = ExtInt(ExtInt.GPIO19,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.keyAI_extint_cb)
             self.pwk_key = ExtInt(ExtInt.GPIO26, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.pwk_extint_cb)
@@ -997,11 +998,13 @@ class AI_dev(Abstract):
         print("AI_key_press")
         EventMesh.publish("AI_key_press")
     def KeySos_timer_cb(self,*argc):
+        self.KeySOS_timer_flag = 0
         if self.KeySOS_timer_count >= 3:
             self.KeySOS_timer_count = 0
             get_sos_flag = EventMesh.publish("get_sos_flag") 
             if get_sos_flag == 0:
                 EventMesh.publish("set_sos_info_call")
+        self.KeySOS_timer_count = 0
         pass
     def AI_key_long_press(self):
         self.check_rest_timer_count = 0
@@ -1011,8 +1014,11 @@ class AI_dev(Abstract):
         
     def AI_key_release(self):
         print("AI_key_release")
+        if self.KeySOS_timer_flag == 0:
+            self.KeySOS_timer_flag = 1
+            self.KeySOS_timer_count=0
+            self.KeySOS_timer.start(2000, 0, self.KeySos_timer_cb)
         self.KeySOS_timer_count +=1
-        self.KeySOS_timer.start(500, 0, self.KeySos_timer_cb)
         EventMesh.publish("AI_key_release")
         
     def pwk_key_Long_Press(self,event=None,msg=None):
index 56eca3b..2c34952 100644 (file)
@@ -383,15 +383,17 @@ class IOTWebLocationManager(Abstract):
     def close_location(self,event,msg):
         self.location_flag = 0
         if  wifiScan.getState() == True:
-            print("关闭定位线程失败")
             wifiScan.control(0)
         # self.timer_read_GPS_info.stop()
+        if self.location_queue.empty() == False:
+            self.location_queue.clear()
         if self.location_thread_id == 1:
             try:
                 _thread.stop_thread(self.location_thread_id)
             except Exception as e:
                 pass
         self.location_thread_id=0
+        print("close_location:!!!!!!!!!")