2626 BROADCAST_ADDR ,
2727 BROADCAST_NUM ,
2828 LOCAL_ADDR ,
29+ NODELESS_WANT_CONFIG_ID ,
2930 ResponseHandler ,
3031 protocols ,
3132 publishingThread ,
4142)
4243
4344
44- class MeshInterface :
45+ class MeshInterface : # pylint: disable=R0902
4546 """Interface class for meshtastic devices
4647
4748 Properties:
@@ -57,12 +58,14 @@ def __init__(self, message):
5758 self .message = message
5859 super ().__init__ (self .message )
5960
60- def __init__ (self , debugOut = None , noProto : bool = False ) -> None :
61+ def __init__ (self , debugOut = None , noProto : bool = False , noNodes : bool = False ) -> None :
6162 """Constructor
6263
6364 Keyword Arguments:
6465 noProto -- If True, don't try to run our protocol on the
6566 link - just be a dumb serial client.
67+ noNodes -- If True, instruct the node to not send its nodedb
68+ on startup, just other configuration information.
6669 """
6770 self .debugOut = debugOut
6871 self .nodes : Optional [Dict [str ,Dict ]] = None # FIXME
@@ -81,7 +84,8 @@ def __init__(self, debugOut=None, noProto: bool=False) -> None:
8184 random .seed () # FIXME, we should not clobber the random seedval here, instead tell user they must call it
8285 self .currentPacketId : int = random .randint (0 , 0xFFFFFFFF )
8386 self .nodesByNum : Optional [Dict [int , Dict ]] = None
84- self .configId : Optional [int ] = None
87+ self .noNodes : bool = noNodes
88+ self .configId : Optional [int ] = NODELESS_WANT_CONFIG_ID if noNodes else None
8589 self .gotResponse : bool = False # used in gpio read
8690 self .mask : Optional [int ] = None # used in gpio read and gpio watch
8791 self .queueStatus : Optional [mesh_pb2 .QueueStatus ] = None
@@ -713,7 +717,8 @@ def _startConfig(self):
713717 self ._localChannels = [] # empty until we start getting channels pushed from the device (during config)
714718
715719 startConfig = mesh_pb2 .ToRadio ()
716- self .configId = random .randint (0 , 0xFFFFFFFF )
720+ if self .configId is None or not self .noNodes :
721+ self .configId = random .randint (0 , 0xFFFFFFFF )
717722 startConfig .want_config_id = self .configId
718723 self ._sendToRadio (startConfig )
719724
0 commit comments