Add authorized-nodes filtering example to all master examples#265
Merged
Add authorized-nodes filtering example to all master examples#265
Conversation
Agent-Logs-Url: https://github.com/nRF24/RF24Mesh/sessions/dea77ba8-4d29-4b37-aa0d-63bfa0a58759 Co-authored-by: TMRh20 <2610460+TMRh20@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update master examples to include authorized-nodes filtering example
Add authorized-nodes filtering example to all master examples
Apr 23, 2026
Member
|
closes #264 |
Contributor
Memory usage change @ 76c4d06
Click for full report per board
|
| Sketch | Flash | % | RAM for global variables | % |
|---|---|---|---|---|
| examples/RF24Mesh_Example | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Master_Statics | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Master_To_Nodes | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Node2Node | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Node2NodeExtra | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_SerialConfig | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Master | 0 | 0 | 0 | 0 |
arduino:samd:mkrzero
| Sketch | Flash | % | RAM for global variables | % |
|---|---|---|---|---|
| examples/RF24Mesh_Example | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Master_Statics | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Master_To_Nodes | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Node2Node | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Node2NodeExtra | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_SerialConfig | 0 | 0 | 0 | 0 |
| examples/RF24Mesh_Example_Master | 0 | 0 | 0 | 0 |
Member
|
@copilot Change the words "The following code can be commented out in a production environment" to "The following code can be un-commented in a production environment" in this PR for all the changes |
…examples Agent-Logs-Url: https://github.com/nRF24/RF24Mesh/sessions/c7cfbf9f-3f75-43ca-b2b4-1dd42de4c136 Co-authored-by: TMRh20 <2610460+TMRh20@users.noreply.github.com>
Contributor
Author
2bndy5
approved these changes
Apr 23, 2026
Member
2bndy5
left a comment
There was a problem hiding this comment.
style mistake in the C++ comment: ; i< mesh., but the examples serve their purpose.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All master node examples lacked a reference pattern for restricting which node IDs are authorized to remain allocated in the mesh — a common production hardening step.
Adds a commented-out authorized-nodes filtering snippet immediately after every
mesh.DHCP()call across all six master example files, with indentation matching each file's style.Files updated:
examples/RF24Mesh_Example_Master/RF24Mesh_Example_Master.inoexamples/RF24Mesh_Example_Master_Statics/RF24Mesh_Example_Master_Statics.inoexamples/RF24Mesh_Example_Master_To_Nodes/RF24Mesh_Example_Master_To_Nodes.inoexamples_RPi/RF24Mesh_Example_Master.cppexamples_RPi/RF24Mesh_Example_Master.pyexamples_pico/RF24Mesh_Example_Master.cppC/C++ snippet (inserted after
mesh.DHCP();):Python equivalent (inserted after
mesh.DHCP()):No runtime behavior is changed; all new code is comment-only.
Original prompt
Update all master examples in repository
nRF24/RF24Meshto include an authorized-nodes filtering example immediately after the call tomesh.DHCP()(or the Python equivalent location directly aftermesh.DHCP()).Goal:
Files to update:
examples/RF24Mesh_Example_Master/RF24Mesh_Example_Master.inoexamples/RF24Mesh_Example_Master_Statics/RF24Mesh_Example_Master_Statics.inoexamples/RF24Mesh_Example_Master_To_Nodes/RF24Mesh_Example_Master_To_Nodes.inoexamples_RPi/RF24Mesh_Example_Master.cppexamples_RPi/RF24Mesh_Example_Master.pyexamples_pico/RF24Mesh_Example_Master.cppRequired C/C++ snippet to add after
mesh.DHCP();:For the Python file, add the equivalent commented Python example directly after
mesh.DHCP()using Python comment syntax and idiomaticrange(mesh.addrListTop)/ membership check against(2, 3, 4).Constraints:
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: i want to add the following code to all the master examples in the RF24Mesh library located at @nRF24/RF24Mesh. This is the code: // The following code can be commented out in a production environment to limit the authorized nodes
// to a specified list of nodes. Any nodes not in this list will be de-allocated. Can be run on a timer.
// AUTHORIZED NODES LIST:
/for(int i=0; i< mesh.addrListTop; i++){
if(mesh.addrList[i].nodeID != 2 && mesh.addrList[i].nodeID != 3 && mesh.addrList[i].nodeID != 4){
mesh.addrList[i].address = 0;
}
}/
Assistant: I’m ready to proceed, but I need you to accept the pending authorization prompt so I can apply that commented “AUTHORIZED NODES LIST” snippet across the RF24Mesh master examples and open the update for review.
User: can you show me the code first?
Assistant: Yes — here’s the code I’d add to the master examples first, before making any PR.
The repo appears to have these master examples:
examples/RF24Mesh_Example_Master/RF24Mesh_Example_Master.inoexamples/RF24Mesh_Example_Master_Statics/RF24Mesh_Example_Master_Statics.inoexamples/RF24Mesh_Example_Master_To_Nodes/RF24Mesh_Example_Master_To_Nodes.inoexamples_RPi/RF24Mesh_Example_Master.cppexamples_RPi/RF24Mesh_Example_Master.pyexamples_pico/RF24Mesh_Example_Master.cppThe code search results I used may be incomplete because that tool only returns up to 10 matches. You can view more in GitHub code search here:
https://github.com/search?q=repo%3AnRF24%2FRF24Mesh+RF24Mesh_Example_Master&type=codeProposed insertion
I’d place this immediately after
mesh.DHCP();in each master example.Example of how it would look in the main Arduino master sketch