Updated GPS data struct packing. Fixes #58.

This commit is contained in:
Mark Qvist 2024-12-13 10:42:18 +01:00
parent bc8dcb82a3
commit 426c9d9617
2 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@ source.exclude_patterns = app_storage/*,venv/*,Makefile,./Makefil*,requirements,
version.regex = __version__ = ['"](.*)['"]
version.filename = %(source.dir)s/main.py
android.numeric_version = 20241020
android.numeric_version = 20241213
requirements = kivy==2.3.0,libbz2,pillow==10.2.0,qrcode==7.3.1,usb4a,usbserial4a,able_recipe,libwebp,libogg,libopus,opusfile,numpy,cryptography,ffpyplayer,codec2,pycodec2,sh,pynacl,typing-extensions

View File

@ -778,9 +778,9 @@ class Location(Sensor):
return [
struct.pack("!i", int(round(d["latitude"], 6)*1e6)),
struct.pack("!i", int(round(d["longitude"], 6)*1e6)),
struct.pack("!I", int(round(d["altitude"], 2)*1e2)),
struct.pack("!i", int(round(d["altitude"], 2)*1e2)),
struct.pack("!I", int(round(d["speed"], 2)*1e2)),
struct.pack("!I", int(round(d["bearing"], 2)*1e2)),
struct.pack("!i", int(round(d["bearing"], 2)*1e2)),
struct.pack("!H", int(round(d["accuracy"], 2)*1e2)),
d["last_update"],
]
@ -796,9 +796,9 @@ class Location(Sensor):
return {
"latitude": struct.unpack("!i", packed[0])[0]/1e6,
"longitude": struct.unpack("!i", packed[1])[0]/1e6,
"altitude": struct.unpack("!I", packed[2])[0]/1e2,
"altitude": struct.unpack("!i", packed[2])[0]/1e2,
"speed": struct.unpack("!I", packed[3])[0]/1e2,
"bearing": struct.unpack("!I", packed[4])[0]/1e2,
"bearing": struct.unpack("!i", packed[4])[0]/1e2,
"accuracy": struct.unpack("!H", packed[5])[0]/1e2,
"last_update": packed[6],
}