From cd79bd7ecb19e1b849b2aa47f1aeeb31e1afd84b Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Sat, 23 Sep 2023 13:31:55 -0600 Subject: [PATCH] Update mesh for multichannel https://github.com/nRF24/RF24Network/issues/214 --- RF24Mesh.cpp | 3 +++ RF24Mesh.h | 1 + 2 files changed, 4 insertions(+) diff --git a/RF24Mesh.cpp b/RF24Mesh.cpp index 6bae0bf..1312b1f 100644 --- a/RF24Mesh.cpp +++ b/RF24Mesh.cpp @@ -33,6 +33,7 @@ bool ESBMesh::begin(uint8_t channel, rf24_datarate_e data_ra if (!radio.begin()) return 0; radio.setChannel(channel); + meshChannel = channel; radio.setDataRate(data_rate); network.returnSysMsgs = true; @@ -258,6 +259,7 @@ template void ESBMesh::beginDefault() { radio.stopListening(); + radio.setChannel(meshChannel); network.begin(MESH_DEFAULT_ADDRESS); mesh_address = MESH_DEFAULT_ADDRESS; } @@ -398,6 +400,7 @@ bool ESBMesh::requestAddress(uint8_t level) mesh_address = newAddress; radio.stopListening(); + radio.setChannel(meshChannel); network.begin(mesh_address); // getNodeID() doesn't use auto-ack; do a double-check to manually retry 1 more time diff --git a/RF24Mesh.h b/RF24Mesh.h index 1df1305..0d1f3b2 100644 --- a/RF24Mesh.h +++ b/RF24Mesh.h @@ -367,6 +367,7 @@ class ESBMesh bool meshStarted; /** Returns the number of octal digits in the specified address. */ uint8_t getLevel(uint16_t address); + uint8_t meshChannel; }; /**