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

niw shows channel under freq if frequency is found in a channel

This commit is contained in:
OneOfEleven
2023-11-06 16:16:29 +00:00
parent be787babf2
commit 3779c5a36b
7 changed files with 90 additions and 47 deletions

View File

@ -696,9 +696,9 @@ void UI_DisplayMain(void)
// name
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold(str, x + 4, 0, line);
UI_PrintStringSmallBold(str, x + 4, 0, line + 0);
#else
UI_PrintStringSmall(str, x + 4, 0, line);
UI_PrintStringSmall(str, x + 4, 0, line + 0);
#endif
// frequency
@ -718,13 +718,35 @@ void UI_DisplayMain(void)
#ifdef ENABLE_BIG_FREQ
big_freq(frequency, x, line);
#else
// show the frequency in the main font
const unsigned int chan = g_vfo_info[vfo_num].freq_in_channel;
sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000);
#ifdef ENABLE_TRIM_TRAILING_ZEROS
NUMBER_trim_trailing_zeros(str);
#endif
UI_PrintString(str, x, 0, line, 8);
//g_vfo_info[vfo_num].freq_in_channel = SETTINGS_find_channel(frequency);
if (chan <= USER_CHANNEL_LAST)
{ // the frequency has a channel - show the channel name below the frequency
// frequency
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold(str, x + 4, 0, line + 0);
#else
UI_PrintStringSmall(str, x + 4, 0, line + 0);
#endif
// name
SETTINGS_fetch_channel_name(str, chan);
if (str[0] == 0)
sprintf(str, "CH-%03u", 1 + chan);
UI_PrintStringSmall(str, x + 4, 0, line + 1);
}
else
{ // show the frequency in the main font
UI_PrintString(str, x, 0, line, 8);
}
#endif
}

View File

@ -32,6 +32,14 @@
#include "ui/ui.h"
#include "ui/status.h"
void invert_pixels(void *p, const unsigned int size)
{
unsigned int i;
uint8_t *p8 = (uint8_t *)p;
for (i = 0; i < size; i++)
*p8++ ^= 0xff;
}
void UI_DisplayStatus(const bool test_display)
{
uint8_t *line = g_status_line;
@ -47,6 +55,7 @@ void UI_DisplayStatus(const bool test_display)
if (g_current_function == FUNCTION_TRANSMIT)
{
memcpy(line + x, BITMAP_TX, sizeof(BITMAP_TX));
invert_pixels(line + x, sizeof(BITMAP_TX));
}
else
if (g_current_function == FUNCTION_RECEIVE ||
@ -144,9 +153,14 @@ void UI_DisplayStatus(const bool test_display)
}
if (dw_running)
{
memcpy(line + x, BITMAP_TDR_RUNNING, sizeof(BITMAP_TDR_RUNNING));
invert_pixels(line + x, sizeof(BITMAP_TDR_RUNNING));
}
else
{
memcpy(line + x, BITMAP_TDR_HOLDING, sizeof(BITMAP_TDR_HOLDING));
}
x += sizeof(BITMAP_TDR_RUNNING) + 1;
}
@ -169,6 +183,8 @@ void UI_DisplayStatus(const bool test_display)
if (g_eeprom.config.setting.vox_enabled || test_display)
{
memcpy(line + x, g_vox_audio_detected ? BITMAP_VOX : BITMAP_VOX_SMALL, sizeof(BITMAP_VOX));
// if (g_vox_audio_detected)
// invert_pixels(line + x, sizeof(BITMAP_VOX));
x += sizeof(BITMAP_VOX) + 1;
}
#endif
@ -178,6 +194,7 @@ void UI_DisplayStatus(const bool test_display)
if (g_eeprom.config.setting.key_lock || test_display)
{
memcpy(line + x, BITMAP_KEYLOCK, sizeof(BITMAP_KEYLOCK));
invert_pixels(line + x, sizeof(BITMAP_KEYLOCK));
x += sizeof(BITMAP_KEYLOCK) + 1;
}
else
@ -185,6 +202,7 @@ void UI_DisplayStatus(const bool test_display)
if (g_fkey_pressed)
{
memcpy(line + x, BITMAP_F_KEY, sizeof(BITMAP_F_KEY));
// invert_pixels(line + x, sizeof(BITMAP_F_KEY));
x += sizeof(BITMAP_F_KEY);
}
x++;