0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 14:21:25 +03:00

Fix F+* and F+4 search bug - wiping out radios sram :(

This commit is contained in:
OneOfEleven 2023-10-26 10:48:32 +01:00
parent 8c8c183490
commit 4397931cfb
9 changed files with 49 additions and 58 deletions

View File

@ -217,7 +217,7 @@ static void SEARCH_Key_MENU(bool key_pressed, bool key_held)
case SEARCH_EDIT_STATE_SAVE_CHAN:
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("edit save chan\r\n");
// UART_SendText("edit save chan\r\n");
#endif
if (g_input_box_index > 0)
@ -235,7 +235,7 @@ static void SEARCH_Key_MENU(bool key_pressed, bool key_held)
case SEARCH_EDIT_STATE_SAVE_CONFIRM:
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("edit save confirm\r\n");
// UART_SendText("edit save confirm\r\n");
#endif
if (!g_search_single_frequency)
@ -428,9 +428,9 @@ void SEARCH_Start(void)
#if 1
// this is why it needs such a strong signal
BK4819_set_rf_filter_path(0xFFFFFFFF); // disable the LNA filter paths
BK4819_set_rf_filter_path(0xFFFFFFFF); // disable the LNA filter paths - why it needs a strong signal
#else
BK4819_set_rf_filter_path(g_rx_vfo->p_rx->frequency); // lets have a play ;)
BK4819_set_rf_filter_path(g_rx_vfo->p_rx->frequency); // lets have a play !
#endif
BK4819_EnableFrequencyScan();

Binary file not shown.

Binary file not shown.

View File

@ -16,7 +16,7 @@
// >= 24-bit pre-amble
// 40-bit sync
//
//static const uint8_t pre_amble[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xCC};
//static const uint8_t pre_amble[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xCC}; / add some bit reversals just before the sync pattern
static const uint8_t pre_amble[] = {0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t sync[] = {0x07, 0x09, 0x2a, 0x44, 0x6f};

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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;
}

View File

@ -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