Add reception RSSI (more accurate)
This commit is contained in:
parent
7b2f8ed5ee
commit
a0f2aaf113
|
|
@ -107,7 +107,7 @@ void loop() {
|
|||
}
|
||||
for (byte i = 0; i < radio.DATALEN; i++)
|
||||
Serial.print((char)radio.DATA[i]);
|
||||
Serial.print(" [RX_RSSI:");Serial.print(radio.readRSSI());Serial.print("]");
|
||||
Serial.print(" [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]");
|
||||
|
||||
if (radio.ACK_REQUESTED)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ void loop() {
|
|||
Serial.print('[');Serial.print(radio.SENDERID, DEC);Serial.print("] ");
|
||||
for (byte i = 0; i < radio.DATALEN; i++)
|
||||
Serial.print((char)radio.DATA[i]);
|
||||
Serial.print(" [RX_RSSI:");Serial.print(radio.readRSSI());Serial.print("]");
|
||||
Serial.print(" [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]");
|
||||
|
||||
if (radio.ACK_REQUESTED)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ volatile byte RFM69::TARGETID; //should match _address
|
|||
volatile byte RFM69::PAYLOADLEN;
|
||||
volatile byte RFM69::ACK_REQUESTED;
|
||||
volatile byte RFM69::ACK_RECEIVED; /// Should be polled immediately after sending a packet with ACK request
|
||||
volatile int RFM69::RSSI; //most accurate RSSI during reception (closest to the reception)
|
||||
RFM69* RFM69::selfPointer;
|
||||
|
||||
bool RFM69::initialize(byte freqBand, byte nodeID, byte networkID)
|
||||
|
|
@ -259,6 +260,7 @@ void RFM69::interruptHandler() {
|
|||
unselect();
|
||||
setMode(RF69_MODE_RX);
|
||||
}
|
||||
RSSI = readRSSI();
|
||||
//digitalWrite(4, 0);
|
||||
}
|
||||
|
||||
|
|
@ -271,6 +273,7 @@ void RFM69::receiveBegin() {
|
|||
PAYLOADLEN = 0;
|
||||
ACK_REQUESTED = 0;
|
||||
ACK_RECEIVED = 0;
|
||||
RSSI = 0;
|
||||
if (readReg(REG_IRQFLAGS2) & RF_IRQFLAGS2_PAYLOADREADY)
|
||||
writeReg(REG_PACKETCONFIG2, (readReg(REG_PACKETCONFIG2) & 0xFB) | RF_PACKET2_RXRESTART); // avoid RX deadlocks
|
||||
writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_01); //set DIO0 to "PAYLOADREADY" in receive mode
|
||||
|
|
|
|||
3
RFM69.h
3
RFM69.h
|
|
@ -2,7 +2,7 @@
|
|||
// Driver definition for HopeRF RFM69W/RFM69HW, Semtech SX1231/1231H
|
||||
// **********************************************************************************
|
||||
// Creative Commons Attrib Share-Alike License
|
||||
// You are free to use/extend this library but please abide with the CCSA license:
|
||||
// You are free to use/extend this library but please abide with the CC-BY-SA license:
|
||||
// http://creativecommons.org/licenses/by-sa/3.0/
|
||||
// 2013-06-14 (C) felix@lowpowerlab.com
|
||||
// **********************************************************************************
|
||||
|
|
@ -39,6 +39,7 @@ class RFM69 {
|
|||
static volatile byte PAYLOADLEN;
|
||||
static volatile byte ACK_REQUESTED;
|
||||
static volatile byte ACK_RECEIVED; /// Should be polled immediately after sending a packet with ACK request
|
||||
static volatile int RSSI; //most accurate RSSI during reception (closest to the reception)
|
||||
static volatile byte _mode; //should be protected?
|
||||
|
||||
RFM69(byte slaveSelectPin=SPI_CS, byte interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue