comment telemetry bits should always have 8bits

This commit is contained in:
Rossen Georgiev 2014-12-30 18:02:42 +00:00
parent 0773ee372a
commit 7514c0ce55
1 changed files with 6 additions and 6 deletions

View File

@ -757,7 +757,9 @@ def _parse_comment_telemetry(text):
Looks for base91 telemetry found in comment field
Returns [remaining_text, telemetry]
"""
parsed = {}
match = re.findall(r"^(.*?)\|([!-{]{4,14})\|(.*)$", text)
if match and len(match[0][1]) % 2 == 0:
text, telemetry, post = match[0]
text += post
@ -766,18 +768,16 @@ def _parse_comment_telemetry(text):
for i in range(7):
temp[i] = base91.to_decimal(telemetry[i*2:i*2+2])
parsed = {
parsed.update({
'telemetry': {
'seq': temp[0],
'vals': temp[1:6]
}
}
})
if temp[6] != '':
parsed['telemetry'].update({
'bits': "{0:08b}".format(int(temp[6]))
'bits': "{0:08b}".format(temp[6] & 0xFF)
})
return (text, parsed)
else:
return (text, {})
return (text, parsed)