From 25e1baf1d13456ff2395c40ecc5397f01c347d9b Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Sat, 8 Jun 2024 07:44:13 -0700 Subject: [PATCH] fix multicasting to level 2 and 4 --- circuitpython_nrf24l01/network/constants.py | 5 +++++ circuitpython_nrf24l01/network/structs.py | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/circuitpython_nrf24l01/network/constants.py b/circuitpython_nrf24l01/network/constants.py index 524434d..ed30e05 100644 --- a/circuitpython_nrf24l01/network/constants.py +++ b/circuitpython_nrf24l01/network/constants.py @@ -29,6 +29,11 @@ NETWORK_DEFAULT_ADDR = const(0o4444) #: Primarily used by RF24Mesh. MAX_FRAG_SIZE = const(24) #: Maximum message size for a single frame's message. NETWORK_MULTICAST_ADDR = const(0o100) #: A reserved address for multicast messages. +#: A reserved address for multicast messages to level 2 +NETWORK_MULTICAST_ADDR_LVL_2 = const(0o10) +#: A reserved address for multicast messages to level 4 +NETWORK_MULTICAST_ADDR_LVL_4 = const(0o1000) + MESH_LOOKUP_TIMEOUT = const(135) #: Used for `lookup_address()` & `lookup_node_id()` MESH_MAX_POLL = const(4) #: The max number of contacts made during `renew_address()`. MESH_MAX_CHILDREN = const(4) #: The max number of children for 1 mesh node. diff --git a/circuitpython_nrf24l01/network/structs.py b/circuitpython_nrf24l01/network/structs.py index 1fe1393..5b782ad 100644 --- a/circuitpython_nrf24l01/network/structs.py +++ b/circuitpython_nrf24l01/network/structs.py @@ -31,6 +31,8 @@ from .constants import ( NETWORK_EXT_DATA, NETWORK_MULTICAST_ADDR, + NETWORK_MULTICAST_ADDR_LVL_2, + NETWORK_MULTICAST_ADDR_LVL_4, MSG_FRAG_FIRST, MSG_FRAG_MORE, MSG_FRAG_LAST, @@ -41,7 +43,11 @@ def is_address_valid(address: Optional[int]) -> bool: """Test if a given address is a valid :ref:`Logical Address `.""" if address is None: return False - if address == NETWORK_MULTICAST_ADDR: + if address in ( + NETWORK_MULTICAST_ADDR, + NETWORK_MULTICAST_ADDR_LVL_2, + NETWORK_MULTICAST_ADDR_LVL_4, + ): return True byte_count = 0 while address: