Fixed issue with RSSI calculation on MD-UV3x0, leading to an output value of +105dBm when AT1846S register read 0x00

This commit is contained in:
Silvano Seva 2021-03-22 18:01:37 +01:00
parent fb295a7aa0
commit a20f907330
1 changed files with 6 additions and 2 deletions

View File

@ -277,7 +277,11 @@ float radio_getRssi(const freq_t rxFreq)
{
(void) rxFreq;
uint16_t val = AT1846S_readRSSI();
int8_t rssi = -151 + (val >> 8);
/*
* RSSI and SNR are packed in a 16-bit value, with RSSI being the upper
* eight bits.
*/
uint16_t val = (AT1846S_readRSSI() >> 8);
int16_t rssi = -151 + ((int16_t) val);
return ((float) rssi);
}