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

Added menu option for the RSSI S-meter bar

This commit is contained in:
OneOfEleven 2023-10-17 12:04:54 +01:00
parent d47cd80fd4
commit ef313ceb57
13 changed files with 121 additions and 81 deletions

View File

@ -239,6 +239,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
case MENU_MIC_BAR: case MENU_MIC_BAR:
#endif #endif
#ifdef ENABLE_RSSI_BAR
case MENU_RSSI_BAR:
#endif
case MENU_BCL: case MENU_BCL:
case MENU_BEEP: case MENU_BEEP:
case MENU_AUTOLK: case MENU_AUTOLK:
@ -639,6 +642,12 @@ void MENU_AcceptSetting(void)
break; break;
#endif #endif
#ifdef ENABLE_RSSI_BAR
case MENU_RSSI_BAR:
g_setting_rssi_bar = g_sub_menu_selection;
break;
#endif
case MENU_COMPAND: case MENU_COMPAND:
g_tx_vfo->compander = g_sub_menu_selection; g_tx_vfo->compander = g_sub_menu_selection;
SETTINGS_UpdateChannel(g_tx_vfo->channel_save, g_tx_vfo, true); SETTINGS_UpdateChannel(g_tx_vfo->channel_save, g_tx_vfo, true);
@ -1091,6 +1100,12 @@ void MENU_ShowCurrentSetting(void)
break; break;
#endif #endif
#ifdef ENABLE_RSSI_BAR
case MENU_RSSI_BAR:
g_sub_menu_selection = g_setting_rssi_bar;
break;
#endif
case MENU_COMPAND: case MENU_COMPAND:
g_sub_menu_selection = g_tx_vfo->compander; g_sub_menu_selection = g_tx_vfo->compander;
return; return;

View File

@ -735,7 +735,10 @@ void BOARD_EEPROM_load(void)
g_setting_174_tx_enable = (Data[3] < 2) ? Data[3] : false; g_setting_174_tx_enable = (Data[3] < 2) ? Data[3] : false;
g_setting_470_tx_enable = (Data[4] < 2) ? Data[4] : false; g_setting_470_tx_enable = (Data[4] < 2) ? Data[4] : false;
g_setting_350_enable = (Data[5] < 2) ? Data[5] : true; g_setting_350_enable = (Data[5] < 2) ? Data[5] : true;
g_setting_scramble_enable = (Data[6] < 2) ? Data[6] : true; g_setting_scramble_enable = (Data[6] & (1u << 0)) ? true : false;
#ifdef ENABLE_RSSI_BAR
g_setting_rssi_bar = (Data[6] & (1u << 1)) ? true : false;
#endif
g_setting_tx_enable = (Data[7] & (1u << 0)) ? true : false; g_setting_tx_enable = (Data[7] & (1u << 0)) ? true : false;
g_setting_live_dtmf_decoder = (Data[7] & (1u << 1)) ? true : false; g_setting_live_dtmf_decoder = (Data[7] & (1u << 1)) ? true : false;
g_setting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2; g_setting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2;

Binary file not shown.

Binary file not shown.

View File

@ -155,7 +155,7 @@ void FUNCTION_Select(function_type_t Function)
UART_SendText("func power save\r\n"); UART_SendText("func power save\r\n");
#endif #endif
g_power_save_10ms = g_eeprom.battery_save * 10; g_power_save_10ms = g_eeprom.battery_save * 10;
g_power_save_expired = false; g_power_save_expired = false;
g_rx_idle_mode = true; g_rx_idle_mode = true;
@ -177,7 +177,8 @@ void FUNCTION_Select(function_type_t Function)
UART_SendText("func transmit\r\n"); UART_SendText("func transmit\r\n");
#endif #endif
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11 // if DTMF is enabled when TX'ing, it changes the TX audio filtering ! .. 1of11
// so MAKE SURE that DTMF is disabled - until needed
BK4819_DisableDTMF(); BK4819_DisableDTMF();
// clear the DTMF RX buffer // clear the DTMF RX buffer

3
misc.c
View File

@ -109,6 +109,9 @@ uint8_t g_setting_backlight_on_tx_rx;
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
bool g_setting_mic_bar; bool g_setting_mic_bar;
#endif #endif
#ifdef ENABLE_RSSI_BAR
bool g_setting_rssi_bar;
#endif
bool g_setting_live_dtmf_decoder; bool g_setting_live_dtmf_decoder;
uint8_t g_setting_battery_text; uint8_t g_setting_battery_text;

3
misc.h
View File

@ -190,6 +190,9 @@ extern uint8_t g_setting_backlight_on_tx_rx;
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
extern bool g_setting_mic_bar; extern bool g_setting_mic_bar;
#endif #endif
#ifdef ENABLE_RSSI_BAR
extern bool g_setting_rssi_bar;
#endif
extern bool g_setting_live_dtmf_decoder; extern bool g_setting_live_dtmf_decoder;
extern uint8_t g_setting_battery_text; extern uint8_t g_setting_battery_text;

View File

@ -318,9 +318,12 @@ void SETTINGS_SaveSettings(void)
State[3] = g_setting_174_tx_enable; State[3] = g_setting_174_tx_enable;
State[4] = g_setting_470_tx_enable; State[4] = g_setting_470_tx_enable;
State[5] = g_setting_350_enable; State[5] = g_setting_350_enable;
State[6] = g_setting_scramble_enable; if (!g_setting_scramble_enable) State[6] &= ~(1u << 0);
#ifdef ENABLE_RSSI_BAR
if (!g_setting_rssi_bar) State[6] &= ~(1u << 1);
#endif
if (!g_setting_tx_enable) State[7] &= ~(1u << 0); if (!g_setting_tx_enable) State[7] &= ~(1u << 0);
if (!g_setting_live_dtmf_decoder) State[7] &= ~(1u << 1); if (!g_setting_live_dtmf_decoder) State[7] &= ~(1u << 1);
State[7] = (State[7] & ~(3u << 2)) | ((g_setting_battery_text & 3u) << 2); State[7] = (State[7] & ~(3u << 2)) | ((g_setting_battery_text & 3u) << 2);
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
if (!g_setting_mic_bar) State[7] &= ~(1u << 4); if (!g_setting_mic_bar) State[7] &= ~(1u << 4);

View File

@ -386,12 +386,19 @@ typedef struct {
// 0x0F40 // 0x0F40
uint8_t freq_lock; // uint8_t freq_lock; //
uint8_t enable_tx_350; // 350MHz ~ 400MHz uint8_t enable_tx_350:1; // 350MHz ~ 400MHz
uint8_t radio_disabled; // 0 = not radio is not disabled uint8_t unused11a:7; //
uint8_t enable_tx_200; // 174MHz ~ 350MHz uint8_t radio_disabled:1; // 0 = not radio is not disabled
uint8_t enable_tx_470; // >= 470MHz disabled uint8_t unused11b:7; //
uint8_t enable_350; // 0 = 350HMz ~ 400MHz RX/TX disabled uint8_t enable_tx_200:1; // 174MHz ~ 350MHz
uint8_t enable_scrambler; // 0 = scrambler disabled, 1 = enabled uint8_t unused11c:7; //
uint8_t enable_tx_470:1; // >= 470MHz disabled
uint8_t unused11d:7; //
uint8_t enable_350:1; // 0 = 350HMz ~ 400MHz RX/TX disabled
uint8_t unused11e:7; //
uint8_t enable_scrambler:1; // 0 = scrambler disabled, 1 = enabled
uint8_t enable_rssi_bar:1; // 0 = disabled .. 1of11
uint8_t unused11f:6; //
#if 0 #if 0
// QS // QS
uint8_t unused12[9]; // 0xff's uint8_t unused12[9]; // 0xff's

View File

@ -236,58 +236,61 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
#ifdef ENABLE_RSSI_BAR #ifdef ENABLE_RSSI_BAR
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 if (g_setting_rssi_bar)
const int16_t s0_dBm = -147; // 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
// const int16_t bar_min_dBm = s0_dBm + (6 * 0); // S0 // const int16_t bar_min_dBm = s0_dBm + (6 * 0); // S0
const int16_t bar_min_dBm = s0_dBm + (6 * 4); // S4 const int16_t bar_min_dBm = s0_dBm + (6 * 4); // S4
// ************ // ************
const unsigned int txt_width = 7 * 8; // 8 text chars const unsigned int txt_width = 7 * 8; // 8 text chars
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 rssi_dBm = (rssi / 2) - 160; const int16_t rssi_dBm = (rssi / 2) - 160;
const int16_t clamped_dBm = (rssi_dBm <= bar_min_dBm) ? bar_min_dBm : (rssi_dBm >= bar_max_dBm) ? bar_max_dBm : rssi_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;
const unsigned int line = 3; const unsigned int line = 3;
uint8_t *p_line = g_frame_buffer[line]; uint8_t *p_line = g_frame_buffer[line];
char s[16]; char s[16];
if (g_eeprom.key_lock && g_keypad_locked > 0) if (g_eeprom.key_lock && g_keypad_locked > 0)
return; // display is in use return; // display is in use
if (g_current_function == FUNCTION_TRANSMIT || if (g_current_function == FUNCTION_TRANSMIT ||
g_screen_to_display != DISPLAY_MAIN || g_screen_to_display != DISPLAY_MAIN ||
g_dtmf_call_state != DTMF_CALL_STATE_NONE) g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return; // display is in use return; // display is in use
if (now) if (now)
memset(p_line, 0, LCD_WIDTH); memset(p_line, 0, LCD_WIDTH);
if (rssi_dBm >= (s9_dBm + 6)) if (rssi_dBm >= (s9_dBm + 6))
{ // S9+XXdB, 1dB increment { // S9+XXdB, 1dB increment
const char *fmt[] = {"%3d 9+%u ", "%3d 9+%2u "}; const char *fmt[] = {"%3d 9+%u ", "%3d 9+%2u "};
const unsigned int s9_dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99; const unsigned int s9_dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
sprintf(s, (s9_dB < 10) ? fmt[0] : fmt[1], rssi_dBm, s9_dB); sprintf(s, (s9_dB < 10) ? fmt[0] : fmt[1], rssi_dBm, s9_dB);
}
else
{ // 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);
draw_bar(p_line + bar_x, len, bar_width);
if (now)
ST7565_BlitFullScreen();
} }
else
{ // 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);
draw_bar(p_line + bar_x, len, bar_width);
if (now)
ST7565_BlitFullScreen();
} }
#endif #endif

View File

@ -70,8 +70,8 @@ const t_menu_item g_menu_list[] =
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
{"VOX", VOICE_ID_VOX, MENU_VOX }, {"VOX", VOICE_ID_VOX, MENU_VOX },
#endif #endif
{"BLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR" {"BL ", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
{"BLTTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX }, {"BL TRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX },
{"CTRAST", VOICE_ID_INVALID, MENU_CONTRAST }, {"CTRAST", VOICE_ID_INVALID, MENU_CONTRAST },
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP }, {"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@ -84,10 +84,13 @@ const t_menu_item g_menu_list[] =
{"STE", VOICE_ID_INVALID, MENU_STE }, {"STE", VOICE_ID_INVALID, MENU_STE },
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE }, {"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
{"MIC", VOICE_ID_INVALID, MENU_MIC }, {"MIC", VOICE_ID_INVALID, MENU_MIC },
#ifdef ENABLE_AUDIO_BAR
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
#endif
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND }, {"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
#ifdef ENABLE_AUDIO_BAR
{"Tx BAR", VOICE_ID_INVALID, MENU_MIC_BAR },
#endif
#ifdef ENABLE_RSSI_BAR
{"Rx BAR", VOICE_ID_INVALID, MENU_RSSI_BAR },
#endif
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL }, {"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST }, {"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 }, {"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
@ -549,12 +552,6 @@ void UI_DisplayMenu(void)
} }
break; break;
#ifdef ENABLE_AUDIO_BAR
case MENU_MIC_BAR:
strcpy(String, g_sub_menu_off_on[g_sub_menu_selection]);
break;
#endif
case MENU_STEP: case MENU_STEP:
sprintf(String, "%d.%02ukHz", STEP_FREQ_TABLE[g_sub_menu_selection] / 100, STEP_FREQ_TABLE[g_sub_menu_selection] % 100); sprintf(String, "%d.%02ukHz", STEP_FREQ_TABLE[g_sub_menu_selection] / 100, STEP_FREQ_TABLE[g_sub_menu_selection] % 100);
break; break;
@ -704,13 +701,19 @@ void UI_DisplayMenu(void)
break; break;
case MENU_CONTRAST: case MENU_CONTRAST:
strcpy(String, "DISPLAY\nCONTRAST\n"); strcpy(String, "CONTRAST\n");
sprintf(String, "%d", g_sub_menu_selection); sprintf(String + strlen(String), "%d", g_sub_menu_selection);
//g_setting_contrast = g_sub_menu_selection //g_setting_contrast = g_sub_menu_selection
ST7565_SetContrast(g_sub_menu_selection); ST7565_SetContrast(g_sub_menu_selection);
g_update_display = true; g_update_display = true;
break; break;
#ifdef ENABLE_AUDIO_BAR
case MENU_MIC_BAR:
#endif
#ifdef ENABLE_RSSI_BAR
case MENU_RSSI_BAR:
#endif
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
case MENU_AM_FIX: case MENU_AM_FIX:
#endif #endif

View File

@ -82,6 +82,9 @@ enum
MENU_MIC_BAR, MENU_MIC_BAR,
#endif #endif
MENU_COMPAND, MENU_COMPAND,
#ifdef ENABLE_RSSI_BAR
MENU_RSSI_BAR,
#endif
MENU_1_CALL, MENU_1_CALL,
MENU_S_LIST, MENU_S_LIST,
MENU_SLIST1, MENU_SLIST1,

View File

@ -1,14 +1,10 @@
#ifdef GIT_HASH #define __VER__ GIT_HASH
#define __VER__ GIT_HASH
#else
#define __VER__ "231012"
#endif
//#define __VER_PREFIX__ "OEFW-" //#define __VER_PREFIX__ "OEFW-"
#define __VER_PREFIX__ "1o11-" #define __VER_PREFIX__ "1o11-"
const char Version_str[] = __VER_PREFIX__ __VER__; const char Version_str[] = __VER_PREFIX__ __VER__;
#if defined(ENABLE_UART) #if defined(ENABLE_UART)
const char UART_Version_str[] = "UV-K5 Firmware, Open Edition, " __VER_PREFIX__ __VER__ ", " __DATE__ " " __TIME__; const char UART_Version_str[] = "UV-K5 Firmware, Open Edition, " __VER_PREFIX__ __VER__ ", " __DATE__ " " __TIME__;
#endif #endif