Skip to content

Commit e8dfee8

Browse files
committed
Fix rounding of position values when converting from integer to float in _fixupPosition. Fixes #572
1 parent 4d67e7f commit e8dfee8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

meshtastic/mesh_interface.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import threading
1010
import time
1111
from datetime import datetime
12+
from decimal import Decimal
1213

1314
from typing import Any, Callable, Dict, List, Optional, Union
1415

@@ -978,9 +979,9 @@ def _fixupPosition(self, position: Dict) -> Dict:
978979
Returns the position with the updated keys
979980
"""
980981
if "latitudeI" in position:
981-
position["latitude"] = position["latitudeI"] * 1e-7
982+
position["latitude"] = float(position["latitudeI"] * Decimal("1e-7"))
982983
if "longitudeI" in position:
983-
position["longitude"] = position["longitudeI"] * 1e-7
984+
position["longitude"] = float(position["longitudeI"] * Decimal("1e-7"))
984985
return position
985986

986987
def _nodeNumToId(self, num):

0 commit comments

Comments
 (0)