Skip to content

Commit fbc65de

Browse files
committed
Replace promiscuous() with spyMode()
1 parent f2e0a1a commit fbc65de

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

RFM69.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RFM69::RFM69(uint8_t slaveSelectPin, uint8_t interruptPin, bool isRFM69HW)
4343
_slaveSelectPin = slaveSelectPin;
4444
_interruptPin = interruptPin;
4545
_mode = RF69_MODE_STANDBY;
46-
_promiscuousMode = false;
46+
_spyMode = false;
4747
_powerLevel = 31;
4848
_isRFM69HW = isRFM69HW;
4949
#if defined(RF69_LISTENMODE_ENABLE)
@@ -349,7 +349,7 @@ void RFM69::interruptHandler() {
349349
TARGETID |= (uint16_t(CTLbyte) & 0x0C) << 6; //10 bit address (most significant 2 bits stored in bits(2,3) of CTL byte
350350
SENDERID |= (uint16_t(CTLbyte) & 0x03) << 8; //10 bit address (most sifnigicant 2 bits stored in bits(0,1) of CTL byte
351351

352-
if(!(_promiscuousMode || TARGETID == _address || TARGETID == RF69_BROADCAST_ADDR) // match this node's address, or broadcast address or anything in promiscuous mode
352+
if(!(_spyMode || TARGETID == _address || TARGETID == RF69_BROADCAST_ADDR) // match this node's address, or broadcast address or anything in spy mode
353353
|| PAYLOADLEN < 3) // address situation could receive packets that are malformed and don't fit this libraries extra fields
354354
{
355355
PAYLOADLEN = 0;
@@ -501,13 +501,18 @@ void RFM69::unselect() {
501501
#endif
502502
}
503503

504-
// true = disable filtering to capture all frames on network
505-
// false = enable node/broadcast filtering to capture only frames sent to this/broadcast address
506-
void RFM69::promiscuous(bool onOff) {
507-
_promiscuousMode = onOff;
504+
// true = disable ID filtering to capture all packets on network, regardless of TARGETID
505+
// false (default) = enable node/broadcast ID filtering to capture only frames sent to this/broadcast address
506+
void RFM69::spyMode(bool onOff) {
507+
_spyMode = onOff;
508508
//writeReg(REG_PACKETCONFIG1, (readReg(REG_PACKETCONFIG1) & 0xF9) | (onOff ? RF_PACKET1_ADRSFILTERING_OFF : RF_PACKET1_ADRSFILTERING_NODEBROADCAST));
509509
}
510510

511+
void RFM69::promiscuous(bool onOff) {
512+
Serial.println("\nRFM69::promiscuous(bool): DEPRECATED, use spyMode(bool) instead!\n");
513+
spyMode(onOff);
514+
}
515+
511516
// for RFM69HW only: you must call setHighPower(true) after initialize() or else transmission won't work
512517
void RFM69::setHighPower(bool onOff) {
513518
_isRFM69HW = onOff;
@@ -979,7 +984,7 @@ void RFM69::listenModeInterruptHandler(void)
979984
PAYLOADLEN = SPI.transfer(0);
980985
PAYLOADLEN = PAYLOADLEN > 64 ? 64 : PAYLOADLEN; // precaution
981986
TARGETID = SPI.transfer(0);
982-
if(!(_promiscuousMode || TARGETID == _address || TARGETID == RF69_BROADCAST_ADDR) // match this node's address, or broadcast address or anything in promiscuous mode
987+
if(!(_spyMode || TARGETID == _address || TARGETID == RF69_BROADCAST_ADDR) // match this node's address, or broadcast address or anything in spy mode
983988
|| PAYLOADLEN < 3) // address situation could receive packets that are malformed and don't fit this library's extra fields
984989
{
985990
listenModeReset();

RFM69.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ class RFM69 {
204204
void encrypt(const char* key);
205205
void setCS(uint8_t newSPISlaveSelect);
206206
int16_t readRSSI(bool forceTrigger=false); // *current* signal strength indicator; e.g. < -90dBm says the frequency channel is free + ready to transmit
207-
void promiscuous(bool onOff=true);
207+
void spyMode(bool onOff=true);
208+
void promiscuous(bool onOff=true); //deprecated, replaced with spyMode()
208209
virtual void setHighPower(bool onOFF=true); // has to be called after initialize() for RFM69HW
209210
virtual void setPowerLevel(uint8_t level); // reduce/increase transmit power level
210211
void sleep();
@@ -228,7 +229,7 @@ class RFM69 {
228229
uint8_t _interruptPin;
229230
uint8_t _interruptNum;
230231
uint16_t _address;
231-
bool _promiscuousMode;
232+
bool _spyMode;
232233
uint8_t _powerLevel;
233234
bool _isRFM69HW;
234235
#if defined (SPCR) && defined (SPSR)

keywords.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ getFrequency KEYWORD2
3030
encrypt KEYWORD2
3131
setCS KEYWORD2
3232
readRSSI KEYWORD2
33-
promiscuous KEYWORD2
33+
spyMode KEYWORD2
3434
setHighPower KEYWORD2
3535
sleep KEYWORD2
3636
readReg KEYWORD2

0 commit comments

Comments
 (0)