0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-18 22:29:50 +03:00

fix dual watch bug + other stuff

This commit is contained in:
OneOfEleven
2023-11-02 10:00:51 +00:00
parent b0f105572a
commit 2638d803c0
47 changed files with 1880 additions and 2385 deletions

View File

@ -34,7 +34,7 @@ void UI_DisplayFM(void)
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_keypad_locked > 0)
if (g_eeprom.config.setting.key_lock && g_keypad_locked > 0)
{ // tell user how to unlock the keyboard
backlight_turn_on(0);
UI_PrintString("Long press #", 0, LCD_WIDTH - 1, 1, 8);
@ -54,7 +54,7 @@ void UI_DisplayFM(void)
if (g_ask_to_save)
{
const unsigned int freq = g_eeprom.fm_frequency_playing;
const unsigned int freq = g_eeprom.config.setting.fm_radio.selected_frequency;
sprintf(str, "SAVE %u.%u ?", freq / 10, freq % 10);
}
else
@ -68,22 +68,22 @@ void UI_DisplayFM(void)
if (g_fm_scan_state_dir == FM_SCAN_STATE_DIR_OFF)
{
if (!g_eeprom.fm_channel_mode)
if (g_eeprom.config.setting.fm_radio.channel_mode == 0)
{
for (i = 0; i < ARRAY_SIZE(g_fm_channels); i++)
for (i = 0; i < ARRAY_SIZE(g_eeprom.config.setting.fm_channel); i++)
{
if (g_eeprom.fm_frequency_playing == g_fm_channels[i])
if (g_eeprom.config.setting.fm_radio.selected_frequency == g_eeprom.config.setting.fm_channel[i])
{
sprintf(str, "VFO (CH %u)", 1 + i);
break;
}
}
if (i >= ARRAY_SIZE(g_fm_channels))
if (i >= ARRAY_SIZE(g_eeprom.config.setting.fm_channel))
strcpy(str, "VFO");
}
else
sprintf(str, "CH %u", 1 + g_eeprom.fm_selected_channel);
sprintf(str, "CH %u", 1 + g_eeprom.config.setting.fm_radio.selected_channel);
}
else
if (!g_fm_auto_scan)
@ -102,13 +102,13 @@ void UI_DisplayFM(void)
if (g_ask_to_save)
{ // channel mode
const unsigned int chan = g_fm_channel_position;
const uint32_t freq = g_fm_channels[chan];
const uint32_t freq = g_eeprom.config.setting.fm_channel[chan];
UI_GenerateChannelString(str, chan, ' ');
if (FM_check_valid_channel(chan))
sprintf(str + strlen(str), " (%u.%u)", freq / 10, freq % 10);
}
else
if (g_eeprom.fm_channel_mode && g_input_box_index > 0)
if (g_eeprom.config.setting.fm_radio.channel_mode != 0 && g_input_box_index > 0)
{ // user is entering a channel number
UI_GenerateChannelString(str, g_fm_channel_position, ' ');
}
@ -117,7 +117,7 @@ void UI_DisplayFM(void)
{
if (g_input_box_index == 0)
{ // frequency mode
const uint32_t freq = g_eeprom.fm_frequency_playing;
const uint32_t freq = g_eeprom.config.setting.fm_radio.selected_frequency;
NUMBER_ToDigits(freq * 10000, str);
#ifdef ENABLE_TRIM_TRAILING_ZEROS
UI_DisplayFrequency(str, 30, 4, false, true);
@ -132,8 +132,8 @@ void UI_DisplayFM(void)
}
else
{ // delete channel
const uint32_t chan = g_eeprom.fm_selected_channel;
const uint32_t freq = g_fm_channels[chan];
const uint32_t chan = g_eeprom.config.setting.fm_radio.selected_channel;
const uint32_t freq = g_eeprom.config.setting.fm_channel[chan];
sprintf(str, "CH %u (%u.%u)", 1 + chan, freq / 10, freq % 10);
}

View File

@ -107,7 +107,7 @@ void UI_DisplayLock(void)
NUMBER_Get(g_input_box, &Password);
if ((g_eeprom.power_on_password * 100) == Password)
if ((g_eeprom.config.setting.power_on_password * 100) == Password)
{
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
return;

143
ui/main.c
View File

@ -85,11 +85,11 @@ void draw_bar(uint8_t *line, const int len, const int max_width)
if (g_center_line != CENTER_LINE_NONE && g_center_line != CENTER_LINE_TX_TIMEOUT)
return false;
if (g_eeprom.tx_timeout_timer == 0)
if (g_eeprom.config.setting.tx_timeout == 0)
timeout_secs = 30; // 30 sec
else
if (g_eeprom.tx_timeout_timer < (ARRAY_SIZE(g_sub_menu_tx_timeout) - 1))
timeout_secs = 60 * g_eeprom.tx_timeout_timer; // minutes
if (g_eeprom.config.setting.tx_timeout < (ARRAY_SIZE(g_sub_menu_tx_timeout) - 1))
timeout_secs = 60 * g_eeprom.config.setting.tx_timeout; // minutes
else
timeout_secs = 60 * 15; // 15 minutes
@ -182,7 +182,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
return false;
#endif
if (g_setting_mic_bar)
if (g_eeprom.config.setting.mic_bar)
{
const unsigned int line = 3;
const unsigned int txt_width = 7 * 3; // 3 text chars
@ -230,7 +230,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
#ifdef ENABLE_RX_SIGNAL_BAR
bool UI_DisplayRSSIBar(const int16_t rssi, const bool now)
{
if (g_setting_rssi_bar)
if (g_eeprom.config.setting.enable_rssi_bar)
{
// const int16_t s0_dBm = -127; // S0 .. base level
const int16_t s0_dBm = -147; // S0 .. base level
@ -365,7 +365,7 @@ void UI_update_rssi(const int16_t rssi, const int vfo)
// **********************************************************
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_keypad_locked > 0)
if (g_eeprom.config.setting.key_lock && g_keypad_locked > 0)
return; // display is in use
#endif
@ -428,7 +428,7 @@ void UI_DisplayMain(void)
g_center_line = CENTER_LINE_NONE;
// #ifdef SINGLE_VFO_CHAN
// const bool single_vfo = (g_eeprom.dual_watch == DUAL_WATCH_OFF && g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? true : false;
// const bool single_vfo = (g_eeprom.config.setting.dual_watch == DUAL_WATCH_OFF && g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? true : false;
// #else
const bool single_vfo = false;
// #endif
@ -446,7 +446,7 @@ void UI_DisplayMain(void)
}
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_keypad_locked > 0)
if (g_eeprom.config.setting.key_lock && g_keypad_locked > 0)
{ // tell user how to unlock the keyboard
backlight_turn_on(10); // 5 seconds
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
@ -458,9 +458,10 @@ void UI_DisplayMain(void)
for (vfo_num = 0; vfo_num < 2; vfo_num++)
{
const unsigned int scrn_chan = g_eeprom.config.setting.indices.vfo[vfo_num].screen;
const unsigned int line = (vfo_num == 0) ? line0 : line1;
unsigned int channel = g_eeprom.tx_vfo;
// unsigned int tx_channel = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_eeprom.rx_vfo : g_eeprom.tx_vfo;
unsigned int channel = g_eeprom.config.setting.tx_vfo_num;
// unsigned int tx_channel = (g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? g_rx_vfo_num : g_eeprom.config.setting.tx_vfo_num;
const bool same_vfo = (channel == vfo_num) ? true : false;
uint8_t *p_line0 = g_frame_buffer[line + 0];
uint8_t *p_line1 = g_frame_buffer[line + 1];
@ -476,8 +477,8 @@ void UI_DisplayMain(void)
}
if (g_eeprom.dual_watch != DUAL_WATCH_OFF && g_rx_vfo_is_active)
channel = g_eeprom.rx_vfo; // we're currently monitoring the other VFO
if (g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF && g_rx_vfo_is_active)
channel = g_rx_vfo_num; // we're currently monitoring the other VFO
if (channel != vfo_num)
{
@ -547,7 +548,7 @@ void UI_DisplayMain(void)
if (!single_vfo && same_vfo)
memcpy(p_line0 + 0, BITMAP_VFO_DEFAULT, sizeof(BITMAP_VFO_DEFAULT));
else
if (g_eeprom.cross_vfo_rx_tx != CROSS_BAND_OFF)
if (g_eeprom.config.setting.cross_vfo != CROSS_BAND_OFF)
memcpy(p_line0 + 0, BITMAP_VFO_NOT_DEFAULT, sizeof(BITMAP_VFO_NOT_DEFAULT));
}
else
@ -556,7 +557,7 @@ void UI_DisplayMain(void)
if (same_vfo)
memcpy(p_line0 + 0, BITMAP_VFO_DEFAULT, sizeof(BITMAP_VFO_DEFAULT));
else
//if (g_eeprom.cross_vfo_rx_tx != CROSS_BAND_OFF)
//if (g_eeprom.config.setting.cross_vfo != CROSS_BAND_OFF)
memcpy(p_line0 + 0, BITMAP_VFO_NOT_DEFAULT, sizeof(BITMAP_VFO_NOT_DEFAULT));
}
@ -569,7 +570,7 @@ void UI_DisplayMain(void)
else
#endif
{
channel = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_eeprom.rx_vfo : g_eeprom.tx_vfo;
channel = (g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? g_rx_vfo_num : g_eeprom.config.setting.tx_vfo_num;
if (channel == vfo_num)
{ // show the TX symbol
mode = 1;
@ -584,7 +585,7 @@ void UI_DisplayMain(void)
else
{ // receiving .. show the RX symbol
mode = 2;
if ((g_current_function == FUNCTION_RECEIVE && g_squelch_open) && g_eeprom.rx_vfo == vfo_num)
if ((g_current_function == FUNCTION_RECEIVE && g_squelch_open) && g_rx_vfo_num == vfo_num)
{
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold("RX", 14, 0, line);
@ -594,32 +595,32 @@ void UI_DisplayMain(void)
}
}
if (g_eeprom.screen_channel[vfo_num] <= USER_CHANNEL_LAST)
if (scrn_chan <= USER_CHANNEL_LAST)
{ // channel mode
const unsigned int x = 2;
const bool inputting = (g_input_box_index == 0 || g_eeprom.tx_vfo != vfo_num) ? false : true;
const bool inputting = (g_input_box_index == 0 || g_eeprom.config.setting.tx_vfo_num != vfo_num) ? false : true;
if (!inputting)
NUMBER_ToDigits(g_eeprom.screen_channel[vfo_num] + 1, str); // show the memory channel number
NUMBER_ToDigits(scrn_chan + 1, str); // show the memory channel number
else
memcpy(str + 5, g_input_box, 3); // show the input text
UI_PrintStringSmall("M", x, 0, line + 1);
UI_Displaysmall_digits(3, str + 5, x + 7, line + 1, inputting);
}
else
if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]))
if (IS_FREQ_CHANNEL(scrn_chan))
{ // frequency mode
// show the frequency band number
const unsigned int x = 2; // was 14
// sprintf(String, "FB%u", 1 + g_eeprom.screen_channel[vfo_num] - FREQ_CHANNEL_FIRST);
sprintf(str, "VFO%u", 1 + g_eeprom.screen_channel[vfo_num] - FREQ_CHANNEL_FIRST);
// sprintf(String, "FB%u", 1 + scrn_chan - FREQ_CHANNEL_FIRST);
sprintf(str, "VFO%u", 1 + scrn_chan - FREQ_CHANNEL_FIRST);
UI_PrintStringSmall(str, x, 0, line + 1);
}
#ifdef ENABLE_NOAA
else
{
if (g_input_box_index == 0 || g_eeprom.tx_vfo != vfo_num)
if (g_input_box_index == 0 || g_eeprom.config.setting.tx_vfo_num != vfo_num)
{ // channel number
sprintf(str, "N%u", 1 + g_eeprom.screen_channel[vfo_num] - NOAA_CHANNEL_FIRST);
sprintf(str, "N%u", 1 + scrn_chan - NOAA_CHANNEL_FIRST);
}
else
{ // user entering channel number
@ -636,7 +637,7 @@ void UI_DisplayMain(void)
#ifdef ENABLE_ALARM
if (g_current_function == FUNCTION_TRANSMIT && g_alarm_state == ALARM_STATE_ALARM)
{
channel = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_eeprom.rx_vfo : g_eeprom.tx_vfo;
channel = (g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? g_rx_vfo_num : g_eeprom.config.setting.tx_vfo_num;
if (channel == vfo_num)
state = VFO_STATE_ALARM;
}
@ -649,7 +650,7 @@ void UI_DisplayMain(void)
UI_PrintString(state_list[state], 31, 0, line, 8);
}
else
if (g_input_box_index > 0 && IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]) && g_eeprom.tx_vfo == vfo_num)
if (g_input_box_index > 0 && IS_FREQ_CHANNEL(scrn_chan) && g_eeprom.config.setting.tx_vfo_num == vfo_num)
{ // user entering a frequency
UI_DisplayFrequency(g_input_box, 32, line, true, false);
@ -659,18 +660,18 @@ void UI_DisplayMain(void)
{
const unsigned int x = 32;
uint32_t frequency = g_eeprom.vfo_info[vfo_num].p_rx->frequency;
uint32_t frequency = g_vfo_info[vfo_num].p_rx->frequency;
if (g_current_function == FUNCTION_TRANSMIT)
{ // transmitting
channel = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_eeprom.rx_vfo : g_eeprom.tx_vfo;
channel = (g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? g_rx_vfo_num : g_eeprom.config.setting.tx_vfo_num;
if (channel == vfo_num)
frequency = g_eeprom.vfo_info[vfo_num].p_tx->frequency;
frequency = g_vfo_info[vfo_num].p_tx->frequency;
}
if (g_eeprom.screen_channel[vfo_num] <= USER_CHANNEL_LAST)
if (scrn_chan <= USER_CHANNEL_LAST)
{ // it's a channel
switch (g_eeprom.channel_display_mode)
switch (g_eeprom.config.setting.channel_display_mode)
{
case MDF_FREQUENCY: // just channel frequency
@ -689,7 +690,7 @@ void UI_DisplayMain(void)
case MDF_CHANNEL: // just channel number
sprintf(str, "CH-%03u", g_eeprom.screen_channel[vfo_num] + 1);
sprintf(str, "CH-%03u", scrn_chan + 1);
UI_PrintString(str, x, 0, line, 8);
break;
@ -697,13 +698,13 @@ void UI_DisplayMain(void)
case MDF_NAME: // channel name
case MDF_NAME_FREQ: // channel name and frequency
BOARD_fetchChannelName(str, g_eeprom.screen_channel[vfo_num]);
SETTINGS_fetch_channel_name(str, scrn_chan);
if (str[0] == 0)
{ // no channel name available, channel number instead
sprintf(str, "CH-%03u", 1 + g_eeprom.screen_channel[vfo_num]);
sprintf(str, "CH-%03u", 1 + scrn_chan);
}
if (g_eeprom.channel_display_mode == MDF_NAME)
if (g_eeprom.config.setting.channel_display_mode == MDF_NAME)
{ // just the name
UI_PrintString(str, x + 4, 0, line, 8);
}
@ -729,7 +730,7 @@ void UI_DisplayMain(void)
}
}
else
// if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]))
// if (IS_FREQ_CHANNEL(scrn_chan))
{ // frequency mode
#ifdef ENABLE_BIG_FREQ
big_freq(frequency, x, line);
@ -747,19 +748,19 @@ void UI_DisplayMain(void)
// show channel symbols
if (g_eeprom.screen_channel[vfo_num] <= USER_CHANNEL_LAST)
//if (IS_NOT_NOAA_CHANNEL(g_eeprom.screen_channel[vfo_num]))
if (scrn_chan <= USER_CHANNEL_LAST)
//if (IS_NOT_NOAA_CHANNEL(scrn_chan))
{ // it's a user channel or VFO
unsigned int x = LCD_WIDTH - 1 - sizeof(BITMAP_SCANLIST2) - sizeof(BITMAP_SCANLIST1);
const uint8_t attributes = g_user_channel_attributes[g_eeprom.screen_channel[vfo_num]];
const t_channel_attrib attributes = g_user_channel_attributes[scrn_chan];
if (attributes & USER_CH_SCANLIST1)
if (attributes.scanlist1)
memcpy(p_line0 + x, BITMAP_SCANLIST1, sizeof(BITMAP_SCANLIST1));
x += sizeof(BITMAP_SCANLIST1);
if (attributes & USER_CH_SCANLIST2)
if (attributes.scanlist2)
memcpy(p_line0 + x, BITMAP_SCANLIST2, sizeof(BITMAP_SCANLIST2));
//x += sizeof(BITMAP_SCANLIST2);
}
@ -772,35 +773,35 @@ void UI_DisplayMain(void)
{
unsigned int x = LCD_WIDTH + LCD_WIDTH - 1 - (smallest_char_spacing * 1) - (smallest_char_spacing * 4);
if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]))
if (IS_FREQ_CHANNEL(scrn_chan))
{
//g_eeprom.vfo_info[vfo_num].freq_in_channel = BOARD_find_channel(frequency);
if (g_eeprom.vfo_info[vfo_num].freq_in_channel <= USER_CHANNEL_LAST)
//g_vfo_info[vfo_num].freq_in_channel = SETTINGS_find_channel(frequency);
if (g_vfo_info[vfo_num].freq_in_channel <= USER_CHANNEL_LAST)
{ // the channel number that contains this VFO frequency
sprintf(str, "%03u", 1 + g_eeprom.vfo_info[vfo_num].freq_in_channel);
sprintf(str, "%03u", 1 + g_vfo_info[vfo_num].freq_in_channel);
UI_PrintStringSmallest(str, x, (line + 0) * 8, false, true);
}
}
x += smallest_char_spacing * 4;
if (g_eeprom.vfo_info[vfo_num].compand)
if (g_vfo_info[vfo_num].compand)
UI_PrintStringSmallest("C", x, (line + 0) * 8, false, true);
//x += smallest_char_spacing * 1;
}
#else
{
const bool is_freq_chan = IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]);
const uint8_t freq_in_channel = g_eeprom.vfo_info[vfo_num].freq_in_channel;
// const uint8_t freq_in_channel = BOARD_find_channel(frequency); // currently way to slow
const bool is_freq_chan = IS_FREQ_CHANNEL(scrn_chan);
const uint8_t freq_in_channel = g_vfo_info[vfo_num].freq_in_channel;
// const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // currently way to slow
if (g_eeprom.vfo_info[vfo_num].compand)
if (g_vfo_info[vfo_num].compand)
{
strcpy(str, " ");
if (is_freq_chan && freq_in_channel <= USER_CHANNEL_LAST)
str[0] = 'F'; // channel number that contains this VFO frequency
if (g_eeprom.vfo_info[vfo_num].compand)
if (g_vfo_info[vfo_num].compand)
str[1] = 'C'; // compander is enabled
UI_PrintStringSmall(str, LCD_WIDTH - (7 * 2), 0, line + 1);
@ -844,10 +845,10 @@ void UI_DisplayMain(void)
// ************
str[0] = '\0';
if (g_eeprom.vfo_info[vfo_num].am_mode > 0)
if (g_vfo_info[vfo_num].am_mode > 0)
{
//strcpy(str, g_sub_menu_mod_mode[g_eeprom.vfo_info[vfo_num].am_mode]);
switch (g_eeprom.vfo_info[vfo_num].am_mode)
//strcpy(str, g_sub_menu_mod_mode[g_vfo_info[vfo_num].am_mode]);
switch (g_vfo_info[vfo_num].am_mode)
{
default:
case 0: strcpy(str, "FM"); break;
@ -857,7 +858,7 @@ void UI_DisplayMain(void)
}
else
{ // or show the CTCSS/DCS symbol
const freq_config_t *pConfig = (mode == 1) ? g_eeprom.vfo_info[vfo_num].p_tx : g_eeprom.vfo_info[vfo_num].p_rx;
const freq_config_t *pConfig = (mode == 1) ? g_vfo_info[vfo_num].p_tx : g_vfo_info[vfo_num].p_rx;
const unsigned int code_type = pConfig->code_type;
const char *code_list[] = {"", "CT", "DCS", "DCR"};
if (code_type < ARRAY_SIZE(code_list))
@ -868,22 +869,22 @@ void UI_DisplayMain(void)
#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_eeprom.vfo_info[vfo_num].am_mode == 0) // not allowed to TX if not in FM mode
if ((state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) && g_vfo_info[vfo_num].am_mode == 0) // not allowed to TX if not in FM mode
#endif
{
if (FREQUENCY_tx_freq_check(g_eeprom.vfo_info[vfo_num].p_tx->frequency) == 0)
if (FREQUENCY_tx_freq_check(g_vfo_info[vfo_num].p_tx->frequency) == 0)
{
// show the TX power
const char pwr_list[] = "LMH";
const unsigned int i = g_eeprom.vfo_info[vfo_num].output_power;
const unsigned int i = g_vfo_info[vfo_num].output_power;
str[0] = (i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
str[1] = '\0';
UI_PrintStringSmall(str, LCD_WIDTH + 46, 0, line + 1);
if (g_eeprom.vfo_info[vfo_num].freq_config_rx.frequency != g_eeprom.vfo_info[vfo_num].freq_config_tx.frequency)
if (g_vfo_info[vfo_num].freq_config_rx.frequency != g_vfo_info[vfo_num].freq_config_tx.frequency)
{ // show the TX offset symbol
const char dir_list[] = "\0+-";
const unsigned int i = g_eeprom.vfo_info[vfo_num].tx_offset_freq_dir;
const unsigned int i = g_vfo_info[vfo_num].tx_offset_freq_dir;
str[0] = (i < sizeof(dir_list)) ? dir_list[i] : '?';
str[1] = '\0';
UI_PrintStringSmall(str, LCD_WIDTH + 54, 0, line + 1);
@ -892,12 +893,12 @@ void UI_DisplayMain(void)
}
// show the TX/RX reverse symbol
if (g_eeprom.vfo_info[vfo_num].frequency_reverse)
if (g_vfo_info[vfo_num].frequency_reverse)
UI_PrintStringSmall("R", LCD_WIDTH + 62, 0, line + 1);
{ // show the narrow band symbol
str[0] = '\0';
if (g_eeprom.vfo_info[vfo_num].channel_bandwidth == BANDWIDTH_NARROW)
if (g_vfo_info[vfo_num].channel_bandwidth == BANDWIDTH_NARROW)
{
str[0] = 'N';
str[1] = '\0';
@ -907,17 +908,17 @@ void UI_DisplayMain(void)
// show the DTMF decoding symbol
#ifdef ENABLE_KILL_REVIVE
if (g_eeprom.vfo_info[vfo_num].dtmf_decoding_enable || g_setting_radio_disabled)
if (g_vfo_info[vfo_num].dtmf_decoding_enable || g_eeprom.config.setting.radio_disabled)
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1);
#else
if (g_eeprom.vfo_info[vfo_num].dtmf_decoding_enable)
if (g_vfo_info[vfo_num].dtmf_decoding_enable)
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1);
//UI_PrintStringSmall4x5("DTMF", LCD_WIDTH + 78, 0, line + 1); // font table is currently wrong
//UI_PrintStringSmallest("DTMF", LCD_WIDTH + 78, (line + 1) * 8, false, true);
#endif
// show the audio scramble symbol
if (g_eeprom.vfo_info[vfo_num].scrambling_type > 0 && g_setting_scramble_enable)
if (g_vfo_info[vfo_num].scrambling_type > 0 && g_eeprom.config.setting.enable_scrambler)
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, line + 1);
}
@ -966,10 +967,10 @@ void UI_DisplayMain(void)
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
// show the AM-FIX debug data
if (rx && g_eeprom.vfo_info[g_eeprom.rx_vfo].am_mode > 0 && g_setting_am_fix)
if (rx && g_vfo_info[g_rx_vfo_num].am_mode > 0 && g_eeprom.config.setting.am_fix)
{
g_center_line = CENTER_LINE_AM_FIX_DATA;
AM_fix_print_data(g_eeprom.rx_vfo, str);
AM_fix_print_data(g_rx_vfo_num, str);
UI_PrintStringSmall(str, 2, 0, 3);
}
else
@ -977,10 +978,10 @@ void UI_DisplayMain(void)
#ifdef ENABLE_RX_SIGNAL_BAR
// show the RX RSSI dBm, S-point and signal strength bar graph
if (rx && g_setting_rssi_bar)
if (rx && g_eeprom.config.setting.enable_rssi_bar)
{
g_center_line = CENTER_LINE_RSSI;
UI_DisplayRSSIBar(g_current_rssi[g_eeprom.rx_vfo], false);
UI_DisplayRSSIBar(g_current_rssi[g_rx_vfo_num], false);
}
else
#endif
@ -988,7 +989,7 @@ void UI_DisplayMain(void)
if (rx || g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_POWER_SAVE)
{
#if 1
if (g_setting_live_dtmf_decoder && g_dtmf_rx_live[0] != 0)
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
@ -1003,7 +1004,7 @@ void UI_DisplayMain(void)
UI_PrintStringSmall(str, 2, 0, 3);
}
#else
if (g_setting_live_dtmf_decoder && g_dtmf_rx_index > 0)
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

View File

@ -21,7 +21,7 @@
#include "dcs.h"
#include "driver/backlight.h"
#include "driver/bk4819.h"
#include "driver/eeprom.h" // EEPROM_ReadBuffer()
#include "driver/eeprom.h"
#include "driver/st7565.h"
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
#include "driver/uart.h"
@ -283,12 +283,12 @@ const char g_sub_menu_dtmf_rsp[4][9] =
"RNG RPLY"
};
const char g_sub_menu_ptt_id[5][15] =
const char g_sub_menu_ptt_id[5][16] =
{
"OFF",
"BOT",
"EOT",
"BOT+EOT",
"DTMF ID\nOFF",
"DTMF ID\nBOT",
"DTMF ID\nEOT",
"DTMF ID\nBOT+EOT",
"APOLLO\nQUINDAR"
};
@ -469,9 +469,10 @@ void UI_SortMenu(const bool hide_hidden)
void UI_DisplayMenu(void)
{
const unsigned int menu_list_width = 6; // max no. of characters on the menu list (left side)
const unsigned int menu_list_width = 6; // max no. of characters on the menu list (left side)
const unsigned int sub_menu_x1 = (8 * menu_list_width) + 2; // start x corrd
const unsigned int sub_menu_x2 = LCD_WIDTH - 1; // end x coord
bool channel_setting = false; // set if the setting is a channel setting
unsigned int i;
char str[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
@ -573,6 +574,7 @@ void UI_DisplayMenu(void)
sprintf(str, "%d", g_sub_menu_selection);
// g_tx_vfo->squelch_level = g_sub_menu_selection;
// RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
channel_setting = true;
break;
case MENU_MIC_GAIN:
@ -596,11 +598,13 @@ void UI_DisplayMenu(void)
NUMBER_trim_trailing_zeros(str);
strcat(str, "kHz");
}
channel_setting = true;
break;
}
case MENU_TX_POWER:
strcpy(str, g_sub_menu_tx_power[g_sub_menu_selection]);
channel_setting = true;
break;
case MENU_RX_CDCSS:
@ -613,11 +617,13 @@ void UI_DisplayMenu(void)
sprintf(str + strlen(str), "D%03oN", DCS_CODE_LIST[g_sub_menu_selection - 1]);
else
sprintf(str + strlen(str), "D%03oI", DCS_CODE_LIST[g_sub_menu_selection - 105]);
channel_setting = true;
break;
case MENU_RX_CTCSS:
case MENU_TX_CTCSS:
{
channel_setting = true;
strcpy(str, "CTCSS\n");
#if 1
// set CTCSS as the user adjusts it
@ -658,9 +664,11 @@ void UI_DisplayMenu(void)
case MENU_SHIFT_DIR:
strcpy(str, g_sub_menu_shift_dir[g_sub_menu_selection]);
channel_setting = true;
break;
case MENU_OFFSET:
channel_setting = true;
if (!g_in_sub_menu || g_input_box_index == 0)
{
sprintf(str, "%d.%05u", g_sub_menu_selection / 100000, abs(g_sub_menu_selection) % 100000);
@ -692,6 +700,7 @@ void UI_DisplayMenu(void)
case MENU_BANDWIDTH:
strcpy(str, g_sub_menu_bandwidth[g_sub_menu_selection]);
channel_setting = true;
break;
case MENU_SCRAMBLER:
@ -699,11 +708,12 @@ void UI_DisplayMenu(void)
strcat(str, g_sub_menu_scrambler[g_sub_menu_selection]);
#if 1
if (g_sub_menu_selection > 0 && g_setting_scramble_enable)
if (g_sub_menu_selection > 0 && g_eeprom.config.setting.enable_scrambler)
BK4819_EnableScramble(g_sub_menu_selection - 1);
else
BK4819_DisableScramble();
#endif
channel_setting = true;
break;
#ifdef ENABLE_VOX
@ -728,12 +738,13 @@ void UI_DisplayMenu(void)
case MENU_MOD_MODE:
// strcpy(str, (g_sub_menu_selection == 0) ? "FM" : "AM");
strcpy(str, g_sub_menu_mod_mode[g_sub_menu_selection]);
channel_setting = true;
break;
#ifdef ENABLE_AM_FIX_TEST1
case MENU_AM_FIX_TEST1:
strcpy(str, g_sub_menu_AM_FIX_test1[g_sub_menu_selection]);
// g_setting_am_fix = g_sub_menu_selection;
// g_eeprom.config.setting.am_fix = g_sub_menu_selection;
break;
#endif
@ -748,6 +759,7 @@ void UI_DisplayMenu(void)
case MENU_COMPAND:
strcpy(str, g_sub_menu_rx_tx[g_sub_menu_selection]);
channel_setting = true;
break;
#ifdef ENABLE_CONTRAST
@ -772,6 +784,7 @@ void UI_DisplayMenu(void)
case MENU_S_ADD1:
case MENU_S_ADD2:
strcpy(str, g_sub_menu_off_on[g_sub_menu_selection]);
channel_setting = true;
break;
case MENU_BUSY_CHAN_LOCK:
@ -830,6 +843,7 @@ void UI_DisplayMenu(void)
case MENU_SCRAMBLER_EN:
strcpy(str, "SCRAMBLER\n");
strcat(str, g_sub_menu_dis_en[g_sub_menu_selection]);
channel_setting = true;
break;
case MENU_TX_EN:
@ -847,13 +861,13 @@ void UI_DisplayMenu(void)
UI_GenerateChannelStringEx(str, valid ? "CH-" : "", g_sub_menu_selection);
// channel name
BOARD_fetchChannelName(s, g_sub_menu_selection);
SETTINGS_fetch_channel_name(s, g_sub_menu_selection);
strcat(str, "\n");
strcat(str, (s[0] == 0) ? "--" : s);
if (valid && !g_ask_for_confirmation)
{ // show the frequency so that the user knows the channels frequency
const uint32_t frequency = BOARD_fetchChannelFrequency(g_sub_menu_selection);
const uint32_t frequency = SETTINGS_fetch_channel_frequency(g_sub_menu_selection);
sprintf(str + strlen(str), "\n%u.%05u", frequency / 100000, frequency % 100000);
#ifdef ENABLE_TRIM_TRAILING_ZEROS
@ -861,6 +875,7 @@ void UI_DisplayMenu(void)
#endif
}
channel_setting = (g_menu_cursor != MENU_1_CALL) ? true : false;
break;
}
@ -874,11 +889,11 @@ void UI_DisplayMenu(void)
if (valid)
{
const uint32_t frequency = BOARD_fetchChannelFrequency(g_sub_menu_selection);
const uint32_t frequency = SETTINGS_fetch_channel_frequency(g_sub_menu_selection);
if (!g_in_sub_menu || g_edit_index < 0)
{ // show the channel name
BOARD_fetchChannelName(str, g_sub_menu_selection);
SETTINGS_fetch_channel_name(str, g_sub_menu_selection);
if (str[0] == 0)
strcpy(str, "--");
UI_PrintString(str, sub_menu_x1, sub_menu_x2, y + 2, 8);
@ -901,6 +916,7 @@ void UI_DisplayMenu(void)
}
already_printed = true;
channel_setting = true;
break;
}
@ -931,7 +947,7 @@ void UI_DisplayMenu(void)
strcpy(str, "SCAN\nRESUME\n");
strcat(str, g_sub_menu_scan_car_resume[g_sub_menu_selection]);
if (g_sub_menu_selection == SCAN_RESUME_TIME)
sprintf(str + strlen(str), "%d.%ds", g_eeprom.scan_hold_time_500ms / 2, 5 * (g_eeprom.scan_hold_time_500ms % 2));
sprintf(str + strlen(str), "%d.%ds", g_eeprom.config.setting.scan_hold_time / 2, 5 * (g_eeprom.config.setting.scan_hold_time % 2));
break;
case MENU_SCAN_HOLD:
@ -951,10 +967,11 @@ void UI_DisplayMenu(void)
break;
case MENU_S_LIST:
strcpy(str, "SCAN LIST\n");
if (g_sub_menu_selection < 2)
sprintf(str, "LIST%u", 1 + g_sub_menu_selection);
sprintf(str + strlen(str), "LIST%u", 1 + g_sub_menu_selection);
else
strcpy(str, "ALL");
strcat(str, "ALL");
break;
#ifdef ENABLE_ALARM
@ -966,17 +983,17 @@ void UI_DisplayMenu(void)
case MENU_ANI_ID:
strcpy(str, "YOUR ID\n");
strcat(str, g_eeprom.ani_dtmf_id);
strcat(str, g_eeprom.config.setting.dtmf.ani_id);
break;
case MENU_UP_CODE:
strcpy(str, "PTT DTMF\nBEGIN\n");
strcat(str, g_eeprom.dtmf_key_up_code);
strcpy(str, "DTMF BOT\n");
strcat(str, g_eeprom.config.setting.dtmf.key_up_code);
break;
case MENU_DN_CODE:
strcpy(str, "PTT DTMF\nEND\n");
strcat(str, g_eeprom.dtmf_key_down_code);
strcpy(str, "DTMF EOT\n");
strcat(str, g_eeprom.config.setting.dtmf.key_down_code);
break;
case MENU_DTMF_RSP:
@ -1013,7 +1030,7 @@ void UI_DisplayMenu(void)
break;
case MENU_DTMF_PRE:
strcpy(str, "TX DTMF\nDELAY\n");
strcpy(str, "DTMF BOT\nDELAY\n");
// sprintf(String + strlen(String), "%d*10ms", g_sub_menu_selection);
sprintf(str + strlen(str), "%dms", 10 * g_sub_menu_selection);
break;
@ -1022,6 +1039,7 @@ void UI_DisplayMenu(void)
case MENU_MDC1200_MODE:
strcpy(str, "MDC1200\nMODE\n");
strcat(str, g_sub_menu_mdc1200_mode[g_sub_menu_selection]);
channel_setting = true;
break;
case MENU_MDC1200_ID:
@ -1030,8 +1048,8 @@ void UI_DisplayMenu(void)
#endif
case MENU_PTT_ID:
strcpy(str, (g_sub_menu_selection > 0) ? "TX ID\n" : "");
strcat(str, g_sub_menu_ptt_id[g_sub_menu_selection]);
strcpy(str, g_sub_menu_ptt_id[g_sub_menu_selection]);
channel_setting = true;
break;
case MENU_BAT_TXT:
@ -1178,11 +1196,11 @@ void UI_DisplayMenu(void)
case MENU_BAT_CAL:
{
const uint16_t vol = (uint32_t)g_battery_voltage_average * g_battery_calibration[3] / g_sub_menu_selection;
const uint16_t vol = (uint32_t)g_battery_voltage_average * g_eeprom.calib.battery[3] / g_sub_menu_selection;
if (!g_in_sub_menu)
sprintf(str, "%u.%02uV\n%d", vol / 100, vol % 100, g_sub_menu_selection);
else
sprintf(str, "%u.%02uV\n(%#4d)\n%#4d", vol / 100, vol % 100, g_battery_calibration[3], g_sub_menu_selection);
sprintf(str, "%u.%02uV\n(%#4d)\n%#4d", vol / 100, vol % 100, g_eeprom.calib.battery[3], g_sub_menu_selection);
break;
}
}
@ -1251,14 +1269,14 @@ void UI_DisplayMenu(void)
else
UI_GenerateChannelStringEx(str, "CH-", g_sub_menu_selection);
// if (g_sub_menu_selection == 0xFF || !g_eeprom.scan_list_enabled[i])
if (g_sub_menu_selection < 0 || !g_eeprom.scan_list_enabled[i])
// if (g_sub_menu_selection == 0xFF || g_eeprom.config.setting.priority_scan_list[i].enabled == 0)
if (g_sub_menu_selection < 0 || g_eeprom.config.setting.priority_scan_list[i].enabled == 0)
{
// channel number
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 0, 8);
// channel name
BOARD_fetchChannelName(str, g_sub_menu_selection);
SETTINGS_fetch_channel_name(str, g_sub_menu_selection);
if (str[0] == 0)
strcpy(str, "--");
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 2, 8);
@ -1270,20 +1288,20 @@ void UI_DisplayMenu(void)
// channel name
memset(str, 0, sizeof(str));
BOARD_fetchChannelName(str, g_sub_menu_selection);
SETTINGS_fetch_channel_name(str, g_sub_menu_selection);
if (str[0] == 0)
strcpy(str, "--");
UI_PrintStringSmall(str, sub_menu_x1, sub_menu_x2, 2);
if (IS_USER_CHANNEL(g_eeprom.scan_list_priority_ch1[i]))
if (IS_USER_CHANNEL(g_eeprom.config.setting.priority_scan_list[i].channel[0]))
{
sprintf(str, "PRI1:%u", g_eeprom.scan_list_priority_ch1[i] + 1);
sprintf(str, "PRI1:%u", 1 + g_eeprom.config.setting.priority_scan_list[i].channel[0]);
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 3, 8);
}
if (IS_USER_CHANNEL(g_eeprom.scan_list_priority_ch2[i]))
if (IS_USER_CHANNEL(g_eeprom.config.setting.priority_scan_list[i].channel[1]))
{
sprintf(str, "PRI2:%u", g_eeprom.scan_list_priority_ch2[i] + 1);
sprintf(str, "PRI2:%u", 1 + g_eeprom.config.setting.priority_scan_list[i].channel[1]);
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 5, 8);
}
}
@ -1293,12 +1311,12 @@ void UI_DisplayMenu(void)
UI_PrintString("SCAN", sub_menu_x1, sub_menu_x2, 4, 8);
if (g_menu_cursor == MENU_UP_CODE)
if (strlen(g_eeprom.dtmf_key_up_code) > 8)
UI_PrintString(g_eeprom.dtmf_key_up_code + 8, sub_menu_x1, sub_menu_x2, 4, 8);
if (strlen(g_eeprom.config.setting.dtmf.key_up_code) > 8)
UI_PrintString(g_eeprom.config.setting.dtmf.key_up_code + 8, sub_menu_x1, sub_menu_x2, 4, 8);
if (g_menu_cursor == MENU_DN_CODE)
if (strlen(g_eeprom.dtmf_key_down_code) > 8)
UI_PrintString(g_eeprom.dtmf_key_down_code + 8, sub_menu_x1, sub_menu_x2, 4, 8);
if (strlen(g_eeprom.config.setting.dtmf.key_down_code) > 8)
UI_PrintString(g_eeprom.config.setting.dtmf.key_down_code + 8, sub_menu_x1, sub_menu_x2, 4, 8);
if (g_menu_cursor == MENU_RX_CTCSS ||
g_menu_cursor == MENU_TX_CTCSS ||
@ -1324,5 +1342,8 @@ void UI_DisplayMenu(void)
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 5, 8);
}
if (channel_setting)
UI_PrintStringSmall("ch", sub_menu_x1, 0, 0);
ST7565_BlitFullScreen();
}

View File

@ -180,7 +180,7 @@ extern const char g_sub_menu_mem_disp[4][15];
extern const char g_sub_menu_alarm_mode[2][5];
#endif
extern const char g_sub_menu_dtmf_rsp[4][9];
extern const char g_sub_menu_ptt_id[5][15];
extern const char g_sub_menu_ptt_id[5][16];
#ifdef ENABLE_MDC1200
extern const char g_sub_menu_mdc1200_mode[4][8];
#endif

View File

@ -22,6 +22,7 @@
#include "frequencies.h"
#include "misc.h"
#include "radio.h"
#include "settings.h"
#include "ui/helper.h"
#include "ui/search.h"
#include "ui/ui.h"
@ -161,7 +162,7 @@ void UI_DisplaySearch(void)
strcpy(String, "SAVE ");
{
char s[11];
BOARD_fetchChannelName(s, g_search_channel);
SETTINGS_fetch_channel_name(s, g_search_channel);
if (s[0] == 0)
UI_GenerateChannelStringEx(s, g_search_show_chan_prefix ? "CH-" : "", g_search_channel);
strcat(String, s);

View File

@ -37,9 +37,9 @@ void UI_DisplayStatus(const bool test_display)
uint8_t *line = g_status_line;
unsigned int x = 0;
unsigned int x1 = 0;
g_update_status = false;
memset(g_status_line, 0, sizeof(g_status_line));
// **************
@ -65,78 +65,79 @@ void UI_DisplayStatus(const bool test_display)
x1 = x + sizeof(BITMAP_POWERSAVE);
}
x += sizeof(BITMAP_POWERSAVE);
x++;
#ifdef ENABLE_NOAA
// NOASS SCAN indicator
if (g_is_noaa_mode || test_display)
// NOAA scan indicator
if (g_noaa_mode || test_display)
{
memcpy(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA));
x1 = x + sizeof(BITMAP_NOAA);
x += sizeof(BITMAP_NOAA);
}
x += sizeof(BITMAP_NOAA);
#else
// hmmm, what to put in it's place
x++;
#endif
#ifdef ENABLE_KILL_REVIVE
if (g_setting_radio_disabled)
if (g_eeprom.config.setting.radio_disabled)
{
memset(line + x, 0xFF, 10);
x1 = x + 10;
x += 10;
}
else
#endif
{
#ifdef ENABLE_FMRADIO
// FM indicator
if (g_fm_radio_mode || test_display)
{
memcpy(line + x, BITMAP_FM, sizeof(BITMAP_FM));
x1 = x + sizeof(BITMAP_FM);
x += sizeof(BITMAP_FM);
}
else
x++;
#endif
// SCAN indicator
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || test_display)
// SCAN indicator
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || test_display)
{
// don't display this if in search mode
if (g_current_display_screen != DISPLAY_SEARCH)
{
// don't display this if in search mode
if (g_current_display_screen != DISPLAY_SEARCH)
{
if (g_scan_next_channel <= USER_CHANNEL_LAST)
{ // channel mode
if (g_eeprom.scan_list_default == 0)
UI_PrintStringSmallBuffer("1", line + x);
else
if (g_eeprom.scan_list_default == 1)
UI_PrintStringSmallBuffer("2", line + x);
else
if (g_eeprom.scan_list_default == 2)
UI_PrintStringSmallBuffer("*", line + x);
}
if (g_scan_next_channel <= USER_CHANNEL_LAST)
{ // channel mode
if (g_eeprom.config.setting.scan_list_default == 0)
UI_PrintStringSmallBuffer("1", line + x);
else
{ // frequency mode
UI_PrintStringSmallBuffer("S", line + x);
}
x1 = x + 7;
if (g_eeprom.config.setting.scan_list_default == 1)
UI_PrintStringSmallBuffer("2", line + x);
else
if (g_eeprom.config.setting.scan_list_default == 2)
UI_PrintStringSmallBuffer("*", line + x);
}
else
{ // frequency mode
UI_PrintStringSmallBuffer("S", line + x);
}
x1 = x + 7;
}
x += 7; // font character width
}
x += 7; // font character width
x++;
#ifdef ENABLE_VOICE
// VOICE indicator
if (g_eeprom.voice_prompt != VOICE_PROMPT_OFF || test_display)
if (g_eeprom.config.setting.voice_prompt != VOICE_PROMPT_OFF || test_display)
{
memcpy(line + x, BITMAP_VOICE_PROMPT, sizeof(BITMAP_VOICE_PROMPT));
x1 = x + sizeof(BITMAP_VOICE_PROMPT);
x += sizeof(BITMAP_VOICE_PROMPT);
}
x += sizeof(BITMAP_VOICE_PROMPT);
#else
// hmmm, what to put in it's place
x++;
#endif
// DUAL-WATCH indicator
if (g_eeprom.dual_watch != DUAL_WATCH_OFF || test_display)
if (g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF || test_display)
{
if (g_dual_watch_tick_10ms > dual_watch_delay_toggle_10ms ||
g_dtmf_call_state != DTMF_CALL_STATE_NONE ||
@ -152,42 +153,47 @@ void UI_DisplayStatus(const bool test_display)
memcpy(line + x, BITMAP_TDR_RUNNING, sizeof(BITMAP_TDR_RUNNING));
}
x1 = x + sizeof(BITMAP_TDR_RUNNING);
x += sizeof(BITMAP_TDR_RUNNING);
}
x += sizeof(BITMAP_TDR_RUNNING);
x++;
// monitor
if (g_monitor_enabled)
{
memcpy(line + x, BITMAP_MONITOR, sizeof(BITMAP_MONITOR));
x1 = x + sizeof(BITMAP_MONITOR);
x += sizeof(BITMAP_MONITOR);
}
x += sizeof(BITMAP_MONITOR);
x++;
// CROSS-VFO indicator
if (g_eeprom.cross_vfo_rx_tx != CROSS_BAND_OFF || test_display)
if (g_eeprom.config.setting.cross_vfo != CROSS_BAND_OFF || test_display)
{
memcpy(line + x, BITMAP_XB, sizeof(BITMAP_XB));
x1 = x + sizeof(BITMAP_XB);
x += sizeof(BITMAP_XB);
}
x += sizeof(BITMAP_XB);
x++;
#ifdef ENABLE_VOX
// VOX indicator
if (g_eeprom.vox_switch || test_display)
if (g_eeprom.config.setting.vox_switch || test_display)
{
memcpy(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
x1 = x + sizeof(BITMAP_VOX);
x += sizeof(BITMAP_VOX);
}
x += sizeof(BITMAP_VOX);
x++;
#endif
#ifdef ENABLE_KEYLOCK
// KEY-LOCK indicator
if (g_eeprom.key_lock || test_display)
if (g_eeprom.config.setting.key_lock || test_display)
{
memcpy(line + x, BITMAP_KEYLOCK, sizeof(BITMAP_KEYLOCK));
x += sizeof(BITMAP_KEYLOCK);
x1 = x;
x++;
}
else
#endif
@ -197,22 +203,23 @@ void UI_DisplayStatus(const bool test_display)
x += sizeof(BITMAP_F_KEY);
x1 = x;
}
x++;
{ // battery voltage or percentage text
char s[8];
unsigned int space_needed;
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BATTERY_LEVEL) - 3;
if (g_charging_with_type_c)
x2 -= sizeof(BITMAP_USB_C); // the radio is on USB charge
switch (g_setting_battery_text)
switch (g_eeprom.config.setting.battery_text)
{
default:
case 0:
break;
case 1: // voltage
{
const uint16_t voltage = (g_battery_voltage_average <= 999) ? g_battery_voltage_average : 999; // limit to 9.99V
@ -222,7 +229,7 @@ void UI_DisplayStatus(const bool test_display)
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
break;
}
case 2: // percentage
{
sprintf(s, "%u%%", BATTERY_VoltsToPercent(g_battery_voltage_average));
@ -233,10 +240,10 @@ void UI_DisplayStatus(const bool test_display)
}
}
}
// move to right side of the screen
x = LCD_WIDTH - sizeof(BITMAP_BATTERY_LEVEL) - sizeof(BITMAP_USB_C);
// USB-C charge indicator
if (g_charging_with_type_c || test_display)
memcpy(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C));
@ -244,7 +251,7 @@ void UI_DisplayStatus(const bool test_display)
// BATTERY LEVEL indicator
UI_DrawBattery(line + x, g_battery_display_level, g_low_battery_blink);
// **************
ST7565_BlitStatusLine();

View File

@ -1,101 +0,0 @@
/* Copyright 2023 Dual Tachyon
* https://github.com/DualTachyon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string.h>
#include "driver/eeprom.h"
#include "driver/st7565.h"
#include "external/printf/printf.h"
#include "helper/battery.h"
#include "settings.h"
#include "misc.h"
#include "ui/helper.h"
#include "ui/welcome.h"
#include "ui/status.h"
#include "version.h"
void UI_DisplayReleaseKeys(void)
{
memset(g_status_line, 0, sizeof(g_status_line));
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
UI_PrintString("RELEASE", 0, LCD_WIDTH, 1, 10);
UI_PrintString("ALL KEYS", 0, LCD_WIDTH, 3, 10);
ST7565_BlitStatusLine(); // blank status line
ST7565_BlitFullScreen();
}
void UI_DisplayWelcome(void)
{
char str0[17];
char str1[17];
char str2[17];
memset(g_status_line, 0, sizeof(g_status_line));
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
if (g_eeprom.pwr_on_display_mode == PWR_ON_DISPLAY_MODE_NONE)
{
ST7565_FillScreen(0xFF);
}
else
if (g_eeprom.pwr_on_display_mode == PWR_ON_DISPLAY_MODE_FULL_SCREEN)
{
ST7565_FillScreen(0xFF);
}
else
{
unsigned int slen = strlen(Version_str);
if (slen > (sizeof(str2) - 1))
slen = sizeof(str2) - 1;
memset(str0, 0, sizeof(str0));
memset(str1, 0, sizeof(str1));
memset(str2, 0, sizeof(str2));
if (g_eeprom.pwr_on_display_mode == PWR_ON_DISPLAY_MODE_VOLTAGE)
{
strcpy(str0, "VOLTAGE");
sprintf(str1, "%u.%02uV %u%%",
g_battery_voltage_average / 100,
g_battery_voltage_average % 100,
BATTERY_VoltsToPercent(g_battery_voltage_average));
}
else
{
EEPROM_ReadBuffer(0x0EB0, str0, 16);
EEPROM_ReadBuffer(0x0EC0, str1, 16);
}
memcpy(str2, Version_str, slen);
UI_PrintString(str0, 0, LCD_WIDTH, 0, 10);
UI_PrintString(str1, 0, LCD_WIDTH, 2, 10);
UI_PrintStringSmall(str2, 0, LCD_WIDTH, 4);
UI_PrintStringSmall(__DATE__, 0, LCD_WIDTH, 5);
UI_PrintStringSmall(__TIME__, 0, LCD_WIDTH, 6);
#if 1
ST7565_BlitStatusLine(); // blank status line
#else
UI_DisplayStatus(true); // show all status line symbols (test)
#endif
ST7565_BlitFullScreen();
}
}

View File

@ -1,24 +0,0 @@
/* Copyright 2023 Dual Tachyon
* https://github.com/DualTachyon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef UI_WELCOME_H
#define UI_WELCOME_H
void UI_DisplayReleaseKeys(void);
void UI_DisplayWelcome(void);
#endif