Skip to content

Commit eb45c16

Browse files
committed
Merge remote-tracking branch 'root/master' into pr-powermon2
# Conflicts: # meshtastic/mesh_interface.py
2 parents 8c63f4d + 3c772b5 commit eb45c16

5 files changed

Lines changed: 30 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- "3.9"
1717
- "3.10"
1818
- "3.11"
19+
- "3.12"
1920
steps:
2021
- uses: actions/checkout@v4
2122
- name: Install Python 3
@@ -58,6 +59,7 @@ jobs:
5859
- "3.9"
5960
- "3.10"
6061
- "3.11"
62+
- "3.12"
6163
steps:
6264
- uses: actions/checkout@v4
6365
- name: Install Python 3

meshtastic/mesh_interface.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,14 @@ def sendText(
371371
def sendData(
372372
self,
373373
data,
374-
destinationId: Union[int, str] = BROADCAST_ADDR,
375-
portNum: portnums_pb2.PortNum.ValueType = portnums_pb2.PortNum.PRIVATE_APP,
376-
wantAck: bool = False,
377-
wantResponse: bool = False,
378-
onResponse: Optional[Callable[[dict], Any]] = None,
379-
onResponseAckPermitted: bool = False,
380-
channelIndex: int = 0,
374+
destinationId: Union[int, str]=BROADCAST_ADDR,
375+
portNum: portnums_pb2.PortNum.ValueType=portnums_pb2.PortNum.PRIVATE_APP,
376+
wantAck: bool=False,
377+
wantResponse: bool=False,
378+
onResponse: Optional[Callable[[dict], Any]]=None,
379+
onResponseAckPermitted: bool=False,
380+
channelIndex: int=0,
381+
hopLimit: Optional[int]=None,
381382
):
382383
"""Send a data packet to some other node
383384
@@ -400,7 +401,8 @@ def sendData(
400401
for regular ACKs (True) or just data responses & NAKs (False)
401402
Note that if the onResponse callback is called 'onAckNak' this
402403
will implicitly be true.
403-
channelIndex - channel number to use
404+
channelIndex -- channel number to use
405+
hopLimit -- hop limit to use
404406
405407
Returns the sent packet. The id field will be populated in this packet
406408
and can be used to track future message acks/naks.
@@ -431,10 +433,8 @@ def sendData(
431433

432434
if onResponse is not None:
433435
logging.debug(f"Setting a response handler for requestId {meshPacket.id}")
434-
self._addResponseHandler(
435-
meshPacket.id, onResponse, ackPermitted=onResponseAckPermitted
436-
)
437-
p = self._sendPacket(meshPacket, destinationId, wantAck=wantAck)
436+
self._addResponseHandler(meshPacket.id, onResponse, ackPermitted=onResponseAckPermitted)
437+
p = self._sendPacket(meshPacket, destinationId, wantAck=wantAck, hopLimit=hopLimit)
438438
return p
439439

440440
def sendPosition(
@@ -539,6 +539,7 @@ def sendTraceRoute(
539539
wantResponse=True,
540540
onResponse=self.onResponseTraceRoute,
541541
channelIndex=channelIndex,
542+
hopLimit=hopLimit,
542543
)
543544
# extend timeout based on number of nodes, limit by configured hopLimit
544545
waitFactor = min(len(self.nodes) - 1 if self.nodes else 0, hopLimit)
@@ -645,8 +646,9 @@ def _addResponseHandler(
645646
def _sendPacket(
646647
self,
647648
meshPacket: mesh_pb2.MeshPacket,
648-
destinationId: Union[int, str] = BROADCAST_ADDR,
649-
wantAck: bool = False,
649+
destinationId: Union[int,str]=BROADCAST_ADDR,
650+
wantAck: bool=False,
651+
hopLimit: Optional[int]=None
650652
):
651653
"""Send a MeshPacket to the specified node (or if unspecified, broadcast).
652654
You probably don't want this - use sendData instead.
@@ -688,9 +690,12 @@ def _sendPacket(
688690

689691
meshPacket.to = nodeNum
690692
meshPacket.want_ack = wantAck
691-
loraConfig = getattr(self.localNode.localConfig, "lora")
692-
hopLimit = getattr(loraConfig, "hop_limit")
693-
meshPacket.hop_limit = hopLimit
693+
694+
if hopLimit is not None:
695+
meshPacket.hop_limit = hopLimit
696+
else:
697+
loraConfig = getattr(self.localNode.localConfig, "lora")
698+
meshPacket.hop_limit = getattr(loraConfig, "hop_limit")
694699

695700
# if the user hasn't set an ID for this packet (likely and recommended),
696701
# we should pick a new unique ID so the message can be tracked.

meshtastic/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def requestConfig(self, configType):
128128
print("Requesting current config from remote node (this can take a while).")
129129

130130
msgIndex = configType.index
131-
if configType.containing_type.full_name in ("meshtastic.LocalConfig", "LocalConfig"):
131+
if configType.containing_type.name == "LocalConfig":
132132
p = admin_pb2.AdminMessage()
133133
p.get_config_request = msgIndex
134134
self._sendAdmin(p, wantResponse=True, onResponse=onResponse)

poetry.lock

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "meshtastic"
3-
version = "2.3.13"
3+
version = "2.3.14"
44
description = "Python API & client shell for talking to Meshtastic devices"
55
authors = ["Meshtastic Developers <contact@meshtastic.org>"]
66
license = "GPL-3.0-only"

0 commit comments

Comments
 (0)