Skip to content

Commit

Permalink
fix vertical rate
Browse files Browse the repository at this point in the history
  • Loading branch information
junzis committed Mar 9, 2018
1 parent fd8bb83 commit e692d30
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions pyModeS/ehs.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def rtrk50(msg):
if d[36:45] == "111111111":
return None

sign = int(d[35]) # 1 -> minus
sign = int(d[35]) # 1 -> negative value, two's complement
value = util.bin2int(d[36:45])
if sign:
value = value - 512
Expand Down Expand Up @@ -794,12 +794,15 @@ def vr53(msg):
if d[46] == '0':
return None

sign = int(d[47]) # 1 -> minus
sign = int(d[47]) # 1 -> negative value, two's complement
value = util.bin2int(d[48:56])

if sign:
value = value - 256
if value == 0 or value == 255: # all zeros or all ones
return 0

value = value - 256 if sign else value
roc = value * 64 # feet/min

return roc


Expand Down Expand Up @@ -925,11 +928,13 @@ def vr60baro(msg):
if d[34] == '0':
return None

sign = int(d[35]) # 1 -> minus
sign = int(d[35]) # 1 -> negative value, two's complement
value = util.bin2int(d[36:45])

if sign:
value = value - 512
if value == 0 or value == 511: # all zeros or all ones
return 0

value = value - 512 if sign else value

roc = value * 32 # feet/min
return roc
Expand All @@ -949,11 +954,13 @@ def vr60ins(msg):
if d[45] == '0':
return None

sign = int(d[46]) # 1 -> minus
sign = int(d[46]) # 1 -> negative value, two's complement
value = util.bin2int(d[47:56])

if sign:
value = value - 512
if value == 0 or value == 511: # all zeros or all ones
return 0

value = value - 512 if sign else value

roc = value * 32 # feet/min
return roc
Expand Down

0 comments on commit e692d30

Please sign in to comment.