日志修改
authorp15692025051 <846603105@qq.com>
Mon, 4 Sep 2023 01:27:54 +0000 (09:27 +0800)
committerp15692025051 <846603105@qq.com>
Mon, 4 Sep 2023 01:27:54 +0000 (09:27 +0800)
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/EventMesh.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appFactoryMode.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py

index e53be13..f9cb241 100644 (file)
@@ -79,12 +79,12 @@ def set_log(log_adapter):
 def add_filter(flt):
     event_store.add_filter(flt)
 import utime
-Txt_Log = 0
+Txt_Log = 1
 def txt_log(data):
     if Txt_Log != 0 :
         with open("/ext/log.txt","a",encoding="utf-8") as fd:
             d_time = utime.localtime()
-            data_tmp = "{}-{} {}:{}:{} :".format(d_time[1],d_time[2],d_time[3],d_time[4],d_time[5])
+            data_tmp = "%02d-%02d %02d:%02d:%02d :"%(d_time[1],d_time[2],d_time[3],d_time[4],d_time[5])
             fd.write(data_tmp+data+"\n")
 
 def callback_wrapper(callback):#按键回调
index f097d1e..cf7b03c 100644 (file)
@@ -510,6 +510,7 @@ class FactoryModeLocationScreen(Screen):
                     if rmc_tmp[2] == 'A':
                         if self.GNSS_status == 0:
                             self.time_GNSS =  time_tmp-self.time_count
+                            EventMesh.txt_log("test location time:{}".format(self.time_GNSS))
                         self.GNSS_status = 1
                     else:
                         self.GNSS_status = 0
index e8e398e..f7fdbdd 100644 (file)
@@ -19,6 +19,7 @@ class BtnDevice(Abstract):
         self.pwk_press = 0
         self.pwk_count = 0
         self.GPIO26_status = 0
+        self.GPIO26_flag = 0
         self.powerKey_status = 0
         self.pin_timer = osTimer()
 
@@ -60,6 +61,7 @@ class BtnDevice(Abstract):
                         EventMesh.publish("btn8_press")
                     self.pwk_count = 0
                     self.pwk_press = 0
+                    self.GPIO26_flag = 1
                     
             # if self.pwk_count > (self.__PowerDownTimeOut//100): #长按
             #     # self.__pwk_timer.stop()
@@ -70,7 +72,8 @@ class BtnDevice(Abstract):
                 self.__pwk_timer.stop()
                 self.pwk_count = 0
                 self.pwk_press = 0
-                Power.powerDown()
+                if self.GPIO26_flag == 1:
+                    Power.powerDown()
 
     def __ui_callback(self, para):
        # print("para = {}".format(para))
index 0b00f13..8670127 100644 (file)
@@ -849,7 +849,7 @@ class DeviceInfoManager(Abstract):
             if  math.fabs(time_tmp - self.UD_time) > self.upload_time: #30分钟一次定位
                 self.UD_time = time_tmp
                 status_tmp = self.gsensor.get_status()#获取运动次数
-                EventMesh.txt_log("status_count:{}".format(status_tmp))
+                #EventMesh.txt_log("status_count:{}".format(status_tmp))
                 if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and status_tmp > 3 :
                     EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.UD_SEND) #开始UD定位
                     self.gsensor.clean_status()#清除运动次数
index 641c964..fc8ab9b 100644 (file)
@@ -25,7 +25,7 @@ import usys
 def server_init(server_type = None):
     #服务器选择1,防走丢,2大锤,3三基同创,4童信
     if server_type == None:
-        server_type = 4
+        server_type = 1
     #print("server_init:server_type:{}".format(server_type))
     d_server_addr = "api.xcloudtech.com"
     d_server_port = 9000
@@ -51,6 +51,11 @@ def server_init(server_type = None):
     elif  server_type == 4:
          d_server_addr = "tcp.tx.kidxin.com"
          d_server_port = 20500
+    elif server_type == 5:
+        d_server_addr = "device.miwitracker.com"
+        d_server_port = 8505
+        d_md5_key = ""
+        d_PID = "3G"
     return [d_server_addr,d_server_port,d_md5_key,d_PID]
 from queue import Queue
 def unicode_to_utf8(src):
@@ -539,10 +544,10 @@ class UD_ProtoCol(ProtoCol):
         #wt_data = "%s"%(send_data)
         send_data = self.PID+"*%s*%04X*%s"%(self.imei,send_len,send_data)
         MD5_head_data = self.PID+"*%s*%04X*%s"%(self.imei,send_len,"UD")
-        print("UD:MD5_head_data:{}".format(MD5_head_data))
+        
         MD5_SIGN = self.pack_MD5_head(MD5_head_data)
         data = "[%s%s]"%(str(MD5_SIGN),send_data)
-
+        print("UD:data:{}".format(data))
         # wt_data = EventMesh.publish("get_weather_data")
         # # #如果没有天气数据,则获取天气数据
         # if wt_data != None or wt_data[0] == None :