From 140ee6f341492a3d582a8d6b0b98bd2d09822f0e Mon Sep 17 00:00:00 2001 From: Sudo-Ivan Date: Wed, 14 Jan 2026 12:39:51 -0600 Subject: [PATCH] Refactor telemetry data packing in Telemeter class - Simplified the packing of location data by removing unnecessary rounding operations. --- meshchatx/src/backend/telemetry_utils.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/meshchatx/src/backend/telemetry_utils.py b/meshchatx/src/backend/telemetry_utils.py index 8a8c2c0..8adaee3 100644 --- a/meshchatx/src/backend/telemetry_utils.py +++ b/meshchatx/src/backend/telemetry_utils.py @@ -64,12 +64,12 @@ class Telemeter: ): try: return [ - struct.pack("!i", int(round(latitude, 6) * 1e6)), - struct.pack("!i", int(round(longitude, 6) * 1e6)), - struct.pack("!i", int(round(altitude, 2) * 1e2)), - struct.pack("!I", int(round(speed, 2) * 1e2)), - struct.pack("!i", int(round(bearing, 2) * 1e2)), - struct.pack("!H", int(round(accuracy, 2) * 1e2)), + struct.pack("!i", int(round(latitude * 1e6))), + struct.pack("!i", int(round(longitude * 1e6))), + struct.pack("!i", int(round(altitude * 1e2))), + struct.pack("!I", int(round(speed * 1e2))), + struct.pack("!i", int(round(bearing * 1e2))), + struct.pack("!H", int(round(accuracy * 1e2))), int(last_update) if last_update is not None else int(time.time()), ] except Exception: @@ -100,7 +100,7 @@ class Telemeter: @staticmethod def pack(time_utc=None, location=None, battery=None, physical_link=None): p = {} - p[Sensor.SID_TIME] = int(time_utc or time.time()) + p[Sensor.SID_TIME] = int(time_utc if time_utc is not None else time.time()) if location: p[Sensor.SID_LOCATION] = Telemeter.pack_location(**location) if battery: