Skip to content

Commit

Permalink
Set multicastRelay in configure
Browse files Browse the repository at this point in the history
- Move multicastRelay setting to the configure function so the mac
address does not need to be set when using RF24Mesh/TUN
- Fix RF24Mesh related examples
  • Loading branch information
TMRh20 committed Apr 7, 2015
1 parent 3049d3a commit 763c7df
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion RF24Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void serialip_appcall(void) {
if (u->state & UIP_CLIENT_RESTART && !u->windowOpened) {
if( !(u->state & (UIP_CLIENT_CLOSE | UIP_CLIENT_REMOTECLOSED))){
uip_restart();
#if defined RF24ETHERNET_DEBUG_CLIENT || defined ETH_DEBUG_L1
#if defined ETH_DEBUG_L1
Serial.println();
Serial.println(F("UIPClient Re-Open TCP Window"));
#endif
Expand Down
2 changes: 1 addition & 1 deletion RF24Ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ void RF24EthernetClass::setMac(uint16_t address){
#endif
RF24_Channel = RF24_Channel ? RF24_Channel : 97;
network.begin(RF24_Channel, address);
network.multicastRelay = 1;
}

/*******************************************************/
Expand Down Expand Up @@ -127,6 +126,7 @@ _dnsServerAddress = dns;
#if defined (RF24_TAP)
uip_arp_init();
#endif
network.multicastRelay = 1;
}

/*******************************************************/
Expand Down
4 changes: 2 additions & 2 deletions RF24Ethernet.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ extern RF24EthernetClass RF24Ethernet;
*
*
* @section News Update News
*
* \version <b>1.41b - March 12 2015</b>
*
* \version <b>1.4b/1.411b - March 14 - Apr 7 2015 </b>
* - Add Ethernet.update() function
* - Improve/Fix outgoing data handling
* - Fix: Hanging in 1.4b
Expand Down
14 changes: 2 additions & 12 deletions examples/SLIP_InteractiveServer/SLIP_InteractiveServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,15 @@ void setup() {
printf_begin();
Serial.println("start");
pinMode(LED_PIN, OUTPUT);
// This initializes the radio with basic settings.
// Needs to be called at the beginning of every sketch
Ethernet.use_device();

// Tell RF24Ethernet which channel to use. This step is not that important, but it
// is important to set the channel this way, not directly via the radio
Ethernet.setChannel(97);
// mesh.setChannel(97);


// This step is very important. When using TUN or SLIP, the IP of the device
// must be configured as the NodeID in the RF24Mesh layer

mesh.setNodeID(2);
mesh.begin();
Serial.println(mesh.mesh_address,HEX);
Ethernet.setMac(mesh.mesh_address);

//Optional
radio.setPALevel(RF24_PA_HIGH);
radio.printDetails();

// Set the IP address we'll be using. Make sure this doesn't conflict with
Expand Down Expand Up @@ -110,7 +100,7 @@ void loop() {
mesh_timer = millis();
if( ! mesh.checkConnection() ){
//refresh the network address
Ethernet.setMac(mesh.renewAddress());
mesh.renewAddress();
}
}

Expand Down
6 changes: 2 additions & 4 deletions examples/SimpleServer_Mesh/SimpleServer_Mesh.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ void setup() {
// IP address
mesh.setNodeID(4); //Node id must be any unique value between 1 and 250
mesh.begin();
//Serial.println(mesh.mesh_address,HEX);
Ethernet.setMac(mesh.mesh_address);
//Serial.println(mesh.mesh_address,OCT);

// Set the IP address we'll be using. The last octet of the IP must be equal
// to the designated mesh nodeID
Expand All @@ -54,7 +53,6 @@ void setup() {
server.begin();
}

uint16_t testTimer = 0;
uint32_t mesh_timer = 0;

void loop() {
Expand All @@ -65,7 +63,7 @@ void loop() {
mesh_timer = millis();
if( ! mesh.checkConnection() ){
//refresh the network address
Ethernet.setMac(mesh.renewAddress());
mesh.renewAddress();
}
}

Expand Down

0 comments on commit 763c7df

Please sign in to comment.