Skip to content

Commit

Permalink
Update mesh for multichannel
Browse files Browse the repository at this point in the history
  • Loading branch information
TMRh20 committed Sep 23, 2023
1 parent 38ee022 commit cd79bd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RF24Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ bool ESBMesh<network_t, radio_t>::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;

Expand Down Expand Up @@ -258,6 +259,7 @@ template<class network_t, class radio_t>
void ESBMesh<network_t, radio_t>::beginDefault()
{
radio.stopListening();
radio.setChannel(meshChannel);
network.begin(MESH_DEFAULT_ADDRESS);
mesh_address = MESH_DEFAULT_ADDRESS;
}
Expand Down Expand Up @@ -398,6 +400,7 @@ bool ESBMesh<network_t, radio_t>::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
Expand Down
1 change: 1 addition & 0 deletions RF24Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/**
Expand Down

0 comments on commit cd79bd7

Please sign in to comment.