mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-18 22:29:50 +03:00
.
This commit is contained in:
129
app/action.c
129
app/action.c
@ -201,6 +201,9 @@ void ACTION_Scan(bool bRestart)
|
||||
if (g_current_display_screen != DISPLAY_SEARCH)
|
||||
{ // not in freq/ctcss/cdcss search mode
|
||||
|
||||
if (IS_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
||||
return;
|
||||
|
||||
g_monitor_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
@ -211,70 +214,82 @@ void ACTION_Scan(bool bRestart)
|
||||
|
||||
RADIO_select_vfos();
|
||||
|
||||
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save))
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
||||
{ // currently scanning
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
|
||||
if (g_scan_next_channel <= USER_CHANNEL_LAST)
|
||||
{ // channel mode
|
||||
|
||||
if (g_eeprom.config.setting.scan_list_default < 2)
|
||||
{ // keep scanning but toggle between scan lists
|
||||
|
||||
//g_eeprom.config.setting.scan_list_default = (g_eeprom.config.setting.scan_list_default + 1) % 3;
|
||||
g_eeprom.config.setting.scan_list_default++;
|
||||
|
||||
// jump to the next channel
|
||||
APP_channel_next(true, g_scan_state_dir);
|
||||
|
||||
g_scan_tick_10ms = 0;
|
||||
g_scan_pause_time_mode = false;
|
||||
|
||||
g_update_status = true;
|
||||
return;
|
||||
}
|
||||
|
||||
g_eeprom.config.setting.scan_list_default = 0; // back to scan list 1 - the next time we start scanning
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
||||
{ // currently scanning
|
||||
|
||||
if (g_scan_next_channel <= USER_CHANNEL_LAST)
|
||||
{ // channel mode
|
||||
|
||||
if (g_eeprom.config.setting.scan_list_default < 2)
|
||||
{ // keep scanning but toggle between scan lists
|
||||
|
||||
//g_eeprom.config.setting.scan_list_default = (g_eeprom.config.setting.scan_list_default + 1) % 3;
|
||||
g_eeprom.config.setting.scan_list_default++;
|
||||
|
||||
// jump to the next channel
|
||||
APP_channel_next(true, g_scan_state_dir);
|
||||
|
||||
g_scan_tick_10ms = 0;
|
||||
g_scan_pause_time_mode = false;
|
||||
|
||||
g_update_status = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// stop scanning
|
||||
|
||||
APP_stop_scan();
|
||||
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
return;
|
||||
|
||||
g_eeprom.config.setting.scan_list_default = 0; // back to scan list 1 - the next time we start scanning
|
||||
}
|
||||
|
||||
// *****************
|
||||
// stop scanning
|
||||
|
||||
APP_stop_scan();
|
||||
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
|
||||
// start scanning
|
||||
|
||||
#ifdef ENABLE_SCAN_IGNORE_LIST
|
||||
// FI_clear_freq_ignored();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
g_monitor_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
APP_channel_next(true, SCAN_STATE_DIR_FORWARD);
|
||||
|
||||
g_scan_tick_10ms = 0; // go NOW
|
||||
g_scan_pause_time_mode = false;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
AUDIO_PlaySingleVoice(true);
|
||||
#endif
|
||||
|
||||
// clear the other vfo's rssi level (to hide the antenna symbol)
|
||||
g_vfo_rssi_bar_level[(g_rx_vfo_num + 1) & 1u] = 0;
|
||||
|
||||
g_update_status = true;
|
||||
// **********************
|
||||
// start scanning
|
||||
|
||||
{
|
||||
const uint32_t freq = g_tx_vfo->freq_config_rx.frequency;
|
||||
const frequency_band_t band = FREQUENCY_GetBand(freq);
|
||||
g_scan_initial_upper = FREQ_BAND_TABLE[band].upper;
|
||||
g_scan_initial_lower = FREQ_BAND_TABLE[band].lower;
|
||||
g_scan_initial_step_size = g_tx_vfo->step_freq;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SCAN_RANGES
|
||||
if (IS_FREQ_CHANNEL(g_tx_vfo->channel_save))
|
||||
{
|
||||
const uint32_t freq = g_tx_vfo->freq_config_rx.frequency;
|
||||
FREQUENCY_scan_range(freq, &g_scan_initial_lower, &g_scan_initial_upper, &g_scan_initial_step_size);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_monitor_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
APP_channel_next(true, SCAN_STATE_DIR_FORWARD);
|
||||
|
||||
g_scan_tick_10ms = 0; // go NOW
|
||||
g_scan_pause_time_mode = false;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
AUDIO_PlaySingleVoice(true);
|
||||
#endif
|
||||
|
||||
// clear the other vfo's rssi level (to hide the antenna symbol)
|
||||
g_vfo_rssi_bar_level[(g_rx_vfo_num + 1) & 1u] = 0;
|
||||
|
||||
g_update_status = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
32
app/app.c
32
app/app.c
@ -115,7 +115,7 @@ static void APP_check_for_new_receive(void)
|
||||
if (g_css_scan_mode != CSS_SCAN_MODE_OFF && g_rx_reception_mode == RX_MODE_NONE)
|
||||
{ // CTCSS/DTS scanning
|
||||
|
||||
g_scan_tick_10ms = scan_pause_code_10ms;
|
||||
g_scan_tick_10ms = scan_pause_code_10ms;
|
||||
g_scan_pause_time_mode = false;
|
||||
g_rx_reception_mode = RX_MODE_DETECTED;
|
||||
}
|
||||
@ -647,33 +647,23 @@ void APP_stop_scan(void)
|
||||
|
||||
static void APP_next_freq(void)
|
||||
{
|
||||
uint32_t freq = g_tx_vfo->freq_config_rx.frequency;
|
||||
const uint32_t step = g_tx_vfo->step_freq;
|
||||
const frequency_band_t band = FREQUENCY_GetBand(freq);
|
||||
uint32_t upper = FREQ_BAND_TABLE[band].upper;
|
||||
uint32_t lower = FREQ_BAND_TABLE[band].lower;
|
||||
|
||||
if (band == BAND2_108MHz)
|
||||
{ // air band
|
||||
if (freq < 11800000)
|
||||
upper = 11800000; // lower airband half
|
||||
else
|
||||
lower = 11800000; // upper airband half
|
||||
}
|
||||
uint32_t freq = g_tx_vfo->freq_config_rx.frequency;
|
||||
|
||||
#ifdef ENABLE_SCAN_IGNORE_LIST
|
||||
do {
|
||||
#endif
|
||||
freq += step * g_scan_state_dir;
|
||||
freq += g_scan_initial_step_size * g_scan_state_dir;
|
||||
|
||||
// wrap-a-round
|
||||
while (freq >= upper)
|
||||
freq -= upper - lower;
|
||||
while (freq < lower)
|
||||
freq += upper - lower;
|
||||
while (freq >= g_scan_initial_upper)
|
||||
freq -= g_scan_initial_upper - g_scan_initial_lower;
|
||||
while (freq < g_scan_initial_lower)
|
||||
freq += g_scan_initial_upper - g_scan_initial_lower;
|
||||
|
||||
if (band == BAND2_108MHz) // air band uses set channels
|
||||
freq = lower + ((((freq - lower) + (step / 2)) / step) * step);
|
||||
// round
|
||||
#ifdef ENABLE_SCAN_RANGES
|
||||
freq = g_scan_initial_lower + ((((freq - g_scan_initial_lower) + (g_scan_initial_step_size / 2)) / g_scan_initial_step_size) * g_scan_initial_step_size);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SCAN_IGNORE_LIST
|
||||
} while (FI_freq_ignored(freq) >= 0);
|
||||
|
43
app/main.c
43
app/main.c
@ -1007,30 +1007,37 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio
|
||||
if (IS_FREQ_CHANNEL(Channel))
|
||||
{ // frequency mode
|
||||
|
||||
uint32_t freq = g_tx_vfo->freq_config_rx.frequency;
|
||||
const uint32_t step = g_tx_vfo->step_freq;
|
||||
const frequency_band_t band = FREQUENCY_GetBand(freq);
|
||||
uint32_t upper = FREQ_BAND_TABLE[band].upper;
|
||||
uint32_t lower = FREQ_BAND_TABLE[band].lower;
|
||||
uint32_t freq = g_tx_vfo->freq_config_rx.frequency;
|
||||
|
||||
if (band == BAND2_108MHz)
|
||||
{ // air band
|
||||
if (freq < 11800000)
|
||||
upper = 11800000; // lower airband half
|
||||
else
|
||||
lower = 11800000; // upper airband half
|
||||
if (key_pressed && !key_held)
|
||||
{ // just pressed
|
||||
const frequency_band_t band = FREQUENCY_GetBand(freq);
|
||||
|
||||
g_scan_initial_upper = FREQ_BAND_TABLE[band].upper;
|
||||
g_scan_initial_lower = FREQ_BAND_TABLE[band].lower;
|
||||
g_scan_initial_step_size = g_tx_vfo->step_freq;
|
||||
|
||||
#ifdef ENABLE_SCAN_RANGES
|
||||
//FREQUENCY_scan_range(freq, &g_scan_initial_lower, &g_scan_initial_upper, &g_scan_initial_step_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
freq += step * direction;
|
||||
freq += g_scan_initial_step_size * direction;
|
||||
|
||||
// wrap-a-round
|
||||
while (freq >= upper)
|
||||
freq -= upper - lower;
|
||||
while (freq < lower)
|
||||
freq += upper - lower;
|
||||
if (key_held)
|
||||
{ // key is held down
|
||||
while (freq >= g_scan_initial_upper)
|
||||
freq -= g_scan_initial_upper - g_scan_initial_lower;
|
||||
while (freq < g_scan_initial_lower)
|
||||
freq += g_scan_initial_upper - g_scan_initial_lower;
|
||||
}
|
||||
|
||||
if (band == BAND2_108MHz) // air band uses set channels
|
||||
freq = lower + ((((freq - lower) + (step / 2)) / step) * step);
|
||||
// round
|
||||
#ifdef ENABLE_SCAN_RANGES
|
||||
//if (key_held)
|
||||
// freq = g_scan_initial_lower + ((((freq - g_scan_initial_lower) + (g_scan_initial_step_size / 2)) / g_scan_initial_step_size) * g_scan_initial_step_size);
|
||||
#endif
|
||||
|
||||
if (FREQUENCY_rx_freq_check(freq) < 0)
|
||||
{ // frequency not allowed
|
||||
|
Reference in New Issue
Block a user