mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Update RSSI_DBM to include diversity antenna in OSD element (CRSF) (#12359)
Add diversity antenna element for CRSF
This commit is contained in:
parent
acfc558ae4
commit
1e1d12277b
4 changed files with 24 additions and 1 deletions
|
@ -1451,7 +1451,15 @@ static void osdElementRtcTime(osdElementParms_t *element)
|
|||
#ifdef USE_RX_RSSI_DBM
|
||||
static void osdElementRssiDbm(osdElementParms_t *element)
|
||||
{
|
||||
tfp_sprintf(element->buff, "%c%3d", SYM_RSSI, getRssiDbm());
|
||||
const int8_t antenna = getActiveAntenna();
|
||||
static bool diversity = false;
|
||||
|
||||
if (antenna || diversity) {
|
||||
diversity = true;
|
||||
tfp_sprintf(element->buff, "%c%3d:%d", SYM_RSSI, getRssiDbm(), antenna + 1);
|
||||
} else {
|
||||
tfp_sprintf(element->buff, "%c%3d", SYM_RSSI, getRssiDbm());
|
||||
}
|
||||
}
|
||||
#endif // USE_RX_RSSI_DBM
|
||||
|
||||
|
|
|
@ -234,6 +234,7 @@ static void handleCrsfLinkStatisticsFrame(const crsfLinkStatistics_t* statsPtr,
|
|||
}
|
||||
#ifdef USE_RX_RSSI_DBM
|
||||
setRssiDbm(rssiDbm, RSSI_SOURCE_RX_PROTOCOL_CRSF);
|
||||
setActiveAntenna(stats.active_antenna);
|
||||
#endif
|
||||
|
||||
#ifdef USE_RX_RSNR
|
||||
|
|
|
@ -79,6 +79,7 @@ static uint16_t rssi = 0; // range: [0;1023]
|
|||
static uint16_t rssiRaw = 0; // range: [0;1023]
|
||||
static timeUs_t lastRssiSmoothingUs = 0;
|
||||
#ifdef USE_RX_RSSI_DBM
|
||||
static int8_t activeAntenna;
|
||||
static int16_t rssiDbm = CRSF_RSSI_MIN; // range: [-130,0]
|
||||
static int16_t rssiDbmRaw = CRSF_RSSI_MIN; // range: [-130,0]
|
||||
#endif //USE_RX_RSSI_DBM
|
||||
|
@ -949,6 +950,17 @@ void setRssiDbmDirect(int16_t newRssiDbm, rssiSource_e source)
|
|||
rssiDbm = newRssiDbm;
|
||||
rssiDbmRaw = newRssiDbm;
|
||||
}
|
||||
|
||||
int8_t getActiveAntenna(void)
|
||||
{
|
||||
return activeAntenna;
|
||||
}
|
||||
|
||||
void setActiveAntenna(int8_t antenna)
|
||||
{
|
||||
activeAntenna = antenna;
|
||||
}
|
||||
|
||||
#endif //USE_RX_RSSI_DBM
|
||||
|
||||
#ifdef USE_RX_RSNR
|
||||
|
|
|
@ -207,6 +207,8 @@ uint16_t rxGetLinkQualityPercent(void);
|
|||
int16_t getRssiDbm(void);
|
||||
void setRssiDbm(int16_t newRssiDbm, rssiSource_e source);
|
||||
void setRssiDbmDirect(int16_t newRssiDbm, rssiSource_e source);
|
||||
int8_t getActiveAntenna(void);
|
||||
void setActiveAntenna(int8_t antenna);
|
||||
#endif //USE_RX_RSSI_DBM
|
||||
|
||||
#ifdef USE_RX_RSNR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue