From: dxy <1731678236qq.com> Date: Fri, 15 Aug 2025 10:40:14 +0000 (+0800) Subject: 优化按键触发sos功能 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=d7606a24702665883337756d39ecd5916d3e4c35;p=mirrors%2FASR1603_G5.git 优化按键触发sos功能 --- 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 ce77c5b7..9c5f2e0b 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 @@ -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): diff --git a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py index 56eca3bb..2c349523 100644 --- a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py @@ -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:!!!!!!!!!")