Merge pull request #22 from kamilsss655/rc14

Fix S-meter for UHF/VHF bands.
This commit is contained in:
Nunu 2023-12-30 19:22:15 +01:00 committed by GitHub
commit be7d5f6984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View File

@ -29,6 +29,9 @@ extern const freq_band_table_t BX4819_band2;
extern const freq_band_table_t frequencyBandTable[7];
// 30Mhz defines start of HF band
#define HF_FREQUENCY 3000000
typedef enum {
BAND_NONE = -1,
BAND1_50MHz = 0,

View File

@ -176,18 +176,13 @@ static void DisplayRSSIBar(const int16_t rssi, const bool now)
if (now)
memset(p_line, 0, LCD_WIDTH);
const int8_t dBmCorrTable[7] = {
-15, // band 1
-25, // band 2
-20, // band 3
-4, // band 4
-7, // band 5
-6, // band 6
-1 // band 7
};
int16_t s0_dBm = -130; // S0 .. base level
const int16_t s0_dBm = -130; // S0 .. base level
const int16_t rssi_dBm = (rssi / 2) - 160 + dBmCorrTable[gRxVfo->Band];
// adjust S-level for bands above HF
if(gRxVfo->freq_config_RX.Frequency > HF_FREQUENCY)
s0_dBm-=20;
const int16_t rssi_dBm = (rssi / 2) - 160;
const uint8_t s_level = MIN(MAX((rssi_dBm - s0_dBm) / 6, 0), 9); // S0 - S9
uint8_t overS9dBm = MIN(MAX(rssi_dBm - (s0_dBm + 9*6), 0), 99);