mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
.
This commit is contained in:
parent
2757c22bab
commit
8a22f144d3
24
app/app.c
24
app/app.c
@ -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_current_vfo->freq_in_channel = 0xff;
|
g_rx_vfo->freq_in_channel = 0xff;
|
||||||
|
|
||||||
if (IS_FREQ_CHANNEL(g_scan_next_channel))
|
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)
|
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_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_rx_vfo->channel_save = g_noaa_channel + NOAA_CHANNEL_FIRST;
|
||||||
g_current_vfo->p_rx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
|
g_rx_vfo->p_rx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
|
||||||
g_current_vfo->p_tx->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_current_vfo->channel_save;
|
g_eeprom.config.setting.indices.vfo[chan].screen = g_rx_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_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
|
// BK4819_write_reg(0x48, 0xB3A8); // 1011 0011 1010 1000
|
||||||
// }
|
// }
|
||||||
@ -550,16 +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_current_vfo->channel.mod_mode);
|
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode);
|
||||||
#else
|
#else
|
||||||
AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
|
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
|
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#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
|
#endif
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||||
|
@ -354,9 +354,9 @@ const uint8_t BITMAP_VFO_DEFAULT[7] =
|
|||||||
|
|
||||||
const uint8_t BITMAP_VFO_NOT_DEFAULT[7] =
|
const uint8_t BITMAP_VFO_NOT_DEFAULT[7] =
|
||||||
{
|
{
|
||||||
__extension__ 0b00000000,
|
__extension__ 0b01111111,
|
||||||
__extension__ 0b00000000,
|
__extension__ 0b01000001,
|
||||||
__extension__ 0b00111110,
|
__extension__ 0b00100010,
|
||||||
__extension__ 0b00100010,
|
__extension__ 0b00100010,
|
||||||
__extension__ 0b00010100,
|
__extension__ 0b00010100,
|
||||||
__extension__ 0b00010100,
|
__extension__ 0b00010100,
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
38
radio.c
38
radio.c
@ -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_current_vfo->channel.channel_bandwidth;
|
BK4819_filter_bandwidth_t Bandwidth = g_rx_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_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_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_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];
|
Frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
Frequency = g_current_vfo->p_rx->frequency;
|
Frequency = g_rx_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_current_vfo->squelch_open_rssi_thresh, g_current_vfo->squelch_close_rssi_thresh,
|
g_rx_vfo->squelch_open_rssi_thresh, g_rx_vfo->squelch_close_rssi_thresh,
|
||||||
g_current_vfo->squelch_open_noise_thresh, g_current_vfo->squelch_close_noise_thresh,
|
g_rx_vfo->squelch_open_noise_thresh, g_rx_vfo->squelch_close_noise_thresh,
|
||||||
g_current_vfo->squelch_close_glitch_thresh, g_current_vfo->squelch_open_glitch_thresh);
|
g_rx_vfo->squelch_close_glitch_thresh, g_rx_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_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
|
// 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_current_vfo->channel.mod_mode);
|
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode);
|
||||||
#else
|
#else
|
||||||
AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
|
AUDIO_set_mod_mode(g_rx_vfo->channel.mod_mode);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
AUDIO_set_mod_mode(g_current_vfo->channel.mod_mode);
|
AUDIO_set_mod_mode(g_rx_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_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
|
{ // 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_current_vfo->p_rx->code_type;
|
code_type = g_rx_vfo->p_rx->code_type;
|
||||||
code = g_current_vfo->p_rx->code;
|
code = g_rx_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_current_vfo->channel.scrambler);
|
BK4819_set_scrambler(g_rx_vfo->channel.scrambler);
|
||||||
else
|
else
|
||||||
BK4819_set_scrambler(0);
|
BK4819_set_scrambler(0);
|
||||||
}
|
}
|
||||||
@ -832,8 +832,8 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
|
|||||||
!g_fm_radio_mode &&
|
!g_fm_radio_mode &&
|
||||||
#endif
|
#endif
|
||||||
g_eeprom.config.setting.vox_enabled &&
|
g_eeprom.config.setting.vox_enabled &&
|
||||||
IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save) &&
|
IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save) &&
|
||||||
g_current_vfo->channel.mod_mode == MOD_MODE_FM)
|
g_rx_vfo->channel.mod_mode == MOD_MODE_FM)
|
||||||
{
|
{
|
||||||
RADIO_enable_vox(g_eeprom.config.setting.vox_level);
|
RADIO_enable_vox(g_eeprom.config.setting.vox_level);
|
||||||
interrupt_mask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
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();
|
BK4819_DisableVox();
|
||||||
|
|
||||||
// RX expander
|
// 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();
|
BK4819_EnableDTMF();
|
||||||
interrupt_mask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
interrupt_mask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user