From 4500850063e0852519265f0b2262ba092c3bc61f Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 29 Aug 2024 22:29:20 -0500 Subject: [PATCH 1/3] Don't automatically set the time from Python The Python MO is to do as little as possible beyond what the user has intentionally instructed. So don't try to set the time automatically. --- meshtastic/mesh_interface.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index c59fcb3..fd09e65 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -472,11 +472,6 @@ class MeshInterface: # pylint: disable=R0902 p.altitude = int(altitude) logging.debug(f"p.altitude:{p.altitude}") - if timeSec == 0: - timeSec = int(time.time()) # returns unix timestamp in seconds - p.time = timeSec - logging.debug(f"p.time:{p.time}") - if wantResponse: onResponse = self.onResponsePosition else: From 428e9a228c1c43e32e55f5e7d4597d4d877ecb4f Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 29 Aug 2024 23:09:04 -0500 Subject: [PATCH 2/3] Remove unused time variable --- meshtastic/mesh_interface.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index fd09e65..91a8c1f 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -442,7 +442,6 @@ class MeshInterface: # pylint: disable=R0902 latitude: float = 0.0, longitude: float = 0.0, altitude: int = 0, - timeSec: int = 0, destinationId: Union[int, str] = BROADCAST_ADDR, wantAck: bool = False, wantResponse: bool = False, @@ -454,8 +453,6 @@ class MeshInterface: # pylint: disable=R0902 Also, the device software will notice this packet and use it to automatically set its notion of the local position. - If timeSec is not specified (recommended), we will use the local machine time. - Returns the sent packet. The id field will be populated in this packet and can be used to track future message acks/naks. """ From 5c312bedc190271b5c56d53967bb5097df2e1b2a Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Fri, 30 Aug 2024 01:15:40 -0500 Subject: [PATCH 3/3] Remove assert from test, due to removed position time --- meshtastic/tests/test_mesh_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/tests/test_mesh_interface.py b/meshtastic/tests/test_mesh_interface.py index f637c62..21f80c6 100644 --- a/meshtastic/tests/test_mesh_interface.py +++ b/meshtastic/tests/test_mesh_interface.py @@ -185,7 +185,7 @@ def test_sendPosition(caplog): with caplog.at_level(logging.DEBUG): iface.sendPosition() iface.close() - assert re.search(r"p.time:", caplog.text, re.MULTILINE) + # assert re.search(r"p.time:", caplog.text, re.MULTILINE) # TODO