Fixed RSSI indication confusion. Added SNR indication to received packets.

This commit is contained in:
Mark Qvist 2019-11-07 15:26:21 +01:00
parent cd4587cca2
commit bad6f4bf75
9 changed files with 1572 additions and 1451 deletions

View file

@ -218,10 +218,19 @@ uint8_t LoRaClass::packetRssiRaw() {
}
int LoRaClass::packetRssi() {
int pkt_rssi = (int)readRegister(REG_PKT_RSSI_VALUE);
// TODO: change this to look at the actual model code
int pkt_rssi = (int)readRegister(REG_PKT_RSSI_VALUE) - RSSI_OFFSET;
int pkt_snr = packetSnr();
if (_frequency < 820E6) pkt_rssi -= 7;
pkt_rssi -= 157;
if (pkt_snr < 0) {
pkt_rssi += pkt_snr;
} else {
// Slope correction is (16/15)*pkt_rssi,
// this estimation looses one floating point
// operation, and should be precise enough.
pkt_rssi = (int)(1.066 * pkt_rssi);
}
return pkt_rssi;
}