mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-22 02:08:48 +00:00
Fix S-meter for UHF/VHF bands.
This commit is contained in:
parent
dde7dc4661
commit
e0178c4805
@ -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,
|
||||
|
17
ui/main.c
17
ui/main.c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user