From 426c9d9617d55d9538b5d451e0621b54e06b983b Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 13 Dec 2024 10:42:18 +0100 Subject: [PATCH] Updated GPS data struct packing. Fixes #58. --- sbapp/buildozer.spec | 2 +- sbapp/sideband/sense.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sbapp/buildozer.spec b/sbapp/buildozer.spec index 42cd319..09f9530 100644 --- a/sbapp/buildozer.spec +++ b/sbapp/buildozer.spec @@ -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 diff --git a/sbapp/sideband/sense.py b/sbapp/sideband/sense.py index 843149e..82b7ddb 100644 --- a/sbapp/sideband/sense.py +++ b/sbapp/sideband/sense.py @@ -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], }