minor speed improvements

This commit is contained in:
Junzi Sun 2019-10-16 16:24:38 +02:00
parent 9ad535dc93
commit fb24d4f25c

View File

@ -43,8 +43,8 @@ def np2bin(npbin):
def df(msg): def df(msg):
"""Decode Downlink Format vaule, bits 1 to 5.""" """Decode Downlink Format vaule, bits 1 to 5."""
msgbin = hex2bin(msg) dfbin = hex2bin(msg[:2])
return min(bin2int(msgbin[0:5]), 24) return min(bin2int(dfbin[0:5]), 24)
def crc(msg, encode=False): def crc(msg, encode=False):
@ -195,8 +195,8 @@ def typecode(msg):
if df(msg) not in (17, 18): if df(msg) not in (17, 18):
return None return None
msgbin = hex2bin(msg) tcbin = hex2bin(msg[8:10])
return bin2int(msgbin[32:37]) return bin2int(tcbin[0:5])
def cprNL(lat): def cprNL(lat):