fix bug for alternative temperature

This commit is contained in:
Junzi Sun 2019-08-05 14:21:21 +02:00
parent 6f6b50776d
commit 17fdaca1c7

View File

@ -19,7 +19,13 @@
# ------------------------------------------
from __future__ import absolute_import, print_function, division
from pyModeS.decoder.common import hex2bin, bin2int, data, allzeros, wrongstatus
from pyModeS.decoder.common import (
hex2bin,
bin2int,
data,
allzeros,
wrongstatus,
)
def is44(msg):
@ -113,7 +119,7 @@ def temp44(msg):
temp = round(temp, 2)
temp_alternative = value * 0.125 # celsius
temp_alternative = round(temp, 3)
temp_alternative = round(temp_alternative, 3)
return temp, temp_alternative
@ -130,7 +136,7 @@ def p44(msg):
"""
d = hex2bin(data(msg))
if d[34] == '0':
if d[34] == "0":
return None
p = bin2int(d[35:46]) # hPa
@ -149,7 +155,7 @@ def hum44(msg):
"""
d = hex2bin(data(msg))
if d[49] == '0':
if d[49] == "0":
return None
hm = bin2int(d[50:56]) * 100.0 / 64 # %
@ -169,7 +175,7 @@ def turb44(msg):
"""
d = hex2bin(data(msg))
if d[46] == '0':
if d[46] == "0":
return None
turb = bin2int(d[47:49])