From e8dfee84542debe73b224614b37db2ad0dc4bae0 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Fri, 31 May 2024 18:57:30 -0700 Subject: [PATCH] Fix rounding of position values when converting from integer to float in _fixupPosition. Fixes #572 --- meshtastic/mesh_interface.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 7d7495e..1c24fb9 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -9,6 +9,7 @@ import sys import threading import time from datetime import datetime +from decimal import Decimal from typing import Any, Callable, Dict, List, Optional, Union @@ -978,9 +979,9 @@ class MeshInterface: Returns the position with the updated keys """ if "latitudeI" in position: - position["latitude"] = position["latitudeI"] * 1e-7 + position["latitude"] = float(position["latitudeI"] * Decimal("1e-7")) if "longitudeI" in position: - position["longitude"] = position["longitudeI"] * 1e-7 + position["longitude"] = float(position["longitudeI"] * Decimal("1e-7")) return position def _nodeNumToId(self, num):