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

Apply trailing zero suppression to big font frequency display

This commit is contained in:
OneOfEleven
2023-10-25 22:26:49 +01:00
parent 28f78cfcb6
commit b41079cfa6
5 changed files with 48 additions and 5 deletions

View File

@ -663,11 +663,28 @@ void UI_DisplayMain(void)
case MDF_FREQUENCY: // just channel frequency
#ifdef ENABLE_BIG_FREQ
NUMBER_ToDigits(frequency, str);
// show the main large frequency digits
UI_DisplayFrequency(str, x, line, false, false);
// show the remaining 2 small frequency digits
UI_Displaysmall_digits(2, str + 6, x + 81, line + 1, true);
#ifdef ENABLE_TRIM_TRAILING_ZEROS
{
unsigned int small_num = 2;
if (str[7] == 0)
{
small_num--;
if (str[6] == 0)
small_num--;
}
UI_Displaysmall_digits(small_num, str + 6, x + 81, line + 1, true);
}
#else
UI_Displaysmall_digits(2, str + 6, x + 81, line + 1, true);
#endif
#else
// show the frequency in the main font
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
@ -726,14 +743,27 @@ void UI_DisplayMain(void)
// if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo_num]))
{ // frequency mode
#ifdef ENABLE_BIG_FREQ
NUMBER_ToDigits(frequency, str); // 8 digits
// show the main large frequency digits
UI_DisplayFrequency(str, x, line, false, false);
// show the remaining 2 small frequency digits
UI_Displaysmall_digits(2, str + 6, x + 81, line + 1, true);
#ifdef ENABLE_TRIM_TRAILING_ZEROS
{
unsigned int small_num = 2;
if (str[7] == 0)
{
small_num--;
if (str[6] == 0)
small_num--;
}
UI_Displaysmall_digits(small_num, str + 6, x + 81, line + 1, true);
}
#else
UI_Displaysmall_digits(2, str + 6, x + 81, line + 1, true);
#endif
#else
// show the frequency in the main font