G15 G10鉴权问题优化
authordxy15521469561 <1731678236@qq.com>
Mon, 25 Mar 2024 10:32:25 +0000 (18:32 +0800)
committerdxy15521469561 <1731678236@qq.com>
Mon, 25 Mar 2024 10:32:25 +0000 (18:32 +0800)
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/btn_device_ec800m_d15.py
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk/project/D10/sdk/services/microPython/ports/quectel/core/protocol.py

index 7da0e6c..30ec04f 100644 (file)
@@ -2547,9 +2547,12 @@ if EventMesh.model == "D15" :
             self.extint_22 = 0
             self.GPIO22_status = 1
 
-            self.extint_17= 1
+            self.extint_17 = 0
             self.KeyCall2_status = 1
 
+            self.extint_7 = 1
+            self.extint_8 = 1
+
             self.extint_19= 0
             self.KeyCall1_status = 1
 
@@ -2630,14 +2633,14 @@ if EventMesh.model == "D15" :
             self.extint_19 = ExtInt(ExtInt.GPIO19,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.key19_extint_cb)
             self.extint_19.enable()
 
-            self.extint_17 = ExtInt(ExtInt.GPIO17,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.key17_extint_cb)
+            self.extint_17 = ExtInt(ExtInt.GPIO7,ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.key17_extint_cb)
             self.extint_17.enable()
 
             self.wechatKey = ExtInt(ExtInt.GPIO22, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_PU, self.wechatKey_extint_cb)
             self.wechatKey.enable()
 
-
         def key17_extint_cb(self,args):#call 1
+            # EventMesh.debug_log('key17_extint_cb :{}'.format(args))
             open_power = EventMesh.publish("get_power_on_state")#获取开机标识
             open_power_off = EventMesh.publish("get_power_off_state")#获取开机标识
             video_state = EventMesh.publish("get_video_state")#获取视频通话状态 5在通话状态不允许按键输入
@@ -2795,7 +2798,7 @@ if EventMesh.model == "D15" :
                     return
             flag = EventMesh.publish("get_call_state")#在通话或者电话拨进 或者拨出不允许寻找设备
             fall_down = EventMesh.publish("get_fall_down_state")#跌倒报警标识
-            # print("call2Key_timeout_cb",self.Keycall2_press_count,flag)
+            print("call2Key_timeout_cb",self.Keycall2_press_count,flag)
             if self.Keycall1_press_count > 1:#
                 if fall_down != None:
                     if fall_down != 0 or flag != 0 or video_state != 0:#在打电话或者跌倒报警提醒中不允许按键触发
index d71139f..726f50a 100644 (file)
@@ -796,6 +796,8 @@ if EventMesh.model == "D10":
             self.upload_time = 0
             self.UD_timeout = 7*60
 
+            self.low_power_AL = 0
+
             self.temp_time = 0
             self.temp_state = 0
             self.temp_one_state = 0
@@ -1231,7 +1233,18 @@ if EventMesh.model == "D10":
             if battery[0] != '1':
                 if battery[1] == 0:
                     EventMesh.publish("open_power_on",2)#  #未检测到sim卡15分钟后关机
-            
+                """"低电报警"""
+                if battery[1] <= 15 and self.low_power_AL==0:
+                    self.low_power_AL = 1
+                    dev_state =  EventMesh.publish("get_dev_state")
+
+                    tmp = 1 << 17
+                    dev_state = dev_state|tmp #第17位=1
+                    EventMesh.publish("set_dev_state",dev_state)
+                    EventMesh.publish(constants.EVENT.START_LOCATION,[constants.PROTOCOL.AL_SEND,dev_state]) #开始AL定位
+            if battery[1] >= 50:
+                self.low_power_AL = 0
+
             """未联网提示关机"""
             ble=EventMesh.publish(constants.EVENT.GET_CONNECT)
             # EventMesh.debug_log("ble",ble)
index 54fbeff..8330664 100644 (file)
@@ -203,9 +203,12 @@ class SockManager(Abstract):
             #self.sock.setblocking(False) &self.sock.settimeout(0)不阻塞
             self.sock.connect((self.server_addr, self.server_port))
             
-            #utime.sleep_ms(500)
+            self.publish_timer.start(2000, 1, self.publish_timer_cb)
+            
+            utime.sleep_ms(500)
+            EventMesh.publish(constants.PROTOCOL.LK_SEND)
             #  发送数据
-            self.publish_timer.start(1000, 0, self.publish_timer_cb)
+            
             
         except Exception as e:
             usys.print_exception(e)
@@ -215,7 +218,7 @@ class SockManager(Abstract):
         EventMesh.debug_log("connect2{}:{}".format(self.server_addr, self.server_port))
         self.reconnect_flag = 0
     def publish_timer_cb(self, *args):
-        EventMesh.publish(constants.PROTOCOL.LK_SEND)
+        
         self.authen_set()
 
     def authen_set(self):
@@ -305,7 +308,8 @@ class SockManager(Abstract):
                                         print("self.reconnect_flag",self.reconnect_flag)
                                         self.reconnect_flag = 0
                                         self.reconnect()#重连设备
-                EventMesh.publish("set_server_state",1)#获取修改服务器状态
+                    self.publish_timer.stop()
+                    EventMesh.publish("set_server_state",1)#获取修改服务器状态
         
         
     def check(self, *args):