Skip to content

Commit

Permalink
fix multicasting to level 2 and 4
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jun 8, 2024
1 parent fc69216 commit 1118da8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions circuitpython_nrf24l01/network/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion circuitpython_nrf24l01/network/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -41,7 +43,11 @@ def is_address_valid(address: Optional[int]) -> bool:
"""Test if a given address is a valid :ref:`Logical Address <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:
Expand Down

0 comments on commit 1118da8

Please sign in to comment.