From 747328c8f780d46ca16c94875481435a6a99464c Mon Sep 17 00:00:00 2001 From: geeksville Date: Sat, 6 Jun 2020 13:12:40 -0700 Subject: [PATCH] Updates to work with 32 bit nodenums --- meshtastic/__init__.py | 8 +++++--- meshtastic/__main__.py | 2 +- meshtastic/test.py | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/meshtastic/__init__.py b/meshtastic/__init__.py index 24a1dec..c5aad39 100644 --- a/meshtastic/__init__.py +++ b/meshtastic/__init__.py @@ -64,8 +64,10 @@ START2 = 0xc3 HEADER_LEN = 4 MAX_TO_FROM_RADIO_SIZE = 512 -BROADCAST_ADDR = "all" # A special ID that means broadcast -BROADCAST_NUM = 255 +BROADCAST_ADDR = "^all" # A special ID that means broadcast + +# if using 8 bit nodenums this will be shortend on the target +BROADCAST_NUM = 0xffffffff MY_CONFIG_ID = 42 @@ -119,7 +121,7 @@ class MeshInterface: if isinstance(destinationId, int): nodeNum = destinationId elif destinationId == BROADCAST_ADDR: - nodeNum = 255 + nodeNum = BROADCAST_NUM else: nodeNum = self.nodes[destinationId].num diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 7159503..f741952 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -88,7 +88,7 @@ def main(): parser.add_argument("--setpref", help="Set a preferences field", nargs=2) parser.add_argument( - "--dest", help="The destination node id for the --send commands, if not set 'all' is assumed", default="all") + "--dest", help="The destination node id for the --send commands, if not set '^all' is assumed", default="^all") parser.add_argument( "--sendtext", help="Send a text message") diff --git a/meshtastic/test.py b/meshtastic/test.py index e117dba..42945e2 100644 --- a/meshtastic/test.py +++ b/meshtastic/test.py @@ -1,6 +1,6 @@ import logging from . import util -from . import StreamInterface +from . import StreamInterface, BROADCAST_NUM from pubsub import pub import time import sys @@ -55,7 +55,7 @@ def testSend(fromInterface, toInterface, isBroadcast=False): fromNode = fromInterface.myInfo.my_node_num if isBroadcast: - toNode = 255 + toNode = BROADCAST_NUM else: toNode = toInterface.myInfo.my_node_num