mirror of
https://github.com/opentx/opentx.git
synced 2025-07-13 11:29:51 +03:00
Align python crossfire parser to c equivalent (#5595)
Align python Crossfire parser to C equivalent
This commit is contained in:
parent
8be6818a6d
commit
95df593c2f
1 changed files with 3 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
|||
|
||||
from __future__ import division, print_function
|
||||
|
||||
import sys
|
||||
import sys, struct
|
||||
|
||||
lineNumber = 0
|
||||
crossfireDataBuff = []
|
||||
|
@ -77,7 +77,8 @@ def crc8(buffer):
|
|||
return crc
|
||||
|
||||
def ParseGPS(payload):
|
||||
pass
|
||||
lat, long, speed, head, alt, numsat = struct.unpack('>iiHHHB', bytes(bytearray(payload))) # bytes(bytearray) casting is required for python 2.7.3 compatibility
|
||||
return "[GPS] lat:%f long:%f speed:%d heading:%d alt:%d numsat:%d" % (lat / 1e7, long / 1e7, speed / 100, head / 100, alt - 1000, numsat)
|
||||
|
||||
def ParseBattery(payload):
|
||||
voltage = float((payload[0] << 8) + payload[1]) / 10
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue