mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 06:39:49 +03:00
better manual freq up/dn but scan, faster freq scan
This commit is contained in:
@ -119,7 +119,7 @@ void ACTION_Monitor(void)
|
||||
|
||||
g_monitor_enabled = false;
|
||||
|
||||
if (!g_speaker_enabled)
|
||||
if (!g_squelch_open)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
||||
|
40
app/app.c
40
app/app.c
@ -404,9 +404,6 @@ Skip:
|
||||
break;
|
||||
|
||||
case END_OF_RX_MODE_END:
|
||||
if (!g_monitor_enabled)
|
||||
g_speaker_enabled = false;
|
||||
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
@ -421,10 +418,7 @@ Skip:
|
||||
|
||||
if (g_eeprom.tail_note_elimination)
|
||||
{
|
||||
if (!g_monitor_enabled)
|
||||
g_speaker_enabled = false;
|
||||
|
||||
if (!g_speaker_enabled && !g_monitor_enabled)
|
||||
if (!g_squelch_open && !g_monitor_enabled)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_tail_tone_elimination_tick_10ms = 20; // 200ms
|
||||
@ -542,6 +536,8 @@ bool APP_start_listening(void)
|
||||
|
||||
FUNCTION_Select(FUNCTION_RECEIVE);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
#ifdef MUTE_AUDIO_FOR_VOICE
|
||||
if (g_voice_write_index == 0)
|
||||
@ -558,10 +554,6 @@ bool APP_start_listening(void)
|
||||
BK1080_Init(0, false); // disable the FM radio audio
|
||||
#endif
|
||||
|
||||
// enable the speaker
|
||||
g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
if (g_current_display_screen != DISPLAY_MENU)
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
|
||||
@ -706,7 +698,8 @@ static void APP_next_freq(void)
|
||||
BK4819_set_rf_filter_path(frequency);
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
g_scan_pause_tick_10ms = 10; // 100ms
|
||||
// g_scan_pause_tick_10ms = 10; // 100ms
|
||||
g_scan_pause_tick_10ms = 6; // 60ms
|
||||
#else
|
||||
g_scan_pause_tick_10ms = scan_pause_freq_10ms;
|
||||
#endif
|
||||
@ -983,6 +976,9 @@ void APP_process_radio_interrupts(void)
|
||||
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
|
||||
|
||||
if (!g_monitor_enabled)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_SendText("sq close\r\n");
|
||||
#endif
|
||||
@ -1035,12 +1031,13 @@ void APP_end_tx(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
g_speaker_enabled = false;
|
||||
|
||||
RADIO_setup_registers(false);
|
||||
|
||||
if (g_monitor_enabled)
|
||||
APP_start_listening();
|
||||
|
||||
if (g_squelch_open || g_monitor_enabled)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
@ -1373,7 +1370,7 @@ void APP_cancel_user_input_modes(void)
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
static void APP_alarm_off(void)
|
||||
{
|
||||
if (!g_speaker_enabled && !g_monitor_enabled)
|
||||
if (!g_squelch_open && !g_monitor_enabled)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
if (g_eeprom.alarm_mode == ALARM_MODE_TONE)
|
||||
@ -1392,7 +1389,7 @@ void APP_cancel_user_input_modes(void)
|
||||
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
if (!g_monitor_enabled && !g_speaker_enabled)
|
||||
if (!g_squelch_open && !g_monitor_enabled)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
else
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
@ -1676,7 +1673,6 @@ void APP_process_transmit(void)
|
||||
BK4819_TransmitTone(true, 500);
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_alarm_tone_counter_10ms = 0;
|
||||
@ -2122,7 +2118,7 @@ void APP_time_slice_500ms(void)
|
||||
{
|
||||
if (--g_fm_resume_tick_500ms == 0)
|
||||
{
|
||||
RADIO_Setg_vfo_state(VFO_STATE_NORMAL);
|
||||
RADIO_set_vfo_state(VFO_STATE_NORMAL);
|
||||
|
||||
if (g_current_function != FUNCTION_RECEIVE &&
|
||||
!g_monitor_enabled &&
|
||||
@ -2241,7 +2237,7 @@ void APP_time_slice_10ms(void)
|
||||
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
|
||||
RADIO_Setg_vfo_state(VFO_STATE_TIMEOUT);
|
||||
RADIO_set_vfo_state(VFO_STATE_TIMEOUT);
|
||||
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
@ -2406,7 +2402,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
|
||||
|
||||
// reset the state so as to remove it from the screen
|
||||
if (Key != KEY_INVALID && Key != KEY_PTT)
|
||||
RADIO_Setg_vfo_state(VFO_STATE_NORMAL);
|
||||
RADIO_set_vfo_state(VFO_STATE_NORMAL);
|
||||
#if 0
|
||||
// remember the current backlight state (on / off)
|
||||
const bool backlight_was_on = GPIO_CheckBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
@ -2619,7 +2615,6 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
|
||||
{
|
||||
if (!key_pressed)
|
||||
{
|
||||
// g_speaker_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
BK4819_ExitDTMF_TX(false);
|
||||
@ -2634,7 +2629,6 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
|
||||
{
|
||||
if (g_eeprom.dtmf_side_tone)
|
||||
{ // user will here the DTMF tones in speaker
|
||||
// g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
|
||||
@ -2835,7 +2829,7 @@ Skip:
|
||||
g_vfo_rssi_bar_level[0] = 0;
|
||||
g_vfo_rssi_bar_level[1] = 0;
|
||||
|
||||
if (g_speaker_enabled || g_monitor_enabled)
|
||||
if (g_squelch_open || g_monitor_enabled)
|
||||
APP_start_listening();
|
||||
|
||||
g_flag_reconfigure_vfos = false;
|
||||
|
@ -439,7 +439,6 @@ bool DTMF_Reply(void)
|
||||
|
||||
if (g_eeprom.dtmf_side_tone)
|
||||
{ // the user will also hear the transmitted tones
|
||||
g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
|
||||
@ -455,7 +454,6 @@ bool DTMF_Reply(void)
|
||||
g_eeprom.dtmf_code_persist_time,
|
||||
g_eeprom.dtmf_code_interval_time);
|
||||
|
||||
g_speaker_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
BK4819_ExitDTMF_TX(false);
|
||||
|
9
app/fm.c
9
app/fm.c
@ -112,7 +112,6 @@ void FM_erase_channels(void)
|
||||
|
||||
void FM_tune(uint16_t frequency, const fm_scan_state_dir_t scan_state_dir, const bool flag)
|
||||
{
|
||||
g_speaker_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_fm_play_tick_10ms = (g_fm_scan_state_dir == FM_SCAN_STATE_DIR_OFF) ? fm_play_noscan_10ms : fm_play_scan_10ms;
|
||||
@ -162,7 +161,6 @@ void FM_stop_scan(void)
|
||||
g_fm_schedule = false;
|
||||
g_ask_to_save = false;
|
||||
|
||||
g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_update_display = true;
|
||||
@ -230,7 +228,6 @@ void FM_scan(void)
|
||||
if (!g_eeprom.fm_channel_mode)
|
||||
g_eeprom.fm_selected_frequency = g_eeprom.fm_frequency_playing;
|
||||
|
||||
g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
@ -267,7 +264,6 @@ void FM_turn_on(void)
|
||||
// enable the FM radio chip
|
||||
BK1080_Init(g_eeprom.fm_frequency_playing, true);
|
||||
|
||||
g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_update_display = true;
|
||||
@ -280,11 +276,8 @@ void FM_turn_off(void)
|
||||
g_fm_scan_state_dir = FM_SCAN_STATE_DIR_OFF;
|
||||
g_fm_restore_tick_10ms = 0;
|
||||
|
||||
if (!g_monitor_enabled)
|
||||
{
|
||||
g_speaker_enabled = false;
|
||||
if (!g_squelch_open && !g_monitor_enabled)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
|
||||
// disable the FM chip
|
||||
BK1080_Init(0, false);
|
||||
|
@ -127,7 +127,7 @@ void GENERIC_Key_PTT(bool key_pressed)
|
||||
g_vox_noise_detected = false;
|
||||
#endif
|
||||
|
||||
RADIO_Setg_vfo_state(VFO_STATE_NORMAL);
|
||||
RADIO_set_vfo_state(VFO_STATE_NORMAL);
|
||||
|
||||
if (g_current_display_screen != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
|
34
app/main.c
34
app/main.c
@ -52,7 +52,7 @@ bool scanning_paused(void)
|
||||
{ // scanning isn't paused
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ void processFKeyFunction(const key_code_t Key)
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case KEY_1: // BAND
|
||||
@ -251,7 +251,7 @@ void processFKeyFunction(const key_code_t Key)
|
||||
else
|
||||
Band = BAND6_400MHz; // jump to next band
|
||||
g_tx_vfo->band = Band;
|
||||
|
||||
|
||||
g_eeprom.screen_channel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
g_eeprom.freq_channel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
|
||||
@ -694,10 +694,10 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held)
|
||||
|
||||
if (!key_held)
|
||||
return;
|
||||
|
||||
|
||||
if (key_pressed)
|
||||
return;
|
||||
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_fm_radio_mode)
|
||||
{
|
||||
@ -705,7 +705,7 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (g_input_box_index > 0 || g_dtmf_input_box_index > 0 || g_dtmf_input_mode)
|
||||
{ // cancel key input mode (channel/frequency entry)
|
||||
g_dtmf_input_mode = false;
|
||||
@ -878,7 +878,7 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
|
||||
{ // re-enable the squelch
|
||||
|
||||
g_monitor_enabled = false;
|
||||
|
||||
// GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
APP_start_listening();
|
||||
}
|
||||
#endif
|
||||
@ -891,9 +891,9 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
|
||||
SETTINGS_save_channel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, 1);
|
||||
|
||||
RADIO_ApplyOffset(g_tx_vfo, true);
|
||||
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("save chan %u\r\n", g_tx_vfo->channel_save);
|
||||
// UART_printf("save chan %u\r\n", g_tx_vfo->channel_save);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -988,7 +988,8 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
|
||||
if (key_held && key_pressed && !monitor_was_enabled)
|
||||
{ // open the squelch if the user holds the key down
|
||||
g_monitor_enabled = true;
|
||||
APP_start_listening();
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
// APP_start_listening();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1000,17 +1001,18 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
|
||||
}
|
||||
|
||||
// channel mode
|
||||
|
||||
|
||||
g_tx_vfo->freq_in_channel = 0xff;
|
||||
|
||||
#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
|
||||
g_monitor_enabled = true;
|
||||
APP_start_listening();
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
// APP_start_listening();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1049,20 +1051,18 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
|
||||
return;
|
||||
}
|
||||
|
||||
// g_speaker_enabled = false;
|
||||
// g_monitor_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
// jump to the next channel
|
||||
APP_channel_next(false, Direction);
|
||||
|
||||
// go NOW
|
||||
g_scan_pause_tick_10ms = 0;
|
||||
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);
|
||||
|
||||
|
||||
g_ptt_was_released = true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user