diff --git a/API.md b/API.md index db1cf1c..2d8cad8 100644 --- a/API.md +++ b/API.md @@ -204,6 +204,14 @@ float snr = LoRa.packetSnr(); Returns the estimated SNR of the received packet in dB. +### Packet SNR Raw + +```arduino +int snrRaw = LoRa.packetSnrRaw(); +``` + +Like [`LoRa.packetSnr()`](#packet-snr) except it returns an `int` that is 4 times the SNR of the received packet in dB. + ## RSSI ```arduino diff --git a/src/LoRa.cpp b/src/LoRa.cpp index 210a589..04be069 100644 --- a/src/LoRa.cpp +++ b/src/LoRa.cpp @@ -268,7 +268,12 @@ int LoRaClass::packetRssi() float LoRaClass::packetSnr() { - return ((int8_t)readRegister(REG_PKT_SNR_VALUE)) * 0.25; + return packetSnrRaw() * 0.25; +} + +int LoRaClass::packetSnrRaw() +{ + return ((int8_t)readRegister(REG_PKT_SNR_VALUE)); } long LoRaClass::packetFrequencyError() diff --git a/src/LoRa.h b/src/LoRa.h index b312db5..20e4cbf 100644 --- a/src/LoRa.h +++ b/src/LoRa.h @@ -43,6 +43,7 @@ class LoRaClass : public Stream { int parsePacket(int size = 0); int packetRssi(); float packetSnr(); + int packetSnrRaw(); long packetFrequencyError(); int rssi();