Added continual RSSI monitoring for tuned channel

This commit is contained in:
Mark Qvist 2022-10-29 00:52:51 +02:00
parent 20d3e85c20
commit 2c826fb3dc
2 changed files with 15 additions and 0 deletions

View File

@ -49,6 +49,7 @@
#define REG_MODEM_STAT 0x18 #define REG_MODEM_STAT 0x18
#define REG_PKT_SNR_VALUE 0x19 #define REG_PKT_SNR_VALUE 0x19
#define REG_PKT_RSSI_VALUE 0x1a #define REG_PKT_RSSI_VALUE 0x1a
#define REG_RSSI_VALUE 0x1b
#define REG_MODEM_CONFIG_1 0x1d #define REG_MODEM_CONFIG_1 0x1d
#define REG_MODEM_CONFIG_2 0x1e #define REG_MODEM_CONFIG_2 0x1e
#define REG_PREAMBLE_MSB 0x20 #define REG_PREAMBLE_MSB 0x20
@ -239,6 +240,18 @@ uint8_t LoRaClass::modemStatus() {
return readRegister(REG_MODEM_STAT); return readRegister(REG_MODEM_STAT);
} }
uint8_t LoRaClass::currentRssiRaw() {
uint8_t rssi = readRegister(REG_RSSI_VALUE);
return rssi;
}
int ISR_VECT LoRaClass::currentRssi() {
int rssi = (int)readRegister(REG_RSSI_VALUE) - RSSI_OFFSET;
if (_frequency < 820E6) rssi -= 7;
return rssi;
}
uint8_t LoRaClass::packetRssiRaw() { uint8_t LoRaClass::packetRssiRaw() {
uint8_t pkt_rssi_value = readRegister(REG_PKT_RSSI_VALUE); uint8_t pkt_rssi_value = readRegister(REG_PKT_RSSI_VALUE);
return pkt_rssi_value; return pkt_rssi_value;

2
LoRa.h
View File

@ -31,7 +31,9 @@ public:
int parsePacket(int size = 0); int parsePacket(int size = 0);
int packetRssi(); int packetRssi();
int currentRssi();
uint8_t packetRssiRaw(); uint8_t packetRssiRaw();
uint8_t currentRssiRaw();
uint8_t packetSnrRaw(); uint8_t packetSnrRaw();
float packetSnr(); float packetSnr();
long packetFrequencyError(); long packetFrequencyError();