0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-05-19 00:11:18 +03:00
This commit is contained in:
OneOfEleven 2023-11-08 12:17:35 +00:00
parent c958962b44
commit 2757c22bab
7 changed files with 51 additions and 39 deletions

View File

@ -10,7 +10,7 @@ ENABLE_OVERLAY := 0
ENABLE_LTO := 1 ENABLE_LTO := 1
# UART Programming 2.9 kB # UART Programming 2.9 kB
ENABLE_UART := 1 ENABLE_UART := 1
ENABLE_UART_DEBUG := 0 ENABLE_UART_DEBUG := 1
# AirCopy 2.5 kB # AirCopy 2.5 kB
ENABLE_AIRCOPY := 0 ENABLE_AIRCOPY := 0
ENABLE_AIRCOPY_REMEMBER_FREQ := 1 ENABLE_AIRCOPY_REMEMBER_FREQ := 1
@ -27,7 +27,7 @@ ENABLE_NOAA := 0
ENABLE_VOICE := 0 ENABLE_VOICE := 0
ENABLE_MUTE_RADIO_FOR_VOICE := 0 ENABLE_MUTE_RADIO_FOR_VOICE := 0
# Tx on Voice 1.0 kB # Tx on Voice 1.0 kB
ENABLE_VOX := 1 ENABLE_VOX := 0
ENABLE_VOX_MORE_SENSITIVE := 1 ENABLE_VOX_MORE_SENSITIVE := 1
ENABLE_REDUCE_LOW_MID_TX_POWER := 1 ENABLE_REDUCE_LOW_MID_TX_POWER := 1
# Tx Alarm 600 B # Tx Alarm 600 B
@ -63,7 +63,7 @@ ENABLE_FREQ_SEARCH_LNA := 1
ENABLE_FREQ_SEARCH_TIMEOUT := 0 ENABLE_FREQ_SEARCH_TIMEOUT := 0
ENABLE_CODE_SEARCH_TIMEOUT := 0 ENABLE_CODE_SEARCH_TIMEOUT := 0
ENABLE_SCAN_IGNORE_LIST := 1 ENABLE_SCAN_IGNORE_LIST := 1
ENABLE_SCAN_RANGES := 1 ENABLE_SCAN_RANGES := 0
# Kill and Revive 400 B # Kill and Revive 400 B
ENABLE_KILL_REVIVE := 0 ENABLE_KILL_REVIVE := 0
# AM Fix 800 B # AM Fix 800 B

View File

@ -474,10 +474,10 @@ bool APP_start_listening(void)
if (g_scan_state_dir != SCAN_STATE_DIR_OFF) if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
{ // we're RF scanning { // we're RF scanning
g_rx_vfo->freq_in_channel = 0xff; g_current_vfo->freq_in_channel = 0xff;
if (IS_FREQ_CHANNEL(g_scan_next_channel)) if (IS_FREQ_CHANNEL(g_scan_next_channel))
g_rx_vfo->freq_in_channel = SETTINGS_find_channel(g_rx_vfo->freq_config_rx.frequency); g_current_vfo->freq_in_channel = SETTINGS_find_channel(g_current_vfo->freq_config_rx.frequency);
switch (g_eeprom.config.setting.carrier_search_mode) switch (g_eeprom.config.setting.carrier_search_mode)
{ {
@ -502,12 +502,12 @@ bool APP_start_listening(void)
} }
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_noaa_mode) if (IS_NOAA_CHANNEL(g_current_vfo->channel_save) && g_noaa_mode)
{ {
g_rx_vfo->channel_save = g_noaa_channel + NOAA_CHANNEL_FIRST; g_current_vfo->channel_save = g_noaa_channel + NOAA_CHANNEL_FIRST;
g_rx_vfo->p_rx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel]; g_current_vfo->p_rx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
g_rx_vfo->p_tx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel]; g_current_vfo->p_tx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
g_eeprom.config.setting.indices.vfo[chan].screen = g_rx_vfo->channel_save; g_eeprom.config.setting.indices.vfo[chan].screen = g_current_vfo->channel_save;
g_noaa_tick_10ms = 5000 / 10; // 5 sec g_noaa_tick_10ms = 5000 / 10; // 5 sec
g_schedule_noaa = false; g_schedule_noaa = false;
} }
@ -527,7 +527,7 @@ bool APP_start_listening(void)
} }
// AF gain - original QS values // AF gain - original QS values
// if (g_rx_vfo->channel.mod_mode != MOD_MODE_FM) // if (g_current_vfo->channel.mod_mode != MOD_MODE_FM)
// { // {
// BK4819_write_reg(0x48, 0xB3A8); // 1011 0011 1010 1000 // BK4819_write_reg(0x48, 0xB3A8); // 1011 0011 1010 1000
// } // }
@ -550,12 +550,16 @@ bool APP_start_listening(void)
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
#ifdef MUTE_AUDIO_FOR_VOICE #ifdef MUTE_AUDIO_FOR_VOICE
if (g_voice_write_index == 0) if (g_voice_write_index == 0)
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode); AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
#else #else
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode); AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
#endif #endif
#else #else
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode); AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
#endif
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf("mode %u\r\n", g_current_vfo->channel.mod_mode);
#endif #endif
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
@ -1391,8 +1395,8 @@ void APP_check_keys(void)
{ // only the up and down keys are made repeatable { // only the up and down keys are made repeatable
// key repeat max 10ms speed if user is moving up/down in freq/channel // key repeat max 10ms speed if user is moving up/down in freq/channel
const bool freq_chan = IS_FREQ_CHANNEL(g_eeprom.config.setting.indices.vfo[g_eeprom.config.setting.tx_vfo_num].screen); const bool freq_chan = IS_FREQ_CHANNEL(g_eeprom.config.setting.indices.vfo[g_eeprom.config.setting.tx_vfo_num].screen);
const uint8_t repeat_10ms = (g_manual_scanning && g_monitor_enabled && freq_chan && g_current_display_screen == DISPLAY_MAIN) ? 1 : key_repeat_10ms; const uint8_t repeat_10ms = (g_manual_scanning && g_monitor_enabled && freq_chan && g_current_display_screen == DISPLAY_MAIN) ? 2 : key_repeat_10ms;
if (++g_key_debounce_repeat >= (key_long_press_10ms + repeat_10ms)) if (++g_key_debounce_repeat >= (key_long_press_10ms + repeat_10ms))
{ // key repeat { // key repeat

View File

@ -218,18 +218,26 @@ void processFKeyFunction(const key_code_t Key)
{ {
case KEY_0: // FM case KEY_0: // FM
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
APP_stop_scan();
if (g_fkey_pressed) if (g_fkey_pressed)
{ {
if (++g_tx_vfo->channel.mod_mode >= MOD_MODE_LEN) if (++g_tx_vfo->channel.mod_mode >= MOD_MODE_LEN)
g_tx_vfo->channel.mod_mode = 0; g_tx_vfo->channel.mod_mode = 0;
g_request_save_channel = 1;
AUDIO_set_mod_mode(g_tx_vfo->channel.mod_mode);
if (IS_FREQ_CHANNEL(g_tx_vfo->channel_save))
if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
g_request_save_vfo = true;
g_request_display_screen = DISPLAY_MAIN;
} }
else else
{ {
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
APP_stop_scan();
ACTION_FM(); ACTION_FM();
#else #else

View File

@ -83,8 +83,8 @@ void AUDIO_set_mod_mode(const mod_mode_t mode)
switch (mode) switch (mode)
{ {
default: default:
case MOD_MODE_FM: af_mode = BK4819_AF_FM; break; case MOD_MODE_FM: af_mode = BK4819_AF_FM; break;
case MOD_MODE_AM: af_mode = BK4819_AF_AM; break; case MOD_MODE_AM: af_mode = BK4819_AF_AM; break;
case MOD_MODE_DSB: af_mode = BK4819_AF_BASEBAND1; break; case MOD_MODE_DSB: af_mode = BK4819_AF_BASEBAND1; break;
} }
BK4819_SetAF(af_mode); BK4819_SetAF(af_mode);

Binary file not shown.

Binary file not shown.

34
radio.c
View File

@ -632,7 +632,7 @@ void RADIO_select_vfos(void)
void RADIO_setup_registers(bool switch_to_function_foreground) void RADIO_setup_registers(bool switch_to_function_foreground)
{ {
BK4819_filter_bandwidth_t Bandwidth = g_rx_vfo->channel.channel_bandwidth; BK4819_filter_bandwidth_t Bandwidth = g_current_vfo->channel.channel_bandwidth;
uint16_t interrupt_mask; uint16_t interrupt_mask;
uint32_t Frequency; uint32_t Frequency;
@ -661,7 +661,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
BK4819_SetFilterBandwidth(Bandwidth); BK4819_SetFilterBandwidth(Bandwidth);
BK4819_EnableAFC(); BK4819_EnableAFC();
#else #else
if (g_rx_vfo->channel.mod_mode != MOD_MODE_FM) if (g_current_vfo->channel.mod_mode != MOD_MODE_FM)
{ {
BK4819_SetFilterBandwidth(BK4819_FILTER_BW_NARROWER); // sideband BK4819_SetFilterBandwidth(BK4819_FILTER_BW_NARROWER); // sideband
BK4819_DisableAFC(); BK4819_DisableAFC();
@ -708,25 +708,25 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
BK4819_write_reg(0x3F, 0); // disable interrupts BK4819_write_reg(0x3F, 0); // disable interrupts
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_noaa_mode) if (IS_NOAA_CHANNEL(g_current_vfo->channel_save) && g_noaa_mode)
Frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel]; Frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
else else
#endif #endif
Frequency = g_rx_vfo->p_rx->frequency; Frequency = g_current_vfo->p_rx->frequency;
BK4819_set_rf_frequency(Frequency, false); BK4819_set_rf_frequency(Frequency, false);
BK4819_set_rf_filter_path(Frequency); BK4819_set_rf_filter_path(Frequency);
BK4819_SetupSquelch( BK4819_SetupSquelch(
g_rx_vfo->squelch_open_rssi_thresh, g_rx_vfo->squelch_close_rssi_thresh, g_current_vfo->squelch_open_rssi_thresh, g_current_vfo->squelch_close_rssi_thresh,
g_rx_vfo->squelch_open_noise_thresh, g_rx_vfo->squelch_close_noise_thresh, g_current_vfo->squelch_open_noise_thresh, g_current_vfo->squelch_close_noise_thresh,
g_rx_vfo->squelch_close_glitch_thresh, g_rx_vfo->squelch_open_glitch_thresh); g_current_vfo->squelch_close_glitch_thresh, g_current_vfo->squelch_open_glitch_thresh);
// enable the RX front end // enable the RX front end
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, true); BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, true);
// AF RX Gain and DAC // AF RX Gain and DAC
// if (g_rx_vfo->channel.mod_mode != MOD_MODE_FM) // if (g_current_vfo->channel.mod_mode != MOD_MODE_FM)
// { // {
// BK4819_write_reg(0x48, 0xB3A8); // 1011 0011 1010 1000 // BK4819_write_reg(0x48, 0xB3A8); // 1011 0011 1010 1000
// } // }
@ -748,29 +748,29 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
#ifdef MUTE_AUDIO_FOR_VOICE #ifdef MUTE_AUDIO_FOR_VOICE
if (g_voice_write_index == 0) if (g_voice_write_index == 0)
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode); AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
#else #else
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode); AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
#endif #endif
#else #else
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode); AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
#endif #endif
} }
} }
interrupt_mask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST; interrupt_mask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST;
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save)) if (IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save))
{ {
if (g_rx_vfo->channel.mod_mode == MOD_MODE_FM) if (g_current_vfo->channel.mod_mode == MOD_MODE_FM)
{ // FM { // FM
uint8_t code_type = g_selected_code_type; uint8_t code_type = g_selected_code_type;
uint8_t code = g_selected_code; uint8_t code = g_selected_code;
if (g_css_scan_mode == CSS_SCAN_MODE_OFF) if (g_css_scan_mode == CSS_SCAN_MODE_OFF)
{ {
code_type = g_rx_vfo->p_rx->code_type; code_type = g_current_vfo->p_rx->code_type;
code = g_rx_vfo->p_rx->code; code = g_current_vfo->p_rx->code;
} }
switch (code_type) switch (code_type)
@ -812,7 +812,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
} }
if (g_eeprom.config.setting.enable_scrambler) if (g_eeprom.config.setting.enable_scrambler)
BK4819_set_scrambler(g_rx_vfo->channel.scrambler); BK4819_set_scrambler(g_current_vfo->channel.scrambler);
else else
BK4819_set_scrambler(0); BK4819_set_scrambler(0);
} }
@ -843,7 +843,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
BK4819_DisableVox(); BK4819_DisableVox();
// RX expander // RX expander
BK4819_SetCompander((g_rx_vfo->channel.mod_mode == MOD_MODE_FM && g_rx_vfo->channel.compand >= 2) ? g_rx_vfo->channel.compand : 0); BK4819_SetCompander((g_current_vfo->channel.mod_mode == MOD_MODE_FM && g_current_vfo->channel.compand >= 2) ? g_current_vfo->channel.compand : 0);
BK4819_EnableDTMF(); BK4819_EnableDTMF();
interrupt_mask |= BK4819_REG_3F_DTMF_5TONE_FOUND; interrupt_mask |= BK4819_REG_3F_DTMF_5TONE_FOUND;