S0 and S9 value settings #174
This commit is contained in:
13
settings.c
13
settings.c
@@ -132,10 +132,14 @@ void SETTINGS_InitEEPROM(void)
|
||||
memmove(&gEeprom.POWER_ON_PASSWORD, Data, 4);
|
||||
|
||||
// 0EA0..0EA7
|
||||
#ifdef ENABLE_VOICE
|
||||
EEPROM_ReadBuffer(0x0EA0, Data, 8);
|
||||
#ifdef ENABLE_VOICE
|
||||
gEeprom.VOICE_PROMPT = (Data[0] < 3) ? Data[0] : VOICE_PROMPT_ENGLISH;
|
||||
#endif
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
gEeprom.S0_LEVEL = (Data[1] < 0xFF) ? Data[1] : 130;
|
||||
gEeprom.S9_LEVEL = (Data[2] < gEeprom.S0_LEVEL-9) ? Data[2] : 76;
|
||||
#endif
|
||||
|
||||
// 0EA8..0EAF
|
||||
EEPROM_ReadBuffer(0x0EA8, Data, 8);
|
||||
@@ -524,8 +528,13 @@ void SETTINGS_SaveSettings(void)
|
||||
memset(State, 0xFF, sizeof(State));
|
||||
#ifdef ENABLE_VOICE
|
||||
State[0] = gEeprom.VOICE_PROMPT;
|
||||
EEPROM_WriteBuffer(0x0EA0, State);
|
||||
#endif
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
State[1] = gEeprom.S0_LEVEL;
|
||||
State[2] = gEeprom.S9_LEVEL;
|
||||
#endif
|
||||
EEPROM_WriteBuffer(0x0EA0, State);
|
||||
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
State[0] = gEeprom.ALARM_MODE;
|
||||
|
@@ -247,6 +247,10 @@ typedef struct {
|
||||
#endif
|
||||
uint8_t BACKLIGHT_MAX;
|
||||
BATTERY_Type_t BATTERY_TYPE;
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
uint8_t S0_LEVEL;
|
||||
uint8_t S9_LEVEL;
|
||||
#endif
|
||||
} EEPROM_Config_t;
|
||||
|
||||
extern EEPROM_Config_t gEeprom;
|
||||
|
@@ -198,7 +198,7 @@ void DisplayRSSIBar(const bool now)
|
||||
memset(p_line, 0, LCD_WIDTH);
|
||||
|
||||
|
||||
const int16_t s0_dBm = -130; // S0 .. base level
|
||||
const int16_t s0_dBm = -gEeprom.S0_LEVEL; // S0 .. base level
|
||||
const int16_t rssi_dBm =
|
||||
BK4819_GetRSSI_dBm()
|
||||
#ifdef ENABLE_AM_FIX
|
||||
@@ -206,9 +206,9 @@ void DisplayRSSIBar(const bool now)
|
||||
#endif
|
||||
+ dBmCorrTable[gRxVfo->Band];
|
||||
|
||||
|
||||
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);
|
||||
int s0_9 = gEeprom.S0_LEVEL - gEeprom.S9_LEVEL;
|
||||
const uint8_t s_level = MIN(MAX((int32_t)(rssi_dBm - s0_dBm)*100 / (s0_9*100/9), 0), 9); // S0 - S9
|
||||
uint8_t overS9dBm = MIN(MAX(rssi_dBm + gEeprom.S9_LEVEL, 0), 99);
|
||||
uint8_t overS9Bars = MIN(overS9dBm/10, 4);
|
||||
|
||||
if(overS9Bars == 0) {
|
||||
|
Reference in New Issue
Block a user