mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-18 22:29:50 +03:00
Fix F+* and F+4 search bug - wiping out radios sram :(
This commit is contained in:
32
ui/helper.c
32
ui/helper.c
@ -70,22 +70,26 @@ void UI_GenerateChannelStringEx(char *pString, const char *prefix, const uint8_t
|
||||
sprintf(pString + strlen(prefix), "%03u", ChannelNumber + 1);
|
||||
}
|
||||
|
||||
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width)
|
||||
void UI_PrintString(const char *str, unsigned int start, const unsigned int end, const unsigned int line, const unsigned int width)
|
||||
{
|
||||
const size_t length = strlen(str);
|
||||
size_t i;
|
||||
size_t Length = strlen(pString);
|
||||
|
||||
if (End > Start)
|
||||
Start += ((End - Start) - (Length * Width) - 1) / 2;
|
||||
|
||||
for (i = 0; i < Length; i++)
|
||||
if (end > start)
|
||||
{
|
||||
if (pString[i] >= ' ' && pString[i] < 127)
|
||||
const int ofs = ((int)(end - start) - (length * width) - 1) / 2;
|
||||
if (ofs > 0 && (start + ofs) <= end)
|
||||
start += ofs;
|
||||
}
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
if (str[i] >= ' ' && str[i] < 127)
|
||||
{
|
||||
const unsigned int index = pString[i] - ' ';
|
||||
const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||
memcpy(g_frame_buffer[Line + 0] + ofs, &g_font_big[index][0], 8);
|
||||
memcpy(g_frame_buffer[Line + 1] + ofs, &g_font_big[index][8], 7);
|
||||
const unsigned int index = str[i] - ' ';
|
||||
const unsigned int ofs = start + (i * width);
|
||||
memcpy(g_frame_buffer[line + 0] + ofs, &g_font_big[index][0], 8);
|
||||
memcpy(g_frame_buffer[line + 1] + ofs, &g_font_big[index][8], 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -105,7 +109,11 @@ void UI_print_string(
|
||||
uint8_t *f_buf;
|
||||
|
||||
if (end > start)
|
||||
start += ((end - start) - (length * char_pitch)) / 2;
|
||||
{
|
||||
const int ofs = ((int)(end - start) - (length * char_pitch) - 1) / 2;
|
||||
if (ofs > 0 && (start + ofs) <= end)
|
||||
start += ofs;
|
||||
}
|
||||
|
||||
f_buf = g_frame_buffer[line] + start;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
void UI_GenerateChannelString(char *pString, const uint8_t Channel, const char separating_char);
|
||||
void UI_GenerateChannelStringEx(char *pString, const char *prefix, const uint8_t ChannelNumber);
|
||||
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width);
|
||||
void UI_PrintString(const char *str, unsigned int start, const unsigned int end, const unsigned int line, const unsigned int width);
|
||||
void UI_PrintStringSmall(const char *str, const unsigned int start, const unsigned int end, const unsigned int line);
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
void UI_PrintStringSmallBold(const char *str, const unsigned int start, const unsigned int end, const unsigned int line);
|
||||
|
22
ui/main.c
22
ui/main.c
@ -749,28 +749,6 @@ void UI_DisplayMain(void)
|
||||
{ // frequency mode
|
||||
#ifdef ENABLE_BIG_FREQ
|
||||
big_freq(frequency, x, line);
|
||||
/*
|
||||
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
|
||||
#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
|
||||
|
||||
|
@ -143,14 +143,14 @@ void UI_DisplaySearch(void)
|
||||
break;
|
||||
|
||||
case SEARCH_CSS_STATE_FOUND:
|
||||
strcpy(String, "* repeat M save");
|
||||
strcpy(String, "* repeat M save");
|
||||
text_centered = true;
|
||||
break;
|
||||
|
||||
case SEARCH_CSS_STATE_FAILED:
|
||||
if (!g_search_single_frequency)
|
||||
{
|
||||
strcpy(String, "* repeat M save");
|
||||
strcpy(String, "* repeat M save");
|
||||
text_centered = true;
|
||||
break;
|
||||
}
|
||||
@ -176,7 +176,7 @@ void UI_DisplaySearch(void)
|
||||
break;
|
||||
|
||||
case SEARCH_EDIT_STATE_SAVE_CONFIRM:
|
||||
strcpy(String, "* repeat Save ?");
|
||||
strcpy(String, "* repeat Save ?");
|
||||
text_centered = true;
|
||||
break;
|
||||
}
|
||||
|
35
ui/status.c
35
ui/status.c
@ -99,24 +99,29 @@ void UI_DisplayStatus(const bool test_display)
|
||||
else
|
||||
#endif
|
||||
// SCAN indicator
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || g_screen_to_display == DISPLAY_SEARCH || test_display)
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF ||
|
||||
g_screen_to_display == DISPLAY_SEARCH ||
|
||||
test_display)
|
||||
{
|
||||
if (g_scan_next_channel <= USER_CHANNEL_LAST)
|
||||
{ // channel mode
|
||||
if (g_eeprom.scan_list_default == 0)
|
||||
UI_PrintStringSmallBuffer("1", line + x);
|
||||
if (g_search_css_state == SEARCH_CSS_STATE_OFF) // don't display this if in search mode
|
||||
{
|
||||
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);
|
||||
}
|
||||
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);
|
||||
{ // frequency mode
|
||||
UI_PrintStringSmallBuffer("S", line + x);
|
||||
}
|
||||
x1 = x + 7;
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
UI_PrintStringSmallBuffer("S", line + x);
|
||||
}
|
||||
x1 = x + 7;
|
||||
}
|
||||
}
|
||||
x += 7; // font character width
|
||||
|
Reference in New Issue
Block a user