0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-05-19 16:31:19 +03:00

Fix F+4 and F+* search bug

This commit is contained in:
OneOfEleven 2023-10-13 17:46:28 +01:00
parent 7f7c9490eb
commit bb79d51377
6 changed files with 60 additions and 35 deletions

View File

@ -1847,7 +1847,8 @@ void APP_TimeSlice10ms(void)
} }
else else
{ // RF carrier found { // RF carrier found
// stop RF the scan and move on too the CTCSS/CDCSS scan //
// stop RF search and start CTCSS/CDCSS search
BK4819_SetScanFrequency(g_search_frequency); BK4819_SetScanFrequency(g_search_frequency);
@ -1858,10 +1859,9 @@ void APP_TimeSlice10ms(void)
g_search_freq_css_timer_10ms = 0; g_search_freq_css_timer_10ms = 0;
g_search_css_state = SEARCH_CSS_STATE_SCANNING; g_search_css_state = SEARCH_CSS_STATE_SCANNING;
GUI_SelectNextDisplay(DISPLAY_SEARCH);
g_update_status = true; g_update_status = true;
g_update_display = true; g_update_display = true;
GUI_SelectNextDisplay(DISPLAY_SEARCH);
} }
g_search_delay_10ms = scan_freq_css_delay_10ms; g_search_delay_10ms = scan_freq_css_delay_10ms;
@ -1873,9 +1873,10 @@ void APP_TimeSlice10ms(void)
{ // CTCSS/CDCSS search timeout { // CTCSS/CDCSS search timeout
#if defined(ENABLE_CODE_SEARCH_TIMEOUT) #if defined(ENABLE_CODE_SEARCH_TIMEOUT)
BK4819_Disable();
g_search_css_state = SEARCH_CSS_STATE_FAILED; g_search_css_state = SEARCH_CSS_STATE_FAILED;
BK4819_Disable();
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
g_update_status = true; g_update_status = true;
g_update_display = true; g_update_display = true;
@ -1884,9 +1885,10 @@ void APP_TimeSlice10ms(void)
#else #else
if (!g_search_single_frequency) if (!g_search_single_frequency)
{ {
BK4819_Disable();
g_search_css_state = SEARCH_CSS_STATE_FAILED; g_search_css_state = SEARCH_CSS_STATE_FAILED;
BK4819_Disable();
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
g_update_status = true; g_update_status = true;
g_update_display = true; g_update_display = true;
@ -1903,11 +1905,12 @@ void APP_TimeSlice10ms(void)
if (ScanResult == BK4819_CSS_RESULT_CDCSS) if (ScanResult == BK4819_CSS_RESULT_CDCSS)
{ // found a CDCSS code { // found a CDCSS code
const uint8_t Code = DCS_GetCdcssCode(Result); const uint8_t code = DCS_GetCdcssCode(Result);
if (Code != 0xFF) if (code != 0xFF)
{ {
g_search_css_result_code = Code; g_search_hit_count = 0;
g_search_css_result_type = CODE_TYPE_DIGITAL; g_search_css_result_type = CODE_TYPE_DIGITAL;
g_search_css_result_code = code;
g_search_css_state = SEARCH_CSS_STATE_FOUND; g_search_css_state = SEARCH_CSS_STATE_FOUND;
g_search_use_css_result = true; g_search_use_css_result = true;
@ -1915,6 +1918,13 @@ void APP_TimeSlice10ms(void)
g_update_status = true; g_update_status = true;
g_update_display = true; g_update_display = true;
} }
else
{
g_search_hit_count = 0;
g_search_css_result_type = CODE_TYPE_NONE;
g_search_css_result_code = code;
g_search_use_css_result = false;
}
} }
else else
if (ScanResult == BK4819_CSS_RESULT_CTCSS) if (ScanResult == BK4819_CSS_RESULT_CTCSS)
@ -1925,7 +1935,7 @@ void APP_TimeSlice10ms(void)
if (code == g_search_css_result_code && if (code == g_search_css_result_code &&
g_search_css_result_type == CODE_TYPE_CONTINUOUS_TONE) g_search_css_result_type == CODE_TYPE_CONTINUOUS_TONE)
{ {
if (++g_search_hit_count >= 2) if (++g_search_hit_count >= 3)
{ {
g_search_css_state = SEARCH_CSS_STATE_FOUND; g_search_css_state = SEARCH_CSS_STATE_FOUND;
g_search_use_css_result = true; g_search_use_css_result = true;
@ -1936,10 +1946,19 @@ void APP_TimeSlice10ms(void)
} }
} }
else else
g_search_hit_count = 0; {
g_search_hit_count = 1;
g_search_css_result_type = CODE_TYPE_CONTINUOUS_TONE; g_search_css_result_type = CODE_TYPE_CONTINUOUS_TONE;
g_search_css_result_code = code; g_search_css_result_code = code;
g_search_use_css_result = false;
}
}
else
{
g_search_hit_count = 0;
g_search_css_result_type = CODE_TYPE_NONE;
g_search_css_result_code = 0xff;
g_search_use_css_result = false;
} }
} }

View File

@ -348,8 +348,8 @@ static void cmd_051D(const uint8_t *pBuffer)
#endif #endif
#ifdef ENABLE_PWRON_PASSWORD #ifdef ENABLE_PWRON_PASSWORD
if ((Offset < 0x0E98 || Offset >= 0x0EA0) || !g_password_locked || pCmd->bAllowPassword) if ((Offset < 0x0E98 || Offset >= 0x0EA0) || !g_password_locked || pCmd->allow_password)
EEPROM_WriteBuffer(Offset, &pCmd->Data[i * write_size]); EEPROM_WriteBuffer(Offset, &data[i * write_size]);
#else #else
EEPROM_WriteBuffer(Offset, &data[i * write_size]); EEPROM_WriteBuffer(Offset, &data[i * write_size]);
#endif #endif

Binary file not shown.

Binary file not shown.

View File

@ -50,8 +50,12 @@ static void Render(void)
void UI_DisplayLock(void) void UI_DisplayLock(void)
{ {
key_code_t Key; unsigned int g_debounce_counter = 0;
beep_type_t Beep; // bool g_key_being_held = false;
key_code_t g_key_reading_0 = KEY_INVALID;
// key_code_t g_key_reading_1;
key_code_t Key;
beep_type_t Beep;
g_update_display = true; g_update_display = true;
@ -73,11 +77,11 @@ void UI_DisplayLock(void)
{ {
if (Key == KEY_INVALID) if (Key == KEY_INVALID)
{ {
g_key_reading_1 = KEY_INVALID; // g_key_reading_1 = KEY_INVALID;
} }
else else
{ {
g_key_reading_1 = Key; // g_key_reading_1 = Key;
switch (Key) switch (Key)
{ {
@ -135,13 +139,13 @@ void UI_DisplayLock(void)
} }
} }
g_key_being_held = false; // g_key_being_held = false;
} }
} }
else else
{ {
g_debounce_counter = 0; g_debounce_counter = 0;
g_key_reading_0 = Key; g_key_reading_0 = Key;
} }
if (UART_IsCommandAvailable()) if (UART_IsCommandAvailable())

View File

@ -93,20 +93,22 @@ void UI_DisplaySearch(void)
case SEARCH_CSS_STATE_FOUND: case SEARCH_CSS_STATE_FOUND:
case SEARCH_CSS_STATE_REPEAT: case SEARCH_CSS_STATE_REPEAT:
strcpy(String, "CODE none found");
switch (g_search_css_result_type) if (g_search_use_css_result)
{ {
default: switch (g_search_css_result_type)
case CODE_TYPE_NONE: {
strcpy(String, "CODE none found"); default:
break; case CODE_TYPE_NONE:
case CODE_TYPE_CONTINUOUS_TONE: break;
sprintf(String, "CTCSS %u.%uHz", CTCSS_OPTIONS[g_search_css_result_code] / 10, CTCSS_OPTIONS[g_search_css_result_code] % 10); case CODE_TYPE_CONTINUOUS_TONE:
break; sprintf(String, "CTCSS %u.%uHz", CTCSS_OPTIONS[g_search_css_result_code] / 10, CTCSS_OPTIONS[g_search_css_result_code] % 10);
case CODE_TYPE_DIGITAL: break;
case CODE_TYPE_REVERSE_DIGITAL: case CODE_TYPE_DIGITAL:
sprintf(String, "CDCSS D%03oN", DCS_OPTIONS[g_search_css_result_code]); case CODE_TYPE_REVERSE_DIGITAL:
break; sprintf(String, "CDCSS D%03oN", DCS_OPTIONS[g_search_css_result_code]);
break;
}
} }
break; break;