0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-27 22:01:26 +03:00

single VFO display update

This commit is contained in:
OneOfEleven 2023-12-03 08:12:55 +00:00
parent 4094ae1e93
commit 1bff1b5cb1
6 changed files with 77 additions and 74 deletions

View File

@ -43,7 +43,7 @@ ENABLE_BIG_FREQ := 0
ENABLE_DTMF_LIVE_DECODER := 0
ENABLE_SHOW_FREQS_CHAN := 0
# smaa bolf 580 B
ENABLE_SMALL_BOLD := 1
ENABLE_SMALL_BOLD := 0
# smallest font 2 kB
ENABLE_SMALLEST_FONT := 0
# trim trailing 44 B
@ -66,8 +66,10 @@ ENABLE_REVERSE_BAT_SYMBOL := 0
ENABLE_FREQ_SEARCH_LNA := 0
ENABLE_FREQ_SEARCH_TIMEOUT := 0
ENABLE_CODE_SEARCH_TIMEOUT := 0
ENABLE_SCAN_IGNORE_LIST := 1
ENABLE_SCAN_RANGES := 1
# scan ignore list 740 B
ENABLE_SCAN_IGNORE_LIST := 0
# scan ranges 400 B
ENABLE_SCAN_RANGES := 0
# Kill and Revive 400 B
ENABLE_KILL_REVIVE := 0
# AM Fix 800 B
@ -83,9 +85,10 @@ ENABLE_TX_AUDIO_BAR := 0
ENABLE_SIDE_BUTT_MENU := 0
# Key Lock 400 B
ENABLE_KEYLOCK := 0
ENABLE_PANADAPTER := 0
# panadapter 1.5kB
ENABLE_PANADAPTER := 1
ENABLE_PANADAPTER_PEAK_FREQ := 0
# single VFO 1.4 kB
# single VFO 1.5kB
ENABLE_SINGLE_VFO_CHAN := 1
#############################################################

View File

@ -2863,7 +2863,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
if (g_eeprom.config.setting.repeater_tail_tone_elimination == 0)
FUNCTION_Select(FUNCTION_FOREGROUND);
else
g_rtte_count_down = g_eeprom.config.setting.repeater_tail_tone_elimination * 10;
g_rtte_count_down = g_eeprom.config.setting.repeater_tail_tone_elimination * 10;
if (Key == KEY_PTT)
g_ptt_was_pressed = true;
@ -3051,8 +3051,8 @@ Skip:
if (g_update_menu)
{
g_update_menu = false;
g_menu_tick_10ms = menu_timeout_500ms;
g_update_menu = false;
g_menu_tick_10ms = menu_timeout_500ms;
MENU_ShowCurrentSetting();
}

View File

@ -42,28 +42,13 @@ void EEPROM_WriteBuffer8(const uint16_t address, const void *p_buffer)
if (p_buffer == NULL || (address + 8) > 0x2000)
return;
#if 0
// normal way
I2C_Start();
I2C_Write(0xA0);
I2C_Write((address >> 8) & 0xFF);
I2C_Write((address >> 0) & 0xFF);
I2C_WriteBuffer(p_buffer, 8);
I2C_Stop();
// give the EEPROM time to burn the data in (apparently takes 1.5ms ~ 5ms)
SYSTEM_DelayMs(6);
#else
#if 1
// eeprom wear reduction
// only write the data if it's different to what's already there
uint8_t buffer[8];
EEPROM_ReadBuffer(address, buffer, 8);
if (memcmp(p_buffer, buffer, 8) != 0)
#endif
{
I2C_Start();
I2C_Write(0xA0);
@ -75,6 +60,4 @@ void EEPROM_WriteBuffer8(const uint16_t address, const void *p_buffer)
// give the EEPROM time to burn the data in (apparently takes 1.5ms ~ 5ms)
SYSTEM_DelayMs(6);
}
#endif
}

Binary file not shown.

Binary file not shown.

111
ui/main.c
View File

@ -642,10 +642,11 @@ const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALA
#ifdef ENABLE_SINGLE_VFO_CHAN
void UI_DisplayMainSingle(void)
{
const int vfo_num = g_eeprom.config.setting.tx_vfo_num;
const unsigned int scrn_chan = g_eeprom.config.setting.indices.vfo[vfo_num].screen;
const unsigned int state = g_vfo_state[vfo_num];
uint8_t *p_line1 = g_frame_buffer[1];
const int vfo_num = g_eeprom.config.setting.tx_vfo_num;
const unsigned int scrn_chan = g_eeprom.config.setting.indices.vfo[vfo_num].screen;
const unsigned int state = g_vfo_state[vfo_num];
bool tx_allowed = false;
uint8_t *p_line1 = g_frame_buffer[1];
char str[22];
#ifdef ENABLE_ALARM
@ -653,6 +654,16 @@ const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALA
state = VFO_STATE_ALARM;
#endif
#ifdef ENABLE_TX_WHEN_AM
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM)
if (FREQUENCY_tx_freq_check(g_vfo_info[vfo_num].p_tx->frequency) == 0)
tx_allowed = true;
#else
if ((state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) && g_vfo_info[vfo_num].channel.mod_mode == MOD_MODE_FM) // TX allowed only when FM
if (FREQUENCY_tx_freq_check(g_vfo_info[vfo_num].p_tx->frequency) == 0)
tx_allowed = true;
#endif
// ********************
{ // top line
@ -942,57 +953,63 @@ const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALA
// ***************************************
x = 2;
x = 0;
y++;
#ifdef ENABLE_TX_WHEN_AM
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM)
#else
if ((state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) && g_vfo_info[vfo_num].channel.mod_mode == MOD_MODE_FM) // TX allowed only when FM
#endif
{
if (FREQUENCY_tx_freq_check(g_vfo_info[vfo_num].p_tx->frequency) == 0)
{ // TX power
const char *pwr_list[] = {"LOW", "MID", "HIGH", "U"};
const unsigned int i = g_vfo_info[vfo_num].channel.tx_power;
strcpy(str, pwr_list[i]);
if (i == OUTPUT_POWER_USER)
sprintf(str + strlen(str), "%03u", g_tx_vfo->channel.tx_power_user);
UI_PrintStringSmall(str, x, 0, y);
if (tx_allowed)
{ // TX power
const char *pwr_list[] = {"LOW", "MID", "HIGH", "U"};
const unsigned int i = g_vfo_info[vfo_num].channel.tx_power;
strcpy(str, pwr_list[i]);
if (i == OUTPUT_POWER_USER)
sprintf(str + strlen(str), "%03u", g_tx_vfo->channel.tx_power_user);
UI_PrintStringSmall(str, x, 0, y);
}
x += 7 * 5;
if (g_vfo_info[vfo_num].freq_config_rx.frequency != g_vfo_info[vfo_num].freq_config_tx.frequency)
{ // TX offset symbol
const char *dir_list[] = {"", "+", "-"};
const unsigned int i = g_vfo_info[vfo_num].channel.tx_offset_dir;
UI_PrintStringSmall(dir_list[i], x + (7 * 5), 0, y);
}
// reverse offset symbol
if (g_vfo_info[vfo_num].channel.frequency_reverse)
UI_PrintStringSmall("R", x, 0, y);
x += 7 * 1;
if (tx_allowed && g_vfo_info[vfo_num].freq_config_rx.frequency != g_vfo_info[vfo_num].freq_config_tx.frequency)
{ // TX offset symbol
const char *dir_list[] = {"", "+", "-"};
const unsigned int i = g_vfo_info[vfo_num].channel.tx_offset_dir;
UI_PrintStringSmall(dir_list[i], x, 0, y);
}
x += 7 * 1;
if (g_vfo_info[vfo_num].channel.tx_offset_dir != TX_OFFSET_FREQ_DIR_OFF)
{ // TX/RX offset
const uint32_t ofs = g_vfo_info[vfo_num].channel.tx_offset / 1000;
if (ofs < 10 || (ofs % 100))
{
sprintf(str, "%u.%02u", ofs / 100, ofs % 100);
NUMBER_trim_trailing_zeros(str);
}
}
{ // TX/RX reverse symbol
x += 7 * 7;
if (g_vfo_info[vfo_num].channel.frequency_reverse)
UI_PrintStringSmall("R", x, 0, y);
}
{ // wide/narrow band symbol
x += 7 * 2;
strcpy(str, " ");
if (g_vfo_info[vfo_num].channel.channel_bandwidth == BANDWIDTH_WIDE)
str[0] = 'W';
else
if (g_vfo_info[vfo_num].channel.channel_bandwidth == BANDWIDTH_NARROW)
str[0] = 'N';
sprintf(str, "%3u", ofs / 100);
UI_PrintStringSmall(str, x, 0, y);
}
x += 7 * 5;
{ // DTMF decoding symbol
str[0] = 0;
if (g_vfo_info[vfo_num].channel.dtmf_decoding_enable)
strcpy(str, "DTMF");
x += 7 * 2;
UI_PrintStringSmall(str, x, 0, y);
}
// wide/narrow band symbol
strcpy(str, " ");
if (g_vfo_info[vfo_num].channel.channel_bandwidth == BANDWIDTH_WIDE)
str[0] = 'W';
else
if (g_vfo_info[vfo_num].channel.channel_bandwidth == BANDWIDTH_NARROW)
str[0] = 'N';
UI_PrintStringSmall(str, x, 0, y);
x += 7 * 2;
// DTMF decoding symbol
str[0] = 0;
if (g_vfo_info[vfo_num].channel.dtmf_decoding_enable)
strcpy(str, "DTMF");
UI_PrintStringSmall(str, x, 0, y);
//x += 7 * 5;
}
UI_DisplayCenterLine();