0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-18 22:29:50 +03:00
This commit is contained in:
OneOfEleven
2023-11-09 05:59:50 +00:00
parent 5c17a33e3c
commit b704e7efa3
18 changed files with 164 additions and 120 deletions

View File

@ -60,7 +60,7 @@ void UI_DisplayAircopy(void)
const unsigned int x = 16;
NUMBER_ToDigits(g_rx_vfo->freq_config_rx.frequency, str);
UI_DisplayFrequency(str, x, 2, 0, 0);
UI_DisplayFrequencyBig(str, x, 2, 0, 0, 6);
// show the remaining 2 small frequency digits
#ifdef ENABLE_TRIM_TRAILING_ZEROS
@ -80,7 +80,7 @@ void UI_DisplayAircopy(void)
}
else
{ // user is entering a new frequency
UI_DisplayFrequency(g_input_box, 16, 2, 1, 0);
UI_DisplayFrequencyBig(g_input_box, 16, 2, 1, 0, 6);
}
// **********************************

View File

@ -120,14 +120,14 @@ void UI_DisplayFM(void)
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);
UI_DisplayFrequencyBig(str, 30, 4, false, true, 6);
#else
UI_DisplayFrequency(str, 23, 4, false, true);
UI_DisplayFrequencyBig(str, 23, 4, false, true, 6);
#endif
}
else
{ // user is entering a frequency
UI_DisplayFrequency(g_input_box, 23, 4, true, false);
UI_DisplayFrequencyBig(g_input_box, 23, 4, true, false, 6);
}
}
else

View File

@ -71,7 +71,7 @@ void UI_GenerateChannelStringEx(char *pString, const char *prefix, const uint8_t
void UI_PrintString(const char *str, unsigned int x, const unsigned int end, const unsigned int line, const unsigned int width)
{
const unsigned int length = strlen(str);
const unsigned int length = strlen(str);
const unsigned int font_size = ARRAY_SIZE(g_font_big);
uint8_t *f_buf1 = g_frame_buffer[line + 0];
uint8_t *f_buf2 = g_frame_buffer[line + 1];
@ -205,13 +205,12 @@ void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
}
}
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag)
void UI_DisplayFrequencyBig(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag, unsigned int length)
{
const unsigned int char_width = 13;
uint8_t *pFb0 = g_frame_buffer[Y] + X;
uint8_t *pFb1 = pFb0 + 128;
uint8_t *pFb1 = pFb0 + LCD_WIDTH;
bool bCanDisplay = false;
unsigned int len = 6;
unsigned int i = 0;
// MHz
@ -240,19 +239,22 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
*pFb1 = 0x60; pFb0++; pFb1++;
#ifdef ENABLE_TRIM_TRAILING_ZEROS
if (pDigits[len + 1] == 0 && pDigits[len + 2] == 0)
if (length == 6)
{
if (pDigits[len - 1] == 0)
if (pDigits[length + 1] == 0 && pDigits[length + 2] == 0)
{
len--;
if (pDigits[len - 1] == 0)
len--;
if (pDigits[length - 1] == 0)
{
length--;
if (pDigits[length - 1] == 0)
length--;
}
}
}
#endif
// kHz
while (i < len)
// fractions
while (i < length)
{
const unsigned int Digit = pDigits[i++];
memcpy(pFb0, g_font_big_digits[Digit], char_width);
@ -262,6 +264,43 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
}
}
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, unsigned int length)
{
char str[10];
bool bCanDisplay = false;
unsigned int i = 0;
unsigned int k = 0;
// MHz
while (i < 3)
{
const unsigned int Digit = pDigits[i++];
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
{
bCanDisplay = true;
str[k++] = (Digit < 10) ? '0' + Digit : '_';
}
}
// decimal point
str[k++] = '.';
// fractions
while (i < length)
{
const unsigned int Digit = pDigits[i++];
str[k++] = (Digit < 10) ? '0' + Digit : '_';
}
str[k] = '\0';
#ifdef ENABLE_TRIM_TRAILING_ZEROS
// NUMBER_trim_trailing_zeros(str);
#endif
UI_PrintString(str, X, 0, Y, 8);
}
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero)
{
const unsigned int char_width = ARRAY_SIZE(g_font_small[0]);

View File

@ -31,7 +31,8 @@ void UI_PrintStringSmall(const char *str, const unsigned int start, const unsign
void UI_PrintStringSmallest(const void *pString, unsigned int x, const unsigned int y, const bool statusbar, const bool fill);
#endif
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer);
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag);
void UI_DisplayFrequencyBig(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool flag, unsigned int length);
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, unsigned int length);
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);
void UI_Displaysmall_digits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros);

View File

@ -374,7 +374,7 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int
NUMBER_ToDigits(frequency, str);
// show the main large frequency digits
UI_DisplayFrequency(str, x, line, false, false);
UI_DisplayFrequencyBig(str, x, line, false, false, 6);
// show the remaining 2 small frequency digits
#ifdef ENABLE_TRIM_TRAILING_ZEROS
@ -625,9 +625,10 @@ void UI_DisplayMain(void)
}
else
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);
{ // user is entering a frequency
// UI_DisplayFrequencyBig(g_input_box, 32, line, true, false, 6);
// UI_DisplayFrequencyBig(g_input_box, 32, line, true, false, 7);
UI_DisplayFrequency(g_input_box, 32, line, true, 8);
// g_center_line = CENTER_LINE_IN_USE;
}
else
@ -643,7 +644,7 @@ void UI_DisplayMain(void)
}
if (scrn_chan <= USER_CHANNEL_LAST)
{ // it's a channel
{ // a user channel
switch (g_eeprom.config.setting.channel_display_mode)
{
@ -674,8 +675,9 @@ void UI_DisplayMain(void)
SETTINGS_fetch_channel_name(str, scrn_chan);
if (str[0] == 0)
{ // no channel name available, channel number instead
sprintf(str, "CH-%03u", 1 + scrn_chan);
{ // no channel name, use channel number
// sprintf(str, "CH-%03u", 1 + scrn_chan);
sprintf(str, "CH-%u", 1 + scrn_chan);
}
if (g_eeprom.config.setting.channel_display_mode == MDF_NAME)
@ -693,7 +695,8 @@ void UI_DisplayMain(void)
#endif
// frequency
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
// sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
sprintf(str, "%u.%05u", frequency / 100000, frequency % 100000);
#ifdef ENABLE_TRIM_TRAILING_ZEROS
NUMBER_trim_trailing_zeros(str);
#endif
@ -714,7 +717,8 @@ void UI_DisplayMain(void)
const unsigned int chan = g_vfo_info[vfo_num].freq_in_channel;
#endif
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
// sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
sprintf(str, "%u.%05u", frequency / 100000, frequency % 100000);
#ifdef ENABLE_TRIM_TRAILING_ZEROS
NUMBER_trim_trailing_zeros(str);
#endif
@ -731,10 +735,11 @@ void UI_DisplayMain(void)
UI_PrintStringSmall(str, x + 4, 0, line + 0);
#endif
// name
// channel name, if not then channel number
SETTINGS_fetch_channel_name(str, chan);
if (str[0] == 0)
sprintf(str, "CH-%03u", 1 + chan);
// sprintf(str, "CH-%03u", 1 + chan);
sprintf(str, "CH-%u", 1 + chan);
UI_PrintStringSmall(str, x + 4, 0, line + 1);
}
else
@ -803,7 +808,7 @@ void UI_DisplayMain(void)
#else
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
// const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // was way to slow
strcpy(str, " ");
@ -852,21 +857,20 @@ void UI_DisplayMain(void)
str[0] = '\0';
if (g_vfo_info[vfo_num].channel.mod_mode != MOD_MODE_FM)
{
//strcpy(str, g_sub_menu_mod_mode[g_vfo_info[vfo_num].channel.mod_mode]);
{ // show the modulation mode
switch (g_vfo_info[vfo_num].channel.mod_mode)
{
default:
case MOD_MODE_FM: strcpy(str, "FM"); break;
// case MOD_MODE_FM: strcpy(str, "FM"); break;
case MOD_MODE_AM: strcpy(str, "AM"); break;
case MOD_MODE_DSB: strcpy(str, "DS"); break;
default: strcpy(str, "??"); break;
}
}
else
{ // or show the CTCSS/DCS symbol
{ // or show the CTCSS/DCS symbol (when in FM mode)
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"};
const char *code_list[] = {"", "CTC", "DCS", "DCR"};
if (code_type < ARRAY_SIZE(code_list))
strcpy(str, code_list[code_type]);
}
@ -903,12 +907,9 @@ void UI_DisplayMain(void)
UI_PrintStringSmall("R", 62, 0, line + 2);
{ // show the narrow band symbol
str[0] = '\0';
strcpy(str, " ");
if (g_vfo_info[vfo_num].channel.channel_bandwidth == BANDWIDTH_NARROW)
{
str[0] = 'N';
str[1] = '\0';
}
UI_PrintStringSmall(str, 70, 0, line + 2);
}
@ -919,7 +920,6 @@ void UI_DisplayMain(void)
#else
if (g_vfo_info[vfo_num].channel.dtmf_decoding_enable)
UI_PrintStringSmall("DTMF", 78, 0, line + 2);
//UI_PrintStringSmall4x5("DTMF", 78, 0, line + 2); // font table is currently wrong
//UI_PrintStringSmallest("DTMF", 78, (line + 2) * 8, false, true);
#endif
@ -928,6 +928,8 @@ void UI_DisplayMain(void)
UI_PrintStringSmall("SCR", 106, 0, line + 2);
}
// *************************************************
if (g_center_line == CENTER_LINE_NONE &&
g_current_display_screen == DISPLAY_MAIN &&
g_dtmf_call_state == DTMF_CALL_STATE_NONE)

View File

@ -558,8 +558,8 @@ void UI_DisplayMenu(void)
strcpy(str, "USE\nMAIN SQL");
else
sprintf(str, "%d", g_sub_menu_selection);
// g_tx_vfo->squelch_level = g_sub_menu_selection;
// RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
//g_tx_vfo->squelch_level = g_sub_menu_selection;
//RADIO_ConfigureSquelch(g_tx_vfo);
channel_setting = true;
break;