From a20f9073308aa763d01384a697d49e54d8a4929f Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Mon, 22 Mar 2021 18:01:37 +0100 Subject: [PATCH] Fixed issue with RSSI calculation on MD-UV3x0, leading to an output value of +105dBm when AT1846S register read 0x00 --- platform/drivers/baseband/radio_UV3x0.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/drivers/baseband/radio_UV3x0.c b/platform/drivers/baseband/radio_UV3x0.c index 5f4a5486..959647e0 100644 --- a/platform/drivers/baseband/radio_UV3x0.c +++ b/platform/drivers/baseband/radio_UV3x0.c @@ -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); }