diff --git a/Examples/Gateway/Gateway.ino b/Examples/Gateway/Gateway.ino index cd2f532..25bf68e 100644 --- a/Examples/Gateway/Gateway.ino +++ b/Examples/Gateway/Gateway.ino @@ -1,18 +1,13 @@ // ********************************************************************************** -// // !!!! ATTENTION: !!!! -// // This is just a simple receiving sketch that will work with most examples // in the RFM69 library. // // If you're looking for the Gateway sketch to use with your RaspberryPi, // as part of the PiGateway software interface (lowpowerlab.com/gateway), -// this is the wrong sketch. -// -// Use this sketch instead: PiGateway: +// this is the wrong sketch. Use this sketch instead: PiGateway: // https://github.com/LowPowerLab/RFM69/blob/master/Examples/PiGateway/PiGateway.ino // ********************************************************************************** - // Sample RFM69 receiver/gateway sketch, with ACK and optional encryption, and Automatic Transmission Control // Passes through any wireless received messages to the serial port & responds to ACKs // It also looks for an onboard FLASH chip, if present @@ -42,12 +37,11 @@ #include //get it here: https://www.github.com/lowpowerlab/rfm69 #include //get it here: https://www.github.com/lowpowerlab/rfm69 #include //get it here: https://www.github.com/lowpowerlab/spiflash -#include //included with Arduino IDE install (www.arduino.cc) //********************************************************************************************* //************ IMPORTANT SETTINGS - YOU MUST CHANGE/CONFIGURE TO FIT YOUR HARDWARE ************* //********************************************************************************************* -#define NODEID 1 //unique for each node on same network +#define NODEID 1 //should always be 1 for a Gateway #define NETWORKID 100 //the same on all nodes that talk to each other //Match frequency to the hardware version of the radio on your Moteino (uncomment one): //#define FREQUENCY RF69_433MHZ @@ -72,7 +66,7 @@ #endif SPIFlash flash(SS_FLASHMEM, 0xEF30); //EF30 for 4mbit Windbond chip (W25X40CL) -bool promiscuousMode = false; //set to 'true' to sniff all packets on the same network +bool spy = false; //set to 'true' to sniff all packets on the same network void setup() { Serial.begin(SERIAL_BAUD); @@ -82,8 +76,8 @@ void setup() { radio.setHighPower(); //must include this only for RFM69HW/HCW! #endif radio.encrypt(ENCRYPTKEY); - radio.promiscuous(promiscuousMode); - //radio.setFrequency(919000000); //set frequency to some custom frequency + radio.spyMode(spy); + //radio.setFrequency(916000000); //set frequency to some custom frequency char buff[50]; sprintf(buff, "\nListening at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915); Serial.println(buff); @@ -129,9 +123,9 @@ void loop() { radio.encrypt(null); if (input == 'p') { - promiscuousMode = !promiscuousMode; - radio.promiscuous(promiscuousMode); - Serial.print("Promiscuous mode ");Serial.println(promiscuousMode ? "on" : "off"); + spy = !spy; + radio.spyMode(spy); + Serial.print("SpyMode mode ");Serial.println(spy ? "on" : "off"); } if (input == 'd') //d=dump flash area @@ -177,10 +171,7 @@ void loop() { Serial.print(++packetCount); Serial.print(']'); Serial.print('[');Serial.print(radio.SENDERID, DEC);Serial.print("] "); - if (promiscuousMode) - { - Serial.print("to [");Serial.print(radio.TARGETID, DEC);Serial.print("] "); - } + if (spy) Serial.print("to [");Serial.print(radio.TARGETID, DEC);Serial.print("] "); for (byte i = 0; i < radio.DATALEN; i++) Serial.print((char)radio.DATA[i]); Serial.print(" [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]"); diff --git a/Examples/OLEDMote/OLEDMote.ino b/Examples/OLEDMote/OLEDMote.ino index 720d6ae..8bdaeb1 100644 --- a/Examples/OLEDMote/OLEDMote.ino +++ b/Examples/OLEDMote/OLEDMote.ino @@ -55,7 +55,7 @@ RFM69 radio; U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI SSD1306 OLED 128x64 -bool promiscuousMode = true; //set to 'true' to sniff all packets on the same network +bool spy = true; //set to 'true' to sniff all packets on the same network void setup() { Serial.begin(SERIAL_BAUD); @@ -64,7 +64,7 @@ void setup() { radio.setHighPower(); //must include this only for RFM69HW/HCW! #endif radio.encrypt(ENCRYPTKEY); - radio.promiscuous(promiscuousMode); + radio.spyMode(spy); char buff[50]; sprintf(buff, "\nListening at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915); Serial.println(buff); @@ -146,9 +146,7 @@ void loop() { if (radio.receiveDone()) { Serial.print('[');Serial.print(radio.SENDERID);Serial.print("] "); - if (promiscuousMode) - Serial.print("to [");Serial.print(radio.TARGETID);Serial.print("] "); - + if (spy) Serial.print("to [");Serial.print(radio.TARGETID);Serial.print("] "); Serial.print((char*)radio.DATA); Serial.print(" [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]"); Serial.println(); diff --git a/Examples/Struct_receive/Struct_receive.ino b/Examples/Struct_receive/Struct_receive.ino index eb4afef..737855d 100644 --- a/Examples/Struct_receive/Struct_receive.ino +++ b/Examples/Struct_receive/Struct_receive.ino @@ -55,7 +55,7 @@ #endif SPIFlash flash(SS_FLASHMEM, 0xEF30); //EF40 for 16mbit windbond chip -bool promiscuousMode = false; //set to 'true' to sniff all packets on the same network +bool spy = false; //set to 'true' to sniff all packets on the same network typedef struct { int nodeId; //store this nodeId @@ -72,7 +72,7 @@ void setup() { radio.setHighPower(); //must include this only for RFM69HW/HCW! #endif radio.encrypt(ENCRYPTKEY); - radio.promiscuous(promiscuousMode); + radio.spyMode(spy); char buff[50]; sprintf(buff, "\nListening at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915); Serial.println(buff); @@ -96,9 +96,9 @@ void loop() { radio.encrypt(null); if (input == 'p') { - promiscuousMode = !promiscuousMode; - radio.promiscuous(promiscuousMode); - Serial.print("Promiscuous mode ");Serial.println(promiscuousMode ? "on" : "off"); + spy = !spy; + radio.spyMode(spy); + Serial.print("Spy mode ");Serial.println(spy ? "on" : "off"); } if (input == 'd') //d=dump flash area @@ -132,10 +132,7 @@ void loop() { { Serial.print('[');Serial.print(radio.SENDERID, DEC);Serial.print("] "); Serial.print(" [RX_RSSI:");Serial.print(radio.readRSSI());Serial.print("]"); - if (promiscuousMode) - { - Serial.print("to [");Serial.print(radio.TARGETID, DEC);Serial.print("] "); - } + if (spy) Serial.print("to [");Serial.print(radio.TARGETID, DEC);Serial.print("] "); if (radio.DATALEN != sizeof(Payload)) Serial.print("Invalid payload received, not matching Payload struct!");