0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +03:00

fixed audio line, MDC etc center line in single VFO mode

This commit is contained in:
OneOfEleven
2023-11-30 13:04:38 +00:00
parent 11626d232c
commit e83aac104f
3 changed files with 34 additions and 21 deletions

Binary file not shown.

Binary file not shown.

View File

@ -118,7 +118,11 @@ void draw_bar(uint8_t *line, const int len, const int max_width)
if (g_eeprom.config.setting.mic_bar) if (g_eeprom.config.setting.mic_bar)
{ {
const unsigned int line = 3; #ifdef ENABLE_SINGLE_VFO_CHAN
const unsigned int line = (single_vfo >= 0 && !pan_enabled) ? 6 : 3;
#else
const unsigned int line = 3;
#endif
const unsigned int txt_width = 7 * 3; // 3 text chars const unsigned int txt_width = 7 * 3; // 3 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;
@ -513,10 +517,19 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int
#endif #endif
void UI_DisplayCenterLine(void) void UI_DisplayCenterLine(void)
{ {
// const bool rx = (g_current_function == FUNCTION_RECEIVE && g_squelch_open) ? true : false; // const bool rx = (g_current_function == FUNCTION_RECEIVE && g_squelch_open) ? true : false;
const bool rx = (g_current_function == FUNCTION_RECEIVE) ? true : false; const bool rx = (g_current_function == FUNCTION_RECEIVE) ? true : false;
#ifdef ENABLE_SINGLE_VFO_CHAN
const unsigned int line = (single_vfo >= 0 && !pan_enabled) ? 6 : 3;
#else
const unsigned int line = 3;
#endif
(void)rx;
(void)line;
if (g_center_line != CENTER_LINE_NONE || if (g_center_line != CENTER_LINE_NONE ||
g_current_display_screen != DISPLAY_MAIN || g_current_display_screen != DISPLAY_MAIN ||
g_dtmf_call_state != DTMF_CALL_STATE_NONE) g_dtmf_call_state != DTMF_CALL_STATE_NONE)
@ -534,7 +547,7 @@ void UI_DisplayCenterLine(void)
} }
else else
#endif #endif
#ifdef ENABLE_MDC1200 #ifdef ENABLE_MDC1200
if (mdc1200_rx_ready_tick_500ms > 0) if (mdc1200_rx_ready_tick_500ms > 0)
{ {
@ -545,25 +558,25 @@ void UI_DisplayCenterLine(void)
sprintf(str, "MDC1200 ID %04X", mdc1200_unit_id); sprintf(str, "MDC1200 ID %04X", mdc1200_unit_id);
#endif #endif
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold(str, 2, 0, 3); UI_PrintStringSmallBold(str, 2, 0, line);
#else #else
UI_PrintStringSmall(str, 2, 0, 3); UI_PrintStringSmall(str, 2, 0, line);
#endif #endif
} }
else else
#endif #endif
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA) #if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
// show the AM-FIX debug data // show the AM-FIX debug data
if (rx && g_vfo_info[g_rx_vfo_num].mod_mode != MOD_MODE_FM && g_eeprom.config.setting.am_fix) if (rx && g_vfo_info[g_rx_vfo_num].mod_mode != MOD_MODE_FM && g_eeprom.config.setting.am_fix)
{ {
g_center_line = CENTER_LINE_AM_FIX_DATA; g_center_line = CENTER_LINE_AM_FIX_DATA;
AM_fix_print_data(g_rx_vfo_num, str); AM_fix_print_data(g_rx_vfo_num, str);
UI_PrintStringSmall(str, 2, 0, 3); UI_PrintStringSmall(str, 2, 0, line);
} }
else else
#endif #endif
#ifdef ENABLE_RX_SIGNAL_BAR #ifdef ENABLE_RX_SIGNAL_BAR
// show the RX RSSI dBm, S-point and signal strength bar graph // show the RX RSSI dBm, S-point and signal strength bar graph
if (rx && g_eeprom.config.setting.enable_rssi_bar) if (rx && g_eeprom.config.setting.enable_rssi_bar)
@ -574,7 +587,7 @@ void UI_DisplayCenterLine(void)
} }
else else
#endif #endif
if (rx || g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_POWER_SAVE) if (rx || g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_POWER_SAVE)
{ {
#ifdef ENABLE_DTMF_LIVE_DECODER #ifdef ENABLE_DTMF_LIVE_DECODER
@ -583,47 +596,47 @@ void UI_DisplayCenterLine(void)
{ // show live DTMF decode { // show live DTMF decode
const unsigned int len = strlen(g_dtmf_rx_live); const unsigned int len = strlen(g_dtmf_rx_live);
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE) if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return; return;
g_center_line = CENTER_LINE_DTMF_DEC; g_center_line = CENTER_LINE_DTMF_DEC;
strcpy(str, "DTMF "); strcpy(str, "DTMF ");
strcat(str, g_dtmf_rx_live + idx); strcat(str, g_dtmf_rx_live + idx);
UI_PrintStringSmall(str, 2, 0, 3); UI_PrintStringSmall(str, 2, 0, line);
} }
#else #else
if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_index > 0) if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_index > 0)
{ // show live DTMF decode { // show live DTMF decode
const unsigned int len = g_dtmf_rx_index; const unsigned int len = g_dtmf_rx_index;
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE) if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return; return;
g_center_line = CENTER_LINE_DTMF_DEC; g_center_line = CENTER_LINE_DTMF_DEC;
strcpy(str, "DTMF "); strcpy(str, "DTMF ");
strcat(str, g_dtmf_rx + idx); strcat(str, g_dtmf_rx + idx);
UI_PrintStringSmall(str, 2, 0, 3); UI_PrintStringSmall(str, 2, 0, line);
} }
#endif #endif
#endif #endif
#ifdef ENABLE_SHOW_CHARGE_LEVEL #ifdef ENABLE_SHOW_CHARGE_LEVEL
else else
if (g_charging_with_type_c) if (g_charging_with_type_c)
{ // show the battery charge state { // show the battery charge state
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE) if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return; return;
g_center_line = CENTER_LINE_CHARGE_DATA; g_center_line = CENTER_LINE_CHARGE_DATA;
sprintf(str, "Charge %u.%02uV %u%%", sprintf(str, "Charge %u.%02uV %u%%",
g_battery_voltage_average / 100, g_battery_voltage_average % 100, g_battery_voltage_average / 100, g_battery_voltage_average % 100,
BATTERY_VoltsToPercent(g_battery_voltage_average)); BATTERY_VoltsToPercent(g_battery_voltage_average));
UI_PrintStringSmall(str, 2, 0, 3); UI_PrintStringSmall(str, 2, 0, line);
} }
#endif #endif
} }