From: p15692025051 <846603105@qq.com> Date: Tue, 26 Sep 2023 07:28:23 +0000 (+0800) Subject: K5工厂模式gps测试修改 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=9b1b6e223106033ab630f2084e6eb1bdc1cef507;p=mirrors%2FASR1603_G5.git K5工厂模式gps测试修改 --- diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appFactoryMode.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appFactoryMode.py index e9a232e4..a017c353 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appFactoryMode.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/appFactoryMode.py @@ -495,12 +495,13 @@ class FactoryModeLocationScreen(Screen): def timer_FactoryModeLocation_cb(self, *args, **kwargs): EventMesh.publish("system_sleep_rest")#防止黑屏 self.timer_c += 1 - if self.timer_c >= 5: + if self.timer_c >= 7: get_location_flag = EventMesh.publish("get_location_flag") self.timer_c = 0 if get_location_flag != None: if(get_location_flag == 0): EventMesh.publish(constants.EVENT.START_LOCATION_TEST) #测试模式 + self.time_count = utime.mktime(utime.localtime()) def GET_LOCATION_DATA(self, event, msg): # print("GPS:{}".format(msg[0])) @@ -513,43 +514,19 @@ class FactoryModeLocationScreen(Screen): if len(msg[0]) > 1 : #GPS GNSS_DATA = "GNSS:------\n" - - - rmc_data = msg[0][1].split("RMC") - gsv_data = msg[0][1].split("GSV") - if len(rmc_data) >= 2 : - rmc_data = rmc_data[1:] - rmc_data = rmc_data[0].split("\r\n") - rmc_tmp = rmc_data[0].split(",") - if len(rmc_tmp) >= 2: - GNSS_DATA = GNSS_DATA + "{},{},{}\n".format(rmc_tmp[2],rmc_tmp[3],rmc_tmp[5]) - 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.time_count = utime.mktime(utime.localtime()) - self.GNSS_status = 1 - else: - self.GNSS_status = 0 - #self.time_GNSS = 0 - _DATA += "定位时间:{};{}秒\n".format(self.time_GNSS,time_tmp-self.time_count) - if len(gsv_data) >= 2 : - gsv_data = gsv_data[1:] - GSV_dict= {} - for i in range(len(gsv_data)) : - gsv_data[i] = gsv_data[i].split("\r\n")[0] - gsv_tmp = gsv_data[i].split(",") - if len(gsv_tmp) < 7 : - break - gsv_tmp = gsv_tmp[4:] - #print("gsv_tmp:{}".format(gsv_tmp)) - for i in range(len(gsv_tmp)) : - if i % 4 == 0: - GSV_dict[gsv_tmp[i]] = gsv_tmp[i+3] - #print("GSV_dict:{}:[{}]".format(gsv_tmp[i],gsv_tmp[i+3])) - if len(gsv_tmp)-i < 4: - break + gnss_data = msg[0][0] + if gnss_data : + GNSS_DATA = GNSS_DATA + "{},{},{}\n".format("A",gnss_data["latitude"],gnss_data["longitude"]) + + self.time_GNSS = time_tmp-self.time_count + EventMesh.txt_log("test location time:{}".format(self.time_GNSS)) + self.time_count = utime.mktime(utime.localtime()) + else: + + GNSS_DATA = GNSS_DATA + "{},{},{}\n".format("V",0,0) + _DATA += "定位时间:{};{}秒\n".format(self.time_GNSS,time_tmp-self.time_count) + GSV_dict = msg[0][1] + if GSV_dict : count = 0 try: for j in range(200): @@ -564,7 +541,7 @@ class FactoryModeLocationScreen(Screen): if count % 2 == 0: GNSS_DATA+="\n" - if count > 30: + if count > 50: break except Exception as e: usys.print_exception(e) diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py index 2b45fc0c..71c208a0 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/mgr.py @@ -2072,6 +2072,7 @@ class LocationManager(Abstract): #EventMesh.txt_log("START_LOCATION") # pm.autosleep(0)#唤醒 # pm.sclkEx_set(0, 1, 5) + GSV_dict= {} while self.location_flag == 1: try : @@ -2084,7 +2085,7 @@ class LocationManager(Abstract): if self.location_check_data_timer_count >= 5 :#5秒查一次基站数据和wifi数据 self.location_check_data_timer_count = 0 #print(self.location_timer_count) - #GSV_dict= {} + GSV_dict= {} #检查GNSS数据 if ( self.gps_data == {} or self.location_type == 1) and quecgnss.get_state() == 2: @@ -2111,7 +2112,7 @@ class LocationManager(Abstract): #print("gsv_tmp:{}".format(gsv_tmp)) for i in range(len(gsv_tmp)) : if i % 4 == 0: - #GSV_dict[gsv_tmp[i]] = gsv_tmp[i+3] + GSV_dict[gsv_tmp[i]] = gsv_tmp[i+3] try: #print("gsv_tmp[i+3]:{}".format(gsv_tmp[i+3])) if gsv_tmp[i+3] != "" : @@ -2217,7 +2218,7 @@ class LocationManager(Abstract): self.location_timer_count = 0 if len(gnss_r_data) >= 1: if gnss_r_data[0] > 0: - EventMesh.publish("PUSH_LOCATION_DATA", [gnss_r_data,self.wifi_data,self.cell_data]) + EventMesh.publish("PUSH_LOCATION_DATA", [[self.gps_data,GSV_dict],self.wifi_data,self.cell_data]) if self.gps_data != {} : #发送数据 EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位 self.location_queue.put(constants.PROTOCOL.UD_SEND) diff --git a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py index a67dd15b..cf37e500 100644 --- a/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/protocol.py @@ -311,7 +311,7 @@ class NetManager(Abstract): count = 0 while True: count += 1 - if count > 5 : + if count > 3 : return data = dataCall.getInfo(1, 0) print("data call INFO {}".format(data))