mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 16:55:29 +03:00
Merge pull request #6950 from iNavFlight/avs-crsf-rssi-formatting
Improved CRSF RSSI and SNR display
This commit is contained in:
commit
a3c6924d83
1 changed files with 20 additions and 15 deletions
|
@ -1849,18 +1849,15 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
#if defined(USE_SERIALRX_CRSF)
|
||||
case OSD_CRSF_RSSI_DBM:
|
||||
{
|
||||
if (rxLinkStatistics.activeAnt == 0) {
|
||||
buff[0] = SYM_RSSI;
|
||||
tfp_sprintf(buff + 1, "%4d%c", rxLinkStatistics.uplinkRSSI, SYM_DBM);
|
||||
if (!failsafeIsReceivingRxData()){
|
||||
TEXT_ATTRIBUTES_ADD_BLINK(elemAttr);
|
||||
}
|
||||
int16_t rssi = rxLinkStatistics.uplinkRSSI;
|
||||
buff[0] = (rxLinkStatistics.activeAnt == 0) ? SYM_RSSI : SYM_2RSS; // Separate symbols for each antenna
|
||||
if (rssi <= -100) {
|
||||
tfp_sprintf(buff + 1, "%4d%c", rssi, SYM_DBM);
|
||||
} else {
|
||||
buff[0] = SYM_2RSS;
|
||||
tfp_sprintf(buff + 1, "%4d%c", rxLinkStatistics.uplinkRSSI, SYM_DBM);
|
||||
if (!failsafeIsReceivingRxData()){
|
||||
TEXT_ATTRIBUTES_ADD_BLINK(elemAttr);
|
||||
}
|
||||
tfp_sprintf(buff + 1, "%3d%c%c", rssi, SYM_DBM, ' ');
|
||||
}
|
||||
if (!failsafeIsReceivingRxData()){
|
||||
TEXT_ATTRIBUTES_ADD_BLINK(elemAttr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1890,10 +1887,14 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
|
||||
case OSD_CRSF_SNR_DB:
|
||||
{
|
||||
static pt1Filter_t snrFilterState;
|
||||
static timeMs_t snrUpdated = 0;
|
||||
int8_t snrFiltered = pt1FilterApply4(&snrFilterState, rxLinkStatistics.uplinkSNR, 0.5f, MS2S(millis() - snrUpdated));
|
||||
snrUpdated = millis();
|
||||
|
||||
const char* showsnr = "-20";
|
||||
const char* hidesnr = " ";
|
||||
int16_t osdSNR_Alarm = rxLinkStatistics.uplinkSNR;
|
||||
if (osdSNR_Alarm > osdConfig()->snr_alarm) {
|
||||
if (snrFiltered > osdConfig()->snr_alarm) {
|
||||
if (cmsInMenu) {
|
||||
buff[0] = SYM_SNR;
|
||||
tfp_sprintf(buff + 1, "%s%c", showsnr, SYM_DB);
|
||||
|
@ -1901,9 +1902,13 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
buff[0] = SYM_BLANK;
|
||||
tfp_sprintf(buff + 1, "%s%c", hidesnr, SYM_BLANK);
|
||||
}
|
||||
} else if (osdSNR_Alarm <= osdConfig()->snr_alarm) {
|
||||
} else if (snrFiltered <= osdConfig()->snr_alarm) {
|
||||
buff[0] = SYM_SNR;
|
||||
tfp_sprintf(buff + 1, "%3d%c", rxLinkStatistics.uplinkSNR, SYM_DB);
|
||||
if (snrFiltered <= -10) {
|
||||
tfp_sprintf(buff + 1, "%3d%c", snrFiltered, SYM_DB);
|
||||
} else {
|
||||
tfp_sprintf(buff + 1, "%2d%c%c", snrFiltered, SYM_DB, ' ');
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue