mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
better manual freq up/dn but scan, faster freq scan
This commit is contained in:
parent
145e8b4a14
commit
b85ea562c7
@ -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;
|
||||
}
|
||||
|
||||
|
9
audio.c
9
audio.c
@ -112,6 +112,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
if (g_flash_light_state == FLASHLIGHT_SOS ||
|
||||
g_current_function == FUNCTION_RECEIVE ||
|
||||
g_monitor_enabled ||
|
||||
g_squelch_open ||
|
||||
GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER))
|
||||
{
|
||||
return;
|
||||
@ -119,7 +120,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
// if (g_current_display_screen == DISPLAY_AIRCOPY || g_aircopy_state != AIRCOPY_READY)
|
||||
// return;
|
||||
// return;
|
||||
#endif
|
||||
|
||||
// GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
@ -248,7 +249,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
BK4819_Sleep();
|
||||
}
|
||||
else
|
||||
if (g_speaker_enabled || g_monitor_enabled)
|
||||
if (g_squelch_open || g_monitor_enabled)
|
||||
{
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
@ -344,7 +345,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
BK1080_Mute(false);
|
||||
#endif
|
||||
|
||||
if (!g_speaker_enabled)
|
||||
if (!g_squelch_open && !g_monitor_enabled)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_voice_write_index = 0;
|
||||
@ -492,7 +493,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
BK1080_Mute(false);
|
||||
#endif
|
||||
|
||||
if (!g_speaker_enabled)
|
||||
if (!g_squelch_open && !g_monitor_enabled)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
// **********************
|
||||
|
@ -766,22 +766,9 @@ void BK4819_set_rf_frequency(const uint32_t frequency, const bool trigger_update
|
||||
BK4819_WriteRegister(0x39, (frequency >> 16) & 0xFFFF);
|
||||
|
||||
if (trigger_update)
|
||||
{
|
||||
// <15> 0 VCO Calibration 1 = enable 0 = disable
|
||||
// <14> ???
|
||||
// <13:10> 0 RX Link 15 = enable 0 = disable
|
||||
// <9> 0 AF DAC 1 = enable 0 = disable
|
||||
// <8> 0 DISC Mode 1 = enable 0 = disable
|
||||
// <7:4> 0 PLL/VCO 15 = enable 0 = disable
|
||||
// <3> 0 PA Gain 1 = enable 0 = disable
|
||||
// <2> 0 MIC ADC 1 = enable 0 = disable
|
||||
// <1> 0 TX DSP 1 = enable 0 = disable
|
||||
// <0> 0 RX DSP 1 = enable 0 = disable
|
||||
//
|
||||
// trigger a PLL/VCO update
|
||||
//
|
||||
{ // trigger a PLL/VCO update
|
||||
const uint16_t reg = BK4819_ReadRegister(0x30);
|
||||
BK4819_WriteRegister(0x30, 0);
|
||||
BK4819_WriteRegister(0x30, reg & ~BK4819_REG_30_ENABLE_VCO_CALIB);
|
||||
BK4819_WriteRegister(0x30, reg);
|
||||
}
|
||||
}
|
||||
@ -1087,7 +1074,6 @@ void BK4819_StartTone1(const uint16_t frequency, const unsigned int level, const
|
||||
|
||||
BK4819_ExitTxMute();
|
||||
|
||||
// enable speaker
|
||||
SYSTEM_DelayMs(2);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
@ -1137,7 +1123,7 @@ void BK4819_StopTones(const bool tx)
|
||||
|
||||
BK4819_ExitTxMute();
|
||||
|
||||
// if (g_speaker_enabled || g_monitor_enabled)
|
||||
// if (g_squelch_open || g_monitor_enabled)
|
||||
// {
|
||||
// SYSTEM_DelayMs(2);
|
||||
// GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
@ -1146,11 +1132,11 @@ void BK4819_StopTones(const bool tx)
|
||||
|
||||
void BK4819_PlayTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level)
|
||||
{
|
||||
// const uint16_t prev_af = BK4819_ReadRegister(0x47);
|
||||
const uint16_t prev_af = BK4819_ReadRegister(0x47);
|
||||
BK4819_StartTone1(tone_Hz, level, true);
|
||||
SYSTEM_DelayMs(delay - 2);
|
||||
BK4819_StopTones(g_current_function == FUNCTION_TRANSMIT);
|
||||
// BK4819_WriteRegister(0x47, prev_af);
|
||||
BK4819_WriteRegister(0x47, prev_af);
|
||||
}
|
||||
|
||||
void BK4819_PlayRoger(void)
|
||||
@ -1164,15 +1150,13 @@ void BK4819_PlayRoger(void)
|
||||
const uint32_t tone2_Hz = 1310;
|
||||
#endif
|
||||
|
||||
// const uint16_t prev_af = BK4819_ReadRegister(0x47);
|
||||
|
||||
const uint16_t prev_af = BK4819_ReadRegister(0x47);
|
||||
BK4819_StartTone1(tone1_Hz, 96, true);
|
||||
SYSTEM_DelayMs(80 - 2);
|
||||
BK4819_StartTone1(tone2_Hz, 96, false);
|
||||
SYSTEM_DelayMs(80);
|
||||
BK4819_StopTones(true);
|
||||
|
||||
// BK4819_WriteRegister(0x47, prev_af);
|
||||
BK4819_WriteRegister(0x47, prev_af);
|
||||
}
|
||||
|
||||
void BK4819_EnterTxMute(void)
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -121,7 +121,7 @@ void FUNCTION_Select(function_type_t Function)
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_fm_radio_mode)
|
||||
g_fm_restore_tick_10ms = fm_restore_10ms;
|
||||
g_fm_restore_tick_10ms = g_eeprom.scan_hold_time_500ms * 50;
|
||||
#endif
|
||||
|
||||
if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT ||
|
||||
@ -152,7 +152,6 @@ void FUNCTION_Select(function_type_t Function)
|
||||
|
||||
if (g_flash_light_state != FLASHLIGHT_SOS)
|
||||
{
|
||||
g_speaker_enabled = false;
|
||||
g_monitor_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
@ -226,7 +225,6 @@ void FUNCTION_Select(function_type_t Function)
|
||||
BK4819_StartTone1(500, 28, true);
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
SYSTEM_DelayMs(60);
|
||||
@ -256,7 +254,6 @@ void FUNCTION_Select(function_type_t Function)
|
||||
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
|
6
misc.c
6
misc.c
@ -27,9 +27,8 @@ const uint8_t obfuscate_array[16] = {
|
||||
|
||||
const uint8_t fm_resume_500ms = 2500 / 500; // 2.5 seconds
|
||||
const uint8_t fm_radio_500ms = 2000 / 500; // 2 seconds
|
||||
const uint16_t fm_play_scan_10ms = 40 / 10; // 40ms
|
||||
const uint16_t fm_play_scan_10ms = 60 / 10; // 60ms
|
||||
const uint16_t fm_play_noscan_10ms = 1200 / 10; // 1.2 seconds
|
||||
const uint16_t fm_restore_10ms = 5000 / 10; // 5 seconds
|
||||
|
||||
const uint8_t menu_timeout_500ms = 30000 / 500; // 30 seconds
|
||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||
@ -43,7 +42,7 @@ const uint8_t dtmf_txstop_500ms = 3000 / 500; // 6 sec
|
||||
|
||||
const uint8_t serial_config_tick_500ms = 3000 / 500; // 3 seconds
|
||||
|
||||
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds
|
||||
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds
|
||||
#ifdef ENABLE_KEYLOCK
|
||||
const uint8_t key_lock_timeout_500ms = 30000 / 500; // 30 seconds
|
||||
#endif
|
||||
@ -160,7 +159,6 @@ volatile uint16_t g_tail_tone_elimination_tick_10ms;
|
||||
volatile uint16_t g_noaa_tick_10ms;
|
||||
#endif
|
||||
|
||||
bool g_speaker_enabled;
|
||||
uint8_t g_key_input_count_down;
|
||||
#ifdef ENABLE_KEYLOCK
|
||||
uint8_t g_key_lock_tick_500ms;
|
||||
|
3
misc.h
3
misc.h
@ -116,7 +116,6 @@ extern const uint8_t fm_resume_500ms;
|
||||
extern const uint8_t fm_radio_500ms;
|
||||
extern const uint16_t fm_play_scan_10ms;
|
||||
extern const uint16_t fm_play_noscan_10ms;
|
||||
extern const uint16_t fm_restore_10ms;
|
||||
|
||||
extern const uint8_t menu_timeout_500ms;
|
||||
extern const uint16_t menu_timeout_long_500ms;
|
||||
@ -248,7 +247,7 @@ extern volatile uint16_t g_tail_tone_elimination_tick_10ms;
|
||||
#ifdef ENABLE_NOAA
|
||||
extern volatile uint16_t g_noaa_tick_10ms;
|
||||
#endif
|
||||
extern bool g_speaker_enabled;
|
||||
|
||||
extern uint8_t g_key_input_count_down;
|
||||
|
||||
#ifdef ENABLE_KEYLOCK
|
||||
|
12
radio.c
12
radio.c
@ -634,7 +634,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
|
||||
uint16_t interrupt_mask;
|
||||
uint32_t Frequency;
|
||||
|
||||
if (!g_speaker_enabled && !g_monitor_enabled)
|
||||
if (!g_monitor_enabled)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
// turn green LED off
|
||||
@ -833,6 +833,9 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
|
||||
|
||||
if (switch_to_function_foreground)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
|
||||
// if (g_monitor_enabled)
|
||||
// GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
@ -884,7 +887,6 @@ void RADIO_enableTX(const bool fsk_tx)
|
||||
{
|
||||
BK4819_filter_bandwidth_t Bandwidth = g_current_vfo->channel_bandwidth;
|
||||
|
||||
g_speaker_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, false);
|
||||
@ -957,7 +959,7 @@ void RADIO_enableTX(const bool fsk_tx)
|
||||
}
|
||||
}
|
||||
|
||||
void RADIO_Setg_vfo_state(vfo_state_t State)
|
||||
void RADIO_set_vfo_state(vfo_state_t State)
|
||||
{
|
||||
if (State == VFO_STATE_NORMAL)
|
||||
{
|
||||
@ -1047,7 +1049,7 @@ void RADIO_PrepareTX(void)
|
||||
if (State != VFO_STATE_NORMAL)
|
||||
{ // TX not allowed
|
||||
|
||||
RADIO_Setg_vfo_state(State);
|
||||
RADIO_set_vfo_state(State);
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
g_alarm_state = ALARM_STATE_OFF;
|
||||
@ -1147,7 +1149,6 @@ void RADIO_tx_eot(void)
|
||||
{ // end-of-tx
|
||||
if (g_eeprom.dtmf_side_tone)
|
||||
{
|
||||
g_speaker_enabled = true;
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
SYSTEM_DelayMs(60);
|
||||
@ -1162,7 +1163,6 @@ void RADIO_tx_eot(void)
|
||||
g_eeprom.dtmf_code_persist_time,
|
||||
g_eeprom.dtmf_code_interval_time);
|
||||
|
||||
g_speaker_enabled = false;
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
else
|
||||
|
2
radio.h
2
radio.h
@ -155,7 +155,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground);
|
||||
#endif
|
||||
void RADIO_enableTX(const bool fsk_tx);
|
||||
|
||||
void RADIO_Setg_vfo_state(vfo_state_t State);
|
||||
void RADIO_set_vfo_state(vfo_state_t State);
|
||||
void RADIO_PrepareTX(void);
|
||||
void RADIO_EnableCxCSS(void);
|
||||
void RADIO_PrepareCssTX(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user