0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

s-meter now shows S9+ in 1dB increments

This commit is contained in:
OneOfEleven 2023-09-30 20:03:09 +01:00
parent 1eac6018ba
commit 6546f9d4ce
4 changed files with 18 additions and 17 deletions

View File

@ -26,8 +26,8 @@ ENABLE_NO_SCAN_TIMEOUT := 1
ENABLE_AM_FIX := 1 ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 1 ENABLE_AM_FIX_SHOW_DATA := 1
ENABLE_SQUELCH1_LOWER := 0 ENABLE_SQUELCH1_LOWER := 0
ENABLE_RSSI_BAR := 0 ENABLE_RSSI_BAR := 1
ENABLE_AUDIO_BAR := 0 ENABLE_AUDIO_BAR := 1
#ENABLE_COPY_CHAN_TO_VFO := 1 #ENABLE_COPY_CHAN_TO_VFO := 1
#ENABLE_SINGLE_VFO_CHAN := 1 #ENABLE_SINGLE_VFO_CHAN := 1
#ENABLE_BAND_SCOPE := 1 #ENABLE_BAND_SCOPE := 1

Binary file not shown.

Binary file not shown.

View File

@ -120,6 +120,7 @@ bool center_line_is_free = true;
void UI_DisplayRSSIBar(const int16_t rssi, const bool now) void UI_DisplayRSSIBar(const int16_t rssi, const bool now)
{ {
const int16_t s0_dBm = -127; // S0 .. base level const int16_t s0_dBm = -127; // S0 .. base level
// const int16_t s0_dBm = -147; // S0 .. base level
const int16_t s9_dBm = s0_dBm + (6 * 9); // S9 .. 6dB/S-Point const int16_t s9_dBm = s0_dBm + (6 * 9); // S9 .. 6dB/S-Point
const int16_t bar_max_dBm = s9_dBm + 30; // S9+30dB const int16_t bar_max_dBm = s9_dBm + 30; // S9+30dB
@ -131,8 +132,8 @@ bool center_line_is_free = true;
const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph
const unsigned int bar_width = LCD_WIDTH - 1 - bar_x; const unsigned int bar_width = LCD_WIDTH - 1 - bar_x;
const int16_t dBm = (rssi / 2) - 160; const int16_t rssi_dBm = (rssi / 2) - 160;
const int16_t clamped_dBm = (dBm <= bar_min_dBm) ? bar_min_dBm : (dBm >= bar_max_dBm) ? bar_max_dBm : dBm; const int16_t clamped_dBm = (rssi_dBm <= bar_min_dBm) ? bar_min_dBm : (rssi_dBm >= bar_max_dBm) ? bar_max_dBm : rssi_dBm;
const unsigned int bar_range_dB = bar_max_dBm - bar_min_dBm; const unsigned int bar_range_dB = bar_max_dBm - bar_min_dBm;
const unsigned int len = ((clamped_dBm - bar_min_dBm) * bar_width) / bar_range_dB; const unsigned int len = ((clamped_dBm - bar_min_dBm) * bar_width) / bar_range_dB;
@ -141,26 +142,26 @@ bool center_line_is_free = true;
char s[16]; char s[16];
unsigned int i; unsigned int i;
unsigned int s_level = 0; // S0
if (gEeprom.KEY_LOCK && gKeypadLocked > 0) if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
return; // display is in use return; // display is in use
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN) if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN)
return; // display is in use return; // display is in use
if (dBm >= (s9_dBm + 10)) // S9+10dB
s_level = ((dBm - s9_dBm) / 10) * 10;
else
if (dBm >= s0_dBm) // S0
s_level = (dBm - s0_dBm) / 6; // 6dB per S point
if (now) if (now)
memset(pLine, 0, LCD_WIDTH); memset(pLine, 0, LCD_WIDTH);
if (s_level < 10) if (rssi_dBm >= (s9_dBm + 6))
sprintf(s, "%-4d S%u ", dBm, s_level); // S0 ~ S9 { // S9+XXdB, 1dB increment
const char *fmt[] = {"%-4d +%u ", "%-4d +%u "};
const unsigned int dB = rssi_dBm - s9_dBm;
sprintf(s, (dB < 10) ? fmt[0] : fmt[1], rssi_dBm, dB);
}
else else
sprintf(s, "%-4d +%2u", dBm, s_level); // S9+XX { // S0 ~ S9, 6dB per S-point
const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0;
sprintf(s, "%-4d S%u ", rssi_dBm, s_level);
}
UI_PrintStringSmall(s, 2, 0, line); UI_PrintStringSmall(s, 2, 0, line);
#if 1 #if 1