mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
Apply trailing zero suppression to big font frequency display
This commit is contained in:
parent
28f78cfcb6
commit
b41079cfa6
2
Makefile
2
Makefile
@ -12,7 +12,7 @@ ENABLE_OVERLAY := 0
|
|||||||
ENABLE_LTO := 1
|
ENABLE_LTO := 1
|
||||||
# UART Programming 2.9 kB
|
# UART Programming 2.9 kB
|
||||||
ENABLE_UART := 1
|
ENABLE_UART := 1
|
||||||
ENABLE_UART_DEBUG := 1
|
ENABLE_UART_DEBUG := 0
|
||||||
# AirCopy 2.5 kB
|
# AirCopy 2.5 kB
|
||||||
ENABLE_AIRCOPY := 1
|
ENABLE_AIRCOPY := 1
|
||||||
ENABLE_AIRCOPY_REMEMBER_FREQ := 1
|
ENABLE_AIRCOPY_REMEMBER_FREQ := 1
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
15
ui/helper.c
15
ui/helper.c
@ -204,6 +204,7 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
|
|||||||
uint8_t *pFb0 = g_frame_buffer[Y] + X;
|
uint8_t *pFb0 = g_frame_buffer[Y] + X;
|
||||||
uint8_t *pFb1 = pFb0 + 128;
|
uint8_t *pFb1 = pFb0 + 128;
|
||||||
bool bCanDisplay = false;
|
bool bCanDisplay = false;
|
||||||
|
unsigned int len = 6;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
// MHz
|
// MHz
|
||||||
@ -231,8 +232,20 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
|
|||||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||||
|
|
||||||
|
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||||
|
if (pDigits[len + 1] == 0 && pDigits[len + 2] == 0)
|
||||||
|
{
|
||||||
|
if (pDigits[len - 1] == 0)
|
||||||
|
{
|
||||||
|
len--;
|
||||||
|
if (pDigits[len - 1] == 0)
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// kHz
|
// kHz
|
||||||
while (i < 6)
|
while (i < len)
|
||||||
{
|
{
|
||||||
const unsigned int Digit = pDigits[i++];
|
const unsigned int Digit = pDigits[i++];
|
||||||
memcpy(pFb0, g_font_big_digits[Digit], char_width);
|
memcpy(pFb0, g_font_big_digits[Digit], char_width);
|
||||||
|
34
ui/main.c
34
ui/main.c
@ -663,11 +663,28 @@ void UI_DisplayMain(void)
|
|||||||
case MDF_FREQUENCY: // just channel frequency
|
case MDF_FREQUENCY: // just channel frequency
|
||||||
|
|
||||||
#ifdef ENABLE_BIG_FREQ
|
#ifdef ENABLE_BIG_FREQ
|
||||||
|
|
||||||
NUMBER_ToDigits(frequency, str);
|
NUMBER_ToDigits(frequency, str);
|
||||||
|
|
||||||
// show the main large frequency digits
|
// show the main large frequency digits
|
||||||
UI_DisplayFrequency(str, x, line, false, false);
|
UI_DisplayFrequency(str, x, line, false, false);
|
||||||
|
|
||||||
// show the remaining 2 small frequency digits
|
// 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
|
#else
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||||
@ -733,7 +750,20 @@ void UI_DisplayMain(void)
|
|||||||
UI_DisplayFrequency(str, x, line, false, false);
|
UI_DisplayFrequency(str, x, line, false, false);
|
||||||
|
|
||||||
// show the remaining 2 small frequency digits
|
// 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
|
#else
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
|
Loading…
x
Reference in New Issue
Block a user