fix conversion errors

This commit is contained in:
Jakob Ketterl 2019-08-16 16:43:16 +02:00
parent b40af9bbdc
commit 67f3dc7430

View File

@ -124,13 +124,13 @@ class AprsParser(object):
if information[10] != " ": if information[10] != " ":
if information[10] == "{": if information[10] == "{":
# pre-calculated radio range # pre-calculated radio range
aprsData["range"] = 2 * 1.08 ** (information[11] - 33) aprsData["range"] = 2 * 1.08 ** (ord(information[11]) - 33)
else: else:
aprsData["course"] = (information[10] - 33) * 4 aprsData["course"] = (ord(information[10]) - 33) * 4
# speed is in knots... convert to metric (km/h) # speed is in knots... convert to metric (km/h)
aprsData["speed"] = (1.08 ** (information[11] - 33) - 1) * speedConversionFactor aprsData["speed"] = (1.08 ** (ord(information[11]) - 33) - 1) * speedConversionFactor
# compression type # compression type
t = information[12] t = ord(information[12])
aprsData["fix"] = (t & 0b00100000) > 0 aprsData["fix"] = (t & 0b00100000) > 0
sources = ["other", "GLL", "GGA", "RMC"] sources = ["other", "GLL", "GGA", "RMC"]
aprsData["nmeasource"] = sources[(t & 0b00011000) >> 3] aprsData["nmeasource"] = sources[(t & 0b00011000) >> 3]