mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
RSSI bar now showing in single VFO mode
This commit is contained in:
parent
f371a2a16f
commit
11626d232c
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -86,7 +86,7 @@ void SETTINGS_save_vfo_indices(void)
|
||||
void SETTINGS_save_attributes(void)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int index = (unsigned int )(((uint8_t *)&g_eeprom.config.channel_attributes) - ((uint8_t *)&g_eeprom));
|
||||
unsigned int index = (unsigned int)(((uint8_t *)&g_eeprom.config.channel_attributes) - ((uint8_t *)&g_eeprom));
|
||||
index &= ~7u;
|
||||
for (i = 0; i < sizeof(g_eeprom.config.channel_attributes); i += 8)
|
||||
EEPROM_WriteBuffer8(index + i, ((uint8_t *)&g_eeprom) + index + i);
|
||||
@ -105,7 +105,7 @@ void SETTINGS_read_eeprom(void)
|
||||
{
|
||||
unsigned int index;
|
||||
|
||||
// read the entire EEPROM contents into memory as a whole
|
||||
// read the entire EEPROM contents into memory
|
||||
for (index = 0; index < sizeof(g_eeprom); index += 128)
|
||||
EEPROM_ReadBuffer(index, (uint8_t *)(&g_eeprom) + index, 128);
|
||||
|
||||
|
256
ui/main.c
256
ui/main.c
@ -215,7 +215,7 @@ void draw_bar(uint8_t *line, const int len, const int max_width)
|
||||
const unsigned int len = ((clamped_dBm - bar_min_dBm) * bar_width) / bar_range_dB;
|
||||
|
||||
#ifdef ENABLE_SINGLE_VFO_CHAN
|
||||
const unsigned int line = (single_vfo >= 0 && !pan_enabled) ? 7 : 3;
|
||||
const unsigned int line = (single_vfo >= 0 && !pan_enabled) ? 6 : 3;
|
||||
#else
|
||||
const unsigned int line = 3;
|
||||
#endif
|
||||
@ -281,6 +281,11 @@ void UI_update_rssi(const int rssi, const unsigned int glitch, const unsigned in
|
||||
(void)noise;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SINGLE_VFO_CHAN
|
||||
if (single_vfo >= 0 && !pan_enabled)
|
||||
return;
|
||||
#endif
|
||||
|
||||
{ // original little RSSI bars
|
||||
|
||||
#ifdef ENABLE_SINGLE_VFO_CHAN
|
||||
@ -507,6 +512,123 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int
|
||||
}
|
||||
#endif
|
||||
|
||||
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) ? true : false;
|
||||
|
||||
if (g_center_line != CENTER_LINE_NONE ||
|
||||
g_current_display_screen != DISPLAY_MAIN ||
|
||||
g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// we're free to use the middle line
|
||||
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
// show the TX audio level
|
||||
if (UI_DisplayAudioBar(false))
|
||||
{
|
||||
g_center_line = CENTER_LINE_AUDIO_BAR;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MDC1200
|
||||
if (mdc1200_rx_ready_tick_500ms > 0)
|
||||
{
|
||||
g_center_line = CENTER_LINE_MDC1200;
|
||||
#ifdef ENABLE_MDC1200_SHOW_OP_ARG
|
||||
sprintf(str, "MDC1200 %02X %02X %04X", mdc1200_op, mdc1200_arg, mdc1200_unit_id);
|
||||
#else
|
||||
sprintf(str, "MDC1200 ID %04X", mdc1200_unit_id);
|
||||
#endif
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
UI_PrintStringSmallBold(str, 2, 0, 3);
|
||||
#else
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_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)
|
||||
{
|
||||
g_center_line = CENTER_LINE_AM_FIX_DATA;
|
||||
AM_fix_print_data(g_rx_vfo_num, str);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
// show the RX RSSI dBm, S-point and signal strength bar graph
|
||||
if (rx && g_eeprom.config.setting.enable_rssi_bar)
|
||||
{
|
||||
const int rssi_level = (g_tx_vfo->channel_attributes.band < 3) ? g_current_rssi[g_rx_vfo_num] + rssi_offset_band_123 : g_current_rssi[g_rx_vfo_num] + rssi_offset_band_4567;
|
||||
g_center_line = CENTER_LINE_RSSI;
|
||||
UI_DisplayRSSIBar(rssi_level, g_current_glitch[g_rx_vfo_num], g_current_noise[g_rx_vfo_num], false);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if (rx || g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_POWER_SAVE)
|
||||
{
|
||||
#ifdef ENABLE_DTMF_LIVE_DECODER
|
||||
#if 1
|
||||
if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_live[0] != 0)
|
||||
{ // show live DTMF decode
|
||||
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
|
||||
|
||||
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return;
|
||||
|
||||
g_center_line = CENTER_LINE_DTMF_DEC;
|
||||
|
||||
strcpy(str, "DTMF ");
|
||||
strcat(str, g_dtmf_rx_live + idx);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
#else
|
||||
if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_index > 0)
|
||||
{ // show live DTMF decode
|
||||
const unsigned int len = g_dtmf_rx_index;
|
||||
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)
|
||||
return;
|
||||
|
||||
g_center_line = CENTER_LINE_DTMF_DEC;
|
||||
|
||||
strcpy(str, "DTMF ");
|
||||
strcat(str, g_dtmf_rx + idx);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SHOW_CHARGE_LEVEL
|
||||
else
|
||||
if (g_charging_with_type_c)
|
||||
{ // show the battery charge state
|
||||
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return;
|
||||
|
||||
g_center_line = CENTER_LINE_CHARGE_DATA;
|
||||
|
||||
sprintf(str, "Charge %u.%02uV %u%%",
|
||||
g_battery_voltage_average / 100, g_battery_voltage_average % 100,
|
||||
BATTERY_VoltsToPercent(g_battery_voltage_average));
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"};
|
||||
|
||||
#ifdef ENABLE_SINGLE_VFO_CHAN
|
||||
@ -849,6 +971,8 @@ const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALA
|
||||
#endif
|
||||
}
|
||||
|
||||
UI_DisplayCenterLine();
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
#endif
|
||||
@ -916,18 +1040,15 @@ void UI_DisplayMain(void)
|
||||
|
||||
#if ENABLE_SINGLE_VFO_CHAN
|
||||
#ifdef ENABLE_PANADAPTER
|
||||
if (single_vfo >= 0 && !pan_enabled)
|
||||
{
|
||||
UI_DisplayMainSingle();
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (single_vfo >= 0)
|
||||
{
|
||||
UI_DisplayMainSingle();
|
||||
return;
|
||||
}
|
||||
if (!pan_enabled)
|
||||
#endif
|
||||
{
|
||||
if (single_vfo >= 0)
|
||||
{
|
||||
UI_DisplayMainSingle();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (vfo_num = 0; vfo_num < 2; vfo_num++)
|
||||
@ -1415,116 +1536,7 @@ void UI_DisplayMain(void)
|
||||
|
||||
// *************************************************
|
||||
|
||||
if (g_center_line == CENTER_LINE_NONE &&
|
||||
g_current_display_screen == DISPLAY_MAIN &&
|
||||
g_dtmf_call_state == DTMF_CALL_STATE_NONE)
|
||||
{ // we're free to use the middle line
|
||||
|
||||
// const bool rx = (g_current_function == FUNCTION_RECEIVE && g_squelch_open) ? true : false;
|
||||
const bool rx = (g_current_function == FUNCTION_RECEIVE) ? true : false;
|
||||
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
// show the TX audio level
|
||||
if (UI_DisplayAudioBar(false))
|
||||
{
|
||||
g_center_line = CENTER_LINE_AUDIO_BAR;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MDC1200
|
||||
if (mdc1200_rx_ready_tick_500ms > 0)
|
||||
{
|
||||
g_center_line = CENTER_LINE_MDC1200;
|
||||
#ifdef ENABLE_MDC1200_SHOW_OP_ARG
|
||||
sprintf(str, "MDC1200 %02X %02X %04X", mdc1200_op, mdc1200_arg, mdc1200_unit_id);
|
||||
#else
|
||||
sprintf(str, "MDC1200 ID %04X", mdc1200_unit_id);
|
||||
#endif
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
UI_PrintStringSmallBold(str, 2, 0, 3);
|
||||
#else
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_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)
|
||||
{
|
||||
g_center_line = CENTER_LINE_AM_FIX_DATA;
|
||||
AM_fix_print_data(g_rx_vfo_num, str);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
// show the RX RSSI dBm, S-point and signal strength bar graph
|
||||
if (rx && g_eeprom.config.setting.enable_rssi_bar)
|
||||
{
|
||||
const int rssi_level = (g_tx_vfo->channel_attributes.band < 3) ? g_current_rssi[g_rx_vfo_num] + rssi_offset_band_123 : g_current_rssi[g_rx_vfo_num] + rssi_offset_band_4567;
|
||||
g_center_line = CENTER_LINE_RSSI;
|
||||
UI_DisplayRSSIBar(rssi_level, g_current_glitch[g_rx_vfo_num], g_current_noise[g_rx_vfo_num], false);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if (rx || g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_POWER_SAVE)
|
||||
{
|
||||
#ifdef ENABLE_DTMF_LIVE_DECODER
|
||||
#if 1
|
||||
if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_live[0] != 0)
|
||||
{ // show live DTMF decode
|
||||
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
|
||||
|
||||
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return;
|
||||
|
||||
g_center_line = CENTER_LINE_DTMF_DEC;
|
||||
|
||||
strcpy(str, "DTMF ");
|
||||
strcat(str, g_dtmf_rx_live + idx);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
#else
|
||||
if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_index > 0)
|
||||
{ // show live DTMF decode
|
||||
const unsigned int len = g_dtmf_rx_index;
|
||||
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)
|
||||
return;
|
||||
|
||||
g_center_line = CENTER_LINE_DTMF_DEC;
|
||||
|
||||
strcpy(str, "DTMF ");
|
||||
strcat(str, g_dtmf_rx + idx);
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SHOW_CHARGE_LEVEL
|
||||
else
|
||||
if (g_charging_with_type_c)
|
||||
{ // show the battery charge state
|
||||
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
return;
|
||||
|
||||
g_center_line = CENTER_LINE_CHARGE_DATA;
|
||||
|
||||
sprintf(str, "Charge %u.%02uV %u%%",
|
||||
g_battery_voltage_average / 100, g_battery_voltage_average % 100,
|
||||
BATTERY_VoltsToPercent(g_battery_voltage_average));
|
||||
UI_PrintStringSmall(str, 2, 0, 3);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
UI_DisplayCenterLine();
|
||||
|
||||
#ifdef ENABLE_PANADAPTER
|
||||
UI_DisplayMain_pan(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user