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

Added compile option for the faster newer bigger larger manual up/dn frequency smootching

This commit is contained in:
OneOfEleven
2023-10-16 10:47:43 +01:00
parent 916be495d4
commit f69a997ac1
6 changed files with 151 additions and 119 deletions

View File

@ -674,17 +674,38 @@ void APP_stop_scan(void)
static void APP_next_freq(void)
{
g_rx_vfo->freq_config_rx.frequency = APP_set_frequency_by_step(g_rx_vfo, g_scan_state_dir);
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);
RADIO_ApplyOffset(g_rx_vfo);
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
RADIO_setup_registers(true);
new_band = FREQUENCY_GetBand(frequency);
#ifdef ENABLE_FASTER_CHANNEL_SCAN
g_scan_pause_delay_in_10ms = 9; // 90ms
#else
g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms;
#endif
g_rx_vfo->freq_config_rx.frequency = frequency;
if (new_band != old_band)
{ // original slow method
RADIO_ApplyOffset(g_rx_vfo);
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
RADIO_setup_registers(true);
#ifdef ENABLE_FASTER_CHANNEL_SCAN
g_scan_pause_delay_in_10ms = 9; // 90ms
#else
g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms;
#endif
}
else
{ // don't need to go through all the other stuff .. lets speed things up !!
BK4819_set_rf_frequency(frequency, true);
#ifdef ENABLE_FASTER_CHANNEL_SCAN
g_scan_pause_delay_in_10ms = 8; // 80ms
#else
g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms;
#endif
}
g_scan_keep_frequency = false;
g_update_display = true;
@ -1557,7 +1578,7 @@ void APP_time_slice_10ms(void)
if (g_flag_save_channel)
{
SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, g_flag_save_channel);
SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, g_flag_save_channel ? 1 : 0);
g_flag_save_channel = false;
RADIO_ConfigureChannel(g_eeprom.tx_vfo, VFO_CONFIGURE);

View File

@ -718,20 +718,25 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Direction)
{
static bool monitor_was_enabled = false;
#ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS
static bool monitor_was_enabled = false;
#endif
uint8_t Channel = g_eeprom.screen_channel[g_eeprom.tx_vfo];
// only update eeprom when the key is released (saves wear and tear)
if (!key_pressed && g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_NOT_NOAA_CHANNEL(Channel) && IS_FREQ_CHANNEL(Channel))
{
if (key_held && !key_pressed && !monitor_was_enabled && g_current_function == FUNCTION_MONITOR)
{ // re-enable the squelch
APP_start_listening(FUNCTION_RECEIVE, false);
g_monitor_enabled = false;
}
SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, 1);
#ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS
if (key_held && !key_pressed && !monitor_was_enabled && g_current_function == FUNCTION_MONITOR)
{ // re-enable the squelch
APP_start_listening(FUNCTION_RECEIVE, false);
g_monitor_enabled = false;
}
#endif
// only update eeprom when the key is released - saves a LOT of wear and tear on the little eeprom
g_flag_save_channel = 1;
//SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, 1);
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("save chan\r\n");
@ -781,9 +786,8 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
if (IS_FREQ_CHANNEL(Channel))
{ // step/down in frequency
const frequency_band_t old_band = FREQUENCY_GetBand(g_tx_vfo->freq_config_rx.frequency);
frequency_band_t new_band;
const frequency_band_t old_band = FREQUENCY_GetBand(g_tx_vfo->freq_config_rx.frequency);
const uint32_t frequency = APP_set_frequency_by_step(g_tx_vfo, Direction);
if (RX_freq_check(frequency) < 0)
@ -797,21 +801,23 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
g_tx_vfo->freq_config_rx.frequency = frequency;
if (new_band != old_band)
{
{ // original slow method
g_request_save_channel = 1;
}
else
{ // don't need to go through all the other stuff
{ // don't need to go through all the other stuff .. lets speed things up !!
#ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS
if (!key_held && key_pressed)
monitor_was_enabled = g_monitor_enabled;
if (key_held && key_pressed && !monitor_was_enabled)
{ // open the squelch if the user holds the key down
APP_start_listening(FUNCTION_MONITOR, false);
g_monitor_enabled = true;
}
#endif
if (!key_held && key_pressed)
monitor_was_enabled = g_monitor_enabled;
if (key_held && key_pressed && !monitor_was_enabled)
{ // open the squelch if the user holds the key down
APP_start_listening(FUNCTION_MONITOR, false);
g_monitor_enabled = true;
}
BK4819_set_rf_frequency(frequency, true);
//BK4819_PickRXFilterPathBasedOnFrequency(frequency);
}