Skip to content

Commit b1581d4

Browse files
author
ymj-123
committed
fix: log configuration just for INS app
1 parent 4810e7c commit b1581d4

File tree

2 files changed

+40
-36
lines changed

2 files changed

+40
-36
lines changed

openrtk_data_parse/openrtk_parse.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ def __init__(self, data_file, path):
201201

202202
self.time_tag = None # in packet's head
203203

204+
self.err_count = 0
205+
204206
with open('openrtk_packets.json') as json_data:
205207
self.rtk_properties = json.load(json_data)
206208

@@ -225,7 +227,8 @@ def start_pasre(self):
225227
self.packet_buffer = []
226228
self.sync_state = 0
227229
else:
228-
print('debug data crc err!')
230+
self.err_count = self.err_count + 1
231+
print('debug data crc err. type {0} count{1}'.format(packet_type, self.err_count))
229232
self.sync_state = 0 # CRC did not match
230233
else:
231234
for message_id in self.debugPacketsTypeList:

src/aceinna/devices/openrtk/uart_provider.py

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -183,41 +183,42 @@ def on_read_raw(self, data):
183183
def thread_debug_port_receiver(self, *args, **kwargs):
184184
if self.debug_logf is None:
185185
return
186-
is_get_configuration = 0
187-
file_name = args[0]
188-
self.debug_c_f = open(file_name + '/' + 'configuration.txt',"w")
189-
190-
while True:
191-
if is_get_configuration:
192-
break
193-
cmd_configuration = 'get configuration\r'
194-
self.debug_serial_port.write(cmd_configuration.encode())
195-
try_times = 20
196-
for i in range(try_times):
197-
data_buffer = self.debug_serial_port.read(500)
198-
if len(data_buffer):
199-
try:
200-
#print('len = {0}'.format(len(data_buffer)))
201-
str_data = bytes.decode(data_buffer)
202-
#print('{0}'.format(str_data))
203-
json_data = json.loads(data_buffer)
204-
for key in json_data.keys():
205-
if key == 'openrtk configuration':
206-
print('{0}'.format(json_data))
207-
if self.debug_c_f:
208-
self.debug_c_f.write(str_data)
209-
self.debug_c_f.close()
210-
is_get_configuration = 1
211-
if is_get_configuration:
212-
break
213-
except Exception as e:
214-
#print('DEBUG PORT Thread:json error:', e)
215-
#the json will not be completed
216-
pass
217-
218-
219-
cmd_log = 'log com3 P1\r'
220-
self.debug_serial_port.write(cmd_log.encode())
186+
187+
if self.app_info['app_name'] == 'INS':
188+
is_get_configuration = 0
189+
file_name = args[0]
190+
self.debug_c_f = open(file_name + '/' + 'configuration.txt',"w")
191+
192+
while True:
193+
if is_get_configuration:
194+
break
195+
cmd_configuration = 'get configuration\r'
196+
self.debug_serial_port.write(cmd_configuration.encode())
197+
try_times = 20
198+
for i in range(try_times):
199+
data_buffer = self.debug_serial_port.read(500)
200+
if len(data_buffer):
201+
try:
202+
#print('len = {0}'.format(len(data_buffer)))
203+
str_data = bytes.decode(data_buffer)
204+
#print('{0}'.format(str_data))
205+
json_data = json.loads(data_buffer)
206+
for key in json_data.keys():
207+
if key == 'openrtk configuration':
208+
print('{0}'.format(json_data))
209+
if self.debug_c_f:
210+
self.debug_c_f.write(str_data)
211+
self.debug_c_f.close()
212+
is_get_configuration = 1
213+
if is_get_configuration:
214+
break
215+
except Exception as e:
216+
#print('DEBUG PORT Thread:json error:', e)
217+
#the json will not be completed
218+
pass
219+
220+
cmd_log = 'log com3 P1\r'
221+
self.debug_serial_port.write(cmd_log.encode())
221222

222223
# log data
223224
while True:

0 commit comments

Comments
 (0)