Skip to content

Commit

Permalink
Bump the rf24-submodules group across 1 directory with 3 updates (#75)
Browse files Browse the repository at this point in the history
* Bump the rf24-submodules group across 1 directory with 3 updates

Bumps the rf24-submodules group with 3 updates in the / directory: [RF24](https://github.com/nRF24/RF24), [RF24Network](https://github.com/nRF24/RF24Network) and [RF24Mesh](https://github.com/nRF24/RF24Mesh).


Updates `RF24` from `0aac3d5` to `bbffb50`
- [Release notes](https://github.com/nRF24/RF24/releases)
- [Commits](nRF24/RF24@0aac3d5...bbffb50)

Updates `RF24Network` from `219d055` to `bdd05ae`
- [Release notes](https://github.com/nRF24/RF24Network/releases)
- [Commits](nRF24/RF24Network@219d055...bdd05ae)

Updates `RF24Mesh` from `8f030b4` to `2f5aea2`
- [Release notes](https://github.com/nRF24/RF24Mesh/releases)
- [Commits](nRF24/RF24Mesh@8f030b4...2f5aea2)

---
updated-dependencies:
- dependency-name: RF24
  dependency-type: direct:production
  dependency-group: rf24-submodules
- dependency-name: RF24Network
  dependency-type: direct:production
  dependency-group: rf24-submodules
- dependency-name: RF24Mesh
  dependency-type: direct:production
  dependency-group: rf24-submodules
...

Signed-off-by: dependabot[bot] <[email protected]>

* expose binding for new releaseAddress() overload

For master nodes only

* [CMake] add support for new flags

- support RF24MESH_CONN_CHECK_TYPE flag
- support MESH_CONNECTION_CHECK_ATTEMPTS flag

also reviewed using_flags.cmake script

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brendan <[email protected]>
  • Loading branch information
dependabot[bot] and 2bndy5 authored Jul 5, 2024
1 parent 616cd35 commit 5f740ab
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 28 deletions.
58 changes: 39 additions & 19 deletions cmake/using_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ option(RF24MESH_DEBUG_MINIMAL "enable/disable minimal debugging output for RF24M

# ### options with default values:

# RF24MESH_CONN_CHECK_TYPE
# This can be used to control how RF24Mesh.check_connection() behaves.
# By default, check_connection() will simply ping the parent node (if any).
# Setting this to RF24MESH_CONN_CHECK_MASTER will resort to the old behavior
# which verified the assigned address with the master node.
# It is recommended that this be left as default for large mesh networks.

# MESH_CONNECTION_CHECK_ATTEMPTS
# the number of attempts to check_connection() with the mesh. Defaults to 3

# MESH_MAX_CHILDREN
# This can be used to prevent mesh child nodes from occupying all available pipes on network layers.
# Only recommended if combining RF24Network nodes w/ RF24Mesh nodes on the same network.
Expand Down Expand Up @@ -65,99 +75,109 @@ option(RF24MESH_DEBUG_MINIMAL "enable/disable minimal debugging output for RF24M
function(apply_flags target)
# apply RF24 flags to cpp_rf24 target
if(RF24_DEBUG)
message(STATUS "RF24_DEBUG asserted for ${target}")
target_compile_definitions(${target} PUBLIC SERIAL_DEBUG)
message(STATUS "RF24_DEBUG asserted")
target_compile_definitions(${target} PUBLIC RF24_DEBUG)
endif()

# pass driver used to expose as a constant in rf24 module.
target_compile_definitions(${target} PUBLIC RF24_DRIVER="${RF24_DRIVER}")

# apply RF24Network flags to cpp_rf24_network target
if(RF24NETWORK_DEBUG)
message(STATUS "RF24NETWORK_DEBUG asserted for ${target}")
message(STATUS "RF24NETWORK_DEBUG asserted")
target_compile_definitions(${target} PUBLIC RF24NETWORK_DEBUG)
endif()

if(RF24NETWORK_DEBUG_MINIMAL)
message(STATUS "RF24NETWORK_DEBUG_MINIMAL asserted for ${target}")
message(STATUS "RF24NETWORK_DEBUG_MINIMAL asserted")
target_compile_definitions(${target} PUBLIC RF24NETWORK_DEBUG_MINIMAL)
endif()

if(RF24NETWORK_DEBUG_ROUTING)
message(STATUS "RF24NETWORK_DEBUG_ROUTING asserted for ${target}")
message(STATUS "RF24NETWORK_DEBUG_ROUTING asserted")
target_compile_definitions(${target} PUBLIC RF24NETWORK_DEBUG_ROUTING)
endif()

if(RF24NETWORK_DEBUG_FRAGMENTATION)
message(STATUS "RF24NETWORK_DEBUG_FRAGMENTATION asserted for ${target}")
message(STATUS "RF24NETWORK_DEBUG_FRAGMENTATION asserted")
target_compile_definitions(${target} PUBLIC RF24NETWORK_DEBUG_FRAGMENTATION)
endif()

if(RF24NETWORK_DEBUG_FRAGMENTATION_L2)
message(STATUS "RF24NETWORK_DEBUG_FRAGMENTATION_L2 asserted for ${target}")
message(STATUS "RF24NETWORK_DEBUG_FRAGMENTATION_L2 asserted")
target_compile_definitions(${target} PUBLIC RF24NETWORK_DEBUG_FRAGMENTATION_L2)
endif()

if(DISABLE_FRAGMENTATION)
message(STATUS "DISABLE_FRAGMENTATION asserted for ${target}")
message(STATUS "DISABLE_FRAGMENTATION asserted")
target_compile_definitions(${target} PUBLIC DISABLE_FRAGMENTATION)
endif()

# for MAX_PAYLOAD_SIZE, we let the default be configured in source code
if(DEFINED MAX_PAYLOAD_SIZE) # don't use CMake's `option()` for this one
message(STATUS "MAX_PAYLOAD_SIZE set to ${MAX_PAYLOAD_SIZE} for ${target}")
message(STATUS "MAX_PAYLOAD_SIZE set to ${MAX_PAYLOAD_SIZE}")
target_compile_definitions(${target} PUBLIC MAX_PAYLOAD_SIZE=${MAX_PAYLOAD_SIZE})
endif()

if(DEFINED SLOW_ADDR_POLL_RESPONSE)
message(STATUS "SLOW_ADDR_POLL_RESPONSE set to ${SLOW_ADDR_POLL_RESPONSE} for ${target}")
message(STATUS "SLOW_ADDR_POLL_RESPONSE set to ${SLOW_ADDR_POLL_RESPONSE}")
target_compile_definitions(${target} PUBLIC SLOW_ADDR_POLL_RESPONSE=${SLOW_ADDR_POLL_RESPONSE})
endif()

# apply RF24Mesh flags to cpp_rf24_mesh target
if(MESH_NOMASTER)
message(STATUS "MESH_NOMASTER asserted for ${target}")
message(STATUS "MESH_NOMASTER asserted")
target_compile_definitions(${target} PUBLIC MESH_NOMASTER)
endif()

if(RF24MESH_DEBUG)
message(STATUS "RF24MESH_DEBUG asserted for ${target}")
message(STATUS "RF24MESH_DEBUG asserted")
target_compile_definitions(${target} PUBLIC RF24MESH_DEBUG)
endif()

if(RF24MESH_DEBUG_MINIMAL)
message(STATUS "RF24MESH_DEBUG_MINIMAL asserted for ${target}")
message(STATUS "RF24MESH_DEBUG_MINIMAL asserted")
target_compile_definitions(${target} PUBLIC RF24MESH_DEBUG_MINIMAL)
endif()

# for the following, we let the default be configured in source code
if(DEFINED MESH_MAX_CHILDREN)
message(STATUS "MESH_MAX_CHILDREN set to ${MESH_MAX_CHILDREN} for ${target}")
message(STATUS "MESH_MAX_CHILDREN set to ${MESH_MAX_CHILDREN}")
target_compile_definitions(${target} PUBLIC MESH_MAX_CHILDREN=${MESH_MAX_CHILDREN})
endif()

if(DEFINED MESH_DEFAULT_CHANNEL)
message(STATUS "MESH_DEFAULT_CHANNEL set to ${MESH_DEFAULT_CHANNEL} for ${target}")
message(STATUS "MESH_DEFAULT_CHANNEL set to ${MESH_DEFAULT_CHANNEL}")
target_compile_definitions(${target} PUBLIC MESH_DEFAULT_CHANNEL=${MESH_DEFAULT_CHANNEL})
endif()

if(DEFINED MESH_RENEWAL_TIMEOUT)
message(STATUS "MESH_RENEWAL_TIMEOUT set to ${MESH_RENEWAL_TIMEOUT} for ${target}")
message(STATUS "MESH_RENEWAL_TIMEOUT set to ${MESH_RENEWAL_TIMEOUT}")
target_compile_definitions(${target} PUBLIC MESH_RENEWAL_TIMEOUT=${MESH_RENEWAL_TIMEOUT})
endif()

if(DEFINED MESH_MEM_ALLOC_SIZE)
message(STATUS "MESH_MEM_ALLOC_SIZE set to ${MESH_MEM_ALLOC_SIZE} for ${target}")
message(STATUS "MESH_MEM_ALLOC_SIZE set to ${MESH_MEM_ALLOC_SIZE}")
target_compile_definitions(${target} PUBLIC MESH_MEM_ALLOC_SIZE=${MESH_MEM_ALLOC_SIZE})
endif()

if(DEFINED MESH_LOOKUP_TIMEOUT)
message(STATUS "MESH_LOOKUP_TIMEOUT set to ${MESH_LOOKUP_TIMEOUT} for ${target}")
message(STATUS "MESH_LOOKUP_TIMEOUT set to ${MESH_LOOKUP_TIMEOUT}")
target_compile_definitions(${target} PUBLIC MESH_LOOKUP_TIMEOUT=${MESH_LOOKUP_TIMEOUT})
endif()

if(DEFINED MESH_WRITE_TIMEOUT)
message(STATUS "MESH_WRITE_TIMEOUT set to ${MESH_WRITE_TIMEOUT} for ${target}")
message(STATUS "MESH_WRITE_TIMEOUT set to ${MESH_WRITE_TIMEOUT}")
target_compile_definitions(${target} PUBLIC MESH_WRITE_TIMEOUT=${MESH_WRITE_TIMEOUT})
endif()

if(DEFINED RF24MESH_CONN_CHECK_TYPE)
message(STATUS "RF24MESH_CONN_CHECK_TYPE set to &{RF24MESH_CONN_CHECK_TYPE}")
target_compile_definitions(${target} PUBLIC RF24MESH_CONN_CHECK_TYPE=${RF24MESH_CONN_CHECK_TYPE})
endif()

if(DEFINED MESH_CONNECTION_CHECK_ATTEMPTS)
message(STATUS "MESH_CONNECTION_CHECK_ATTEMPTS set to &{MESH_CONNECTION_CHECK_ATTEMPTS}")
target_compile_definitions(${target} PUBLIC MESH_CONNECTION_CHECK_ATTEMPTS=${MESH_CONNECTION_CHECK_ATTEMPTS})
endif()
endfunction()
41 changes: 35 additions & 6 deletions src/pyRF24Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,22 +281,51 @@ void init_rf24mesh(py::module& m)

// *****************************************************************************

.def("release_address", &RF24MeshWrapper::releaseAddress, R"docstr(
release_address() -> bool
.def("release_address", static_cast<bool (RF24MeshWrapper::*)()>(&RF24MeshWrapper::releaseAddress), R"docstr(
release_address() -> bool \
release_address(address: int) -> bool
Use this function to manually expire a leased `Logical Address <logical_address>` from the mesh network's master node.
Use this function from a child node (without a parameter) to manually expire a leased `Logical Address <logical_address>`
from the mesh network's master node.
.. tip:: This function allows re-use of the assigned address for other mesh network nodes.
Call this function from mesh network nodes that are going offline (or to sleep).
:Returns: `True` if the mesh network's master node received the request to de-allocate
the assigned address. `False` means the wireless transaction did not complete.
:Returns:
- `True` if the mesh network's master node received the request to de-allocate
the assigned address.
- `False` means the wireless transaction did not complete.
)docstr")

.def("releaseAddress", &RF24MeshWrapper::releaseAddress, R"docstr(
.def("releaseAddress", static_cast<bool (RF24MeshWrapper::*)()>(&RF24MeshWrapper::releaseAddress), R"docstr(
releaseAddress() -> bool
)docstr")

// *****************************************************************************
#ifndef MESH_NOMASTER

.def("release_address", static_cast<bool (RF24MeshWrapper::*)(uint16_t)>(&RF24MeshWrapper::releaseAddress), R"docstr(
When called from the master node, this function takes a parameter and returns
without using wireless transactions.
.. hint::
This overloaded function signature is specific to master nodes,
so network administrators can manage assigned `Logical Addresses <logical_address>`
without notifying the nodes that might be appropriating them.
:param address: The `Logical Address <logical_address>` to release from any mesh node.
:Returns:
- `True` if successfully released the specified ``address``.
- `False` if the specified ``address`` was not assigned to any child node.
)docstr",
py::arg("address"))

.def("releaseAddress", static_cast<bool (RF24MeshWrapper::*)(uint16_t)>(&RF24MeshWrapper::releaseAddress), R"docstr(
releaseAddress(address: int) -> bool
)docstr",
py::arg("address"))

#endif
// *****************************************************************************

.def("get_address", &RF24MeshWrapper::getAddress, R"docstr(
Expand Down
6 changes: 6 additions & 0 deletions src/pyrf24/pyrf24.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,14 @@ class RF24Mesh:
def setNodeID(self) -> None: ...
def get_node_id(self, address: int) -> int: ...
def getNodeID(self, address: int) -> int: ...
@overload
def release_address(self) -> bool: ...
@overload
def release_address(self, address: int) -> bool: ...
@overload
def releaseAddress(self) -> bool: ...
@overload
def releaseAddress(self, address: int) -> bool: ...
def renew_address(self, timeout: int = 7500) -> int: ...
def renewAddress(self, timeout: int = 7500) -> int: ...
def set_channel(self, channel: int) -> None: ...
Expand Down

0 comments on commit 5f740ab

Please sign in to comment.