From 763c7dfe30ec2e1fe3195195fe59ea7f1de9e843 Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Tue, 7 Apr 2015 13:18:59 -0600 Subject: [PATCH] Set multicastRelay in configure - 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 --- RF24Client.cpp | 2 +- RF24Ethernet.cpp | 2 +- RF24Ethernet.h | 4 ++-- .../SLIP_InteractiveServer.ino | 14 ++------------ examples/SimpleServer_Mesh/SimpleServer_Mesh.ino | 6 ++---- 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/RF24Client.cpp b/RF24Client.cpp index dd5b187..bf5e52f 100644 --- a/RF24Client.cpp +++ b/RF24Client.cpp @@ -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 diff --git a/RF24Ethernet.cpp b/RF24Ethernet.cpp index 7c83beb..f1e9f19 100644 --- a/RF24Ethernet.cpp +++ b/RF24Ethernet.cpp @@ -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; } /*******************************************************/ @@ -127,6 +126,7 @@ _dnsServerAddress = dns; #if defined (RF24_TAP) uip_arp_init(); #endif + network.multicastRelay = 1; } /*******************************************************/ diff --git a/RF24Ethernet.h b/RF24Ethernet.h index 59a1def..c3742c8 100644 --- a/RF24Ethernet.h +++ b/RF24Ethernet.h @@ -307,8 +307,8 @@ extern RF24EthernetClass RF24Ethernet; * * * @section News Update News - * - * \version 1.41b - March 12 2015 + * + * \version 1.4b/1.411b - March 14 - Apr 7 2015 * - Add Ethernet.update() function * - Improve/Fix outgoing data handling * - Fix: Hanging in 1.4b diff --git a/examples/SLIP_InteractiveServer/SLIP_InteractiveServer.ino b/examples/SLIP_InteractiveServer/SLIP_InteractiveServer.ino index 98cf280..1b4bba8 100644 --- a/examples/SLIP_InteractiveServer/SLIP_InteractiveServer.ino +++ b/examples/SLIP_InteractiveServer/SLIP_InteractiveServer.ino @@ -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 @@ -110,7 +100,7 @@ void loop() { mesh_timer = millis(); if( ! mesh.checkConnection() ){ //refresh the network address - Ethernet.setMac(mesh.renewAddress()); + mesh.renewAddress(); } } diff --git a/examples/SimpleServer_Mesh/SimpleServer_Mesh.ino b/examples/SimpleServer_Mesh/SimpleServer_Mesh.ino index 6d2218d..a6df70b 100644 --- a/examples/SimpleServer_Mesh/SimpleServer_Mesh.ino +++ b/examples/SimpleServer_Mesh/SimpleServer_Mesh.ino @@ -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 @@ -54,7 +53,6 @@ void setup() { server.begin(); } -uint16_t testTimer = 0; uint32_t mesh_timer = 0; void loop() { @@ -65,7 +63,7 @@ void loop() { mesh_timer = millis(); if( ! mesh.checkConnection() ){ //refresh the network address - Ethernet.setMac(mesh.renewAddress()); + mesh.renewAddress(); } }