fix bug in regex for parsing comment telemetry

This commit is contained in:
Rossen Georgiev 2014-11-22 09:22:43 +00:00
parent 130153917a
commit 0878f8f4ca
1 changed files with 4 additions and 3 deletions

View File

@ -756,9 +756,9 @@ def parse(raw_sentence):
parsed.update({ 'altitude': int(altitude)*0.3048 })
# try parse comment telemetry
match = re.findall(r"^(.*?)\|(([!-{]{2}){2,7})\|(.*)$", extra)
if match:
extra,telemetry,junk,post = match[0]
match = re.findall(r"^(.*?)\|([!-{]{2,14})\|(.*)$", extra)
if match and len(match[0][2]) % 2 == 0:
extra,telemetry,post = match[0]
extra += post
temp = []
@ -767,6 +767,7 @@ def parse(raw_sentence):
try:
temp[i] = base91(telemetry[i*2:i*2+2])
temp[i] = int(temp[i]) if temp[i].is_integer() else temp[i]
except:
continue