0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 06:11:24 +03:00
This commit is contained in:
OneOfEleven 2023-11-08 14:26:27 +00:00
parent 2757c22bab
commit 8a22f144d3
5 changed files with 34 additions and 34 deletions

View File

@ -474,10 +474,10 @@ bool APP_start_listening(void)
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
{ // we're RF scanning
g_current_vfo->freq_in_channel = 0xff;
g_rx_vfo->freq_in_channel = 0xff;
if (IS_FREQ_CHANNEL(g_scan_next_channel))
g_current_vfo->freq_in_channel = SETTINGS_find_channel(g_current_vfo->freq_config_rx.frequency);
g_rx_vfo->freq_in_channel = SETTINGS_find_channel(g_rx_vfo->freq_config_rx.frequency);
switch (g_eeprom.config.setting.carrier_search_mode)
{
@ -502,12 +502,12 @@ bool APP_start_listening(void)
}
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(g_current_vfo->channel_save) && g_noaa_mode)
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_noaa_mode)
{
g_current_vfo->channel_save = g_noaa_channel + NOAA_CHANNEL_FIRST;
g_current_vfo->p_rx->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_current_vfo->channel_save;
g_rx_vfo->channel_save = g_noaa_channel + NOAA_CHANNEL_FIRST;
g_rx_vfo->p_rx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
g_rx_vfo->p_tx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
g_eeprom.config.setting.indices.vfo[chan].screen = g_rx_vfo->channel_save;
g_noaa_tick_10ms = 5000 / 10; // 5 sec
g_schedule_noaa = false;
}
@ -527,7 +527,7 @@ bool APP_start_listening(void)
}
// AF gain - original QS values
// if (g_current_vfo->channel.mod_mode != MOD_MODE_FM)
// if (g_rx_vfo->channel.mod_mode != MOD_MODE_FM)
// {
// BK4819_write_reg(0x48, 0xB3A8); // 1011 0011 1010 1000
// }
@ -550,16 +550,16 @@ bool APP_start_listening(void)
#ifdef ENABLE_VOICE
#ifdef MUTE_AUDIO_FOR_VOICE
if (g_voice_write_index == 0)
AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode);
#else
AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode);
#endif
#else
AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
AUDIO_set_mod_mode(g_rx_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);
UART_printf("mode %u\r\n", g_rx_vfo->channel.mod_mode);
#endif
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);

View File

@ -354,9 +354,9 @@ const uint8_t BITMAP_VFO_DEFAULT[7] =
const uint8_t BITMAP_VFO_NOT_DEFAULT[7] =
{
__extension__ 0b00000000,
__extension__ 0b00000000,
__extension__ 0b00111110,
__extension__ 0b01111111,
__extension__ 0b01000001,
__extension__ 0b00100010,
__extension__ 0b00100010,
__extension__ 0b00010100,
__extension__ 0b00010100,

Binary file not shown.

Binary file not shown.

38
radio.c
View File

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