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

added ignore freq compile option - use when frequency scanning, see README.md

This commit is contained in:
OneOfEleven
2023-11-03 15:19:29 +00:00
parent a3d603ea83
commit fba4ece9fd
10 changed files with 219 additions and 9 deletions

View File

@ -31,6 +31,9 @@
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
#include "driver/uart.h"
#endif
#ifdef ENABLE_SCAN_IGNORE_LIST
#include "freq_ignore.h"
#endif
#include "functions.h"
#include "misc.h"
#include "settings.h"
@ -247,6 +250,10 @@ void ACTION_Scan(bool bRestart)
// start scanning
#ifdef ENABLE_SCAN_IGNORE_LIST
FI_clear_freq_ignored();
#endif
g_monitor_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);

View File

@ -50,6 +50,9 @@
#include "dtmf.h"
#include "external/printf/printf.h"
#include "frequencies.h"
#ifdef ENABLE_SCAN_IGNORE_LIST
#include "freq_ignore.h"
#endif
#include "functions.h"
#include "helper/battery.h"
#ifdef ENABLE_MDC1200
@ -668,13 +671,28 @@ void APP_stop_scan(void)
static void APP_next_freq(void)
{
frequency_band_t new_band;
const frequency_band_t old_band = FREQUENCY_GetBand(g_rx_vfo->freq_config_rx.frequency);
const uint32_t frequency = APP_set_frequency_by_step(g_rx_vfo, g_scan_state_dir);
const frequency_band_t old_band = FREQUENCY_GetBand(g_rx_vfo->freq_config_rx.frequency);
uint32_t frequency = APP_set_frequency_by_step(g_rx_vfo, g_scan_state_dir);
g_rx_vfo->freq_config_rx.frequency = frequency;
#ifdef ENABLE_SCAN_IGNORE_LIST
while (FI_freq_ignored(frequency) >= 0)
{
uint32_t next_frequency;
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("skipping %u\r\n", frequency);
#endif
next_frequency = APP_set_frequency_by_step(g_rx_vfo, g_scan_state_dir); // skip to next frequency
if (frequency == next_frequency)
break;
frequency = next_frequency;
g_rx_vfo->freq_config_rx.frequency = frequency;
}
#endif
new_band = FREQUENCY_GetBand(frequency);
g_rx_vfo->freq_config_rx.frequency = frequency;
g_rx_vfo->freq_in_channel = 0xff;
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
@ -682,7 +700,7 @@ static void APP_next_freq(void)
#endif
if (new_band != old_band)
{ // original slow method
{ // original slower method
RADIO_ApplyOffset(g_rx_vfo, false);
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);

View File

@ -35,6 +35,9 @@
#endif
#include "dtmf.h"
#include "frequencies.h"
#ifdef ENABLE_SCAN_IGNORE_LIST
#include "freq_ignore.h"
#endif
#include "misc.h"
#include "radio.h"
#include "settings.h"
@ -807,14 +810,30 @@ void MAIN_Key_STAR(bool key_pressed, bool key_held)
return;
}
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || g_current_function == FUNCTION_TRANSMIT)
{ // RF scanning or TX'ing
if (g_current_function == FUNCTION_TRANSMIT)
return;
}
if (!g_fkey_pressed)
{ // pressed without the F-key
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
{ // RF scanning
if (scanning_paused())
{
FI_add_freq_ignored(g_rx_vfo->freq_config_rx.frequency);
// immediately continue the scan
g_scan_pause_tick_10ms = 0;
g_scan_pause_time_mode = false;
g_squelch_open = false;
g_rx_reception_mode = RX_MODE_NONE;
FUNCTION_Select(FUNCTION_FOREGROUND);
}
return;
}
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
{ // start entering a DTMF string
@ -833,6 +852,9 @@ void MAIN_Key_STAR(bool key_pressed, bool key_held)
{ // with the F-key
g_fkey_pressed = false;
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
return; // RF scanning
if (IS_NOAA_CHANNEL(g_tx_vfo->channel_save))
{
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;