0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 14:48:03 +03:00

Fix "TX BAR" and compander - hopefully

This commit is contained in:
OneOfEleven
2023-10-17 21:22:40 +01:00
parent 0974b2e0a6
commit a89998c6ca
21 changed files with 134 additions and 143 deletions

View File

@ -212,10 +212,7 @@ void ACTION_Scan(bool bRestart)
APP_stop_scan();
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_SCANNING_STOP;
#endif
g_request_display_screen = DISPLAY_MAIN;
return;
}
@ -259,13 +256,7 @@ void ACTION_Scan(bool bRestart)
else
{ // stop scanning
g_monitor_enabled = false;
APP_stop_scan();
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_SCANNING_STOP;
#endif
g_request_display_screen = DISPLAY_MAIN;
}
}

View File

@ -79,7 +79,7 @@ void AIRCOPY_init(void)
g_aircopy_state = AIRCOPY_READY;
g_fsk_write_index = 0;
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false); // LED off
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
BK4819_start_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
@ -203,9 +203,9 @@ void AIRCOPY_stop_fsk_tx(void)
g_fsk_tx_timeout_10ms = 0;
// disable the TX
BK4819_SetupPowerAmplifier(0, 0); //
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1_UNKNOWN, false); // ???
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, false); // LED off
BK4819_SetupPowerAmplifier(0, 0); //
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, false); // PA off
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1_RED, false); // LED off
BK4819_reset_fsk();
@ -343,7 +343,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
if ((status & (1u << 12)) == 0)
{ // FSK RX is disabled, enable it
g_fsk_write_index = 0;
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false); // LED off
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
BK4819_start_fsk_rx((g_aircopy_state == AIRCOPY_TX) ? AIRCOPY_REQ_PACKET_SIZE : AIRCOPY_DATA_PACKET_SIZE);
}
@ -356,15 +356,15 @@ void AIRCOPY_process_fsk_rx_10ms(void)
interrupt_bits = BK4819_ReadRegister(BK4819_REG_02);
if (interrupt_bits & BK4819_REG_02_FSK_RX_SYNC)
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, true); // LED on
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
if (interrupt_bits & BK4819_REG_02_FSK_RX_FINISHED)
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false); // LED off
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
if ((interrupt_bits & BK4819_REG_02_FSK_FIFO_ALMOST_FULL) == 0)
return;
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, true); // LED on
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
// fetch RX'ed data
for (i = 0; i < 4; i++)
@ -406,7 +406,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
return; // not yet a complete packet
// restart the RX
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false); // LED off
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
BK4819_start_fsk_rx((g_aircopy_state == AIRCOPY_TX) ? AIRCOPY_REQ_PACKET_SIZE : AIRCOPY_DATA_PACKET_SIZE);
g_update_display = true;
@ -678,7 +678,7 @@ static void AIRCOPY_Key_EXIT(bool key_pressed, bool key_held)
if (!key_held)
{
// turn the green LED off
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false);
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false);
g_input_box_index = 0;
g_aircopy_state = AIRCOPY_READY;
@ -713,7 +713,7 @@ static void AIRCOPY_Key_EXIT(bool key_pressed, bool key_held)
{ // enter RX mode
// turn the green LED off
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false);
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false);
g_input_box_index = 0;

View File

@ -660,6 +660,10 @@ void APP_stop_scan(void)
SETTINGS_SaveVfoIndices();
}
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_SCANNING_STOP;
#endif
g_update_status = true;
}
@ -690,6 +694,7 @@ static void APP_next_freq(void)
{ // don't need to go through all the other stuff .. lets speed things up !!
BK4819_set_rf_frequency(frequency, true);
BK4819_set_rf_filter_path(frequency);
#ifdef ENABLE_FASTER_CHANNEL_SCAN
g_scan_pause_10ms = 10; // 100ms
@ -951,13 +956,13 @@ void APP_process_radio_interrupts(void)
if (interrupt_bits & BK4819_REG_02_SQUELCH_LOST)
{
g_squelch_lost = true;
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, true); // LED on
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
}
if (interrupt_bits & BK4819_REG_02_SQUELCH_FOUND)
{
g_squelch_lost = false;
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false); // LED off
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
}
}
}
@ -1305,7 +1310,7 @@ void APP_process(void)
BK4819_DisableVox();
BK4819_Sleep();
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_UNKNOWN, false);
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, false);
// Authentic device checked removed
@ -1686,9 +1691,9 @@ void APP_time_slice_10ms(void)
RADIO_EnableCxCSS();
BK4819_SetupPowerAmplifier(0, 0);
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1_UNKNOWN, false); // ???
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, false); // PA off
BK4819_Enable_AfDac_DiscMode_TxDsp();
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, false); // LED off
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1_RED, false); // LED off
GUI_DisplayScreen();
}

View File

@ -138,22 +138,23 @@ void GENERIC_Key_PTT(bool key_pressed)
// UART_printf("gene key 1 %u\r\n", key_pressed);
#endif
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || // frequency/channel scanning
g_screen_to_display == DISPLAY_SEARCH || // CTCSS/CDCSS scanning
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || // freq/chan scanning
g_screen_to_display == DISPLAY_SEARCH || // CTCSS/CDCSS scanning
g_css_scan_mode != CSS_SCAN_MODE_OFF) // " "
{ // we're scanning .. stop
if (g_screen_to_display == DISPLAY_SEARCH)
{ // CTCSS/CDCSS scanning .. stop
g_eeprom.cross_vfo_rx_tx = g_backup_cross_vfo_rx_tx;
g_search_flag_stop_scan = true;
g_search_flag_stop_scan = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
g_flag_reset_vfos = true;
g_flag_reset_vfos = true;
}
else
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
{ // frequency/channel scanning . .stop
{ // freq/chan scanning . .stop
APP_stop_scan();
g_request_display_screen = DISPLAY_MAIN;
}
else
if (g_css_scan_mode != CSS_SCAN_MODE_OFF)

View File

@ -39,21 +39,6 @@
// #include "app/spectrum.h"
#endif
static void MAIN_stop_scan(void)
{
if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
return;
APP_stop_scan();
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_SCANNING_STOP;
#endif
g_request_display_screen = DISPLAY_MAIN;
g_update_status = true;
}
void toggle_chan_scanlist(void)
{ // toggle the selected channels scanlist setting
@ -70,7 +55,7 @@ void toggle_chan_scanlist(void)
g_scan_pause_10ms > 0 &&
g_scan_pause_10ms <= (200 / 10) &&
!g_scan_pause_mode)
{
{ // scanning isn't paused
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
}
@ -96,7 +81,7 @@ void toggle_chan_scanlist(void)
g_flag_reset_vfos = true;
}
static void processFKeyFunction(const key_code_t Key)
void processFKeyFunction(const key_code_t Key)
{
uint8_t Band;
uint8_t Vfo = g_eeprom.tx_vfo;
@ -112,7 +97,7 @@ static void processFKeyFunction(const key_code_t Key)
case KEY_0: // FM
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
MAIN_stop_scan();
APP_stop_scan();
#ifdef ENABLE_FMRADIO
ACTION_FM();
@ -134,7 +119,7 @@ static void processFKeyFunction(const key_code_t Key)
return;
}
MAIN_stop_scan();
APP_stop_scan();
Band = g_tx_vfo->band + 1;
if (g_setting_350_enable || Band != BAND5_350MHz)
@ -157,7 +142,7 @@ static void processFKeyFunction(const key_code_t Key)
case KEY_2: // A/B
MAIN_stop_scan();
APP_stop_scan();
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_CHAN_A)
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_CHAN_B;
@ -181,7 +166,7 @@ static void processFKeyFunction(const key_code_t Key)
case KEY_3: // VFO/MR
MAIN_stop_scan();
APP_stop_scan();
if (g_eeprom.vfo_open && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
{
@ -223,7 +208,7 @@ static void processFKeyFunction(const key_code_t Key)
case KEY_4: // FC
MAIN_stop_scan();
APP_stop_scan();
g_search_flag_start_scan = true;
g_search_single_frequency = false;
@ -235,7 +220,7 @@ static void processFKeyFunction(const key_code_t Key)
#ifdef ENABLE_NOAA
MAIN_stop_scan();
APP_stop_scan();
if (IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
{
@ -274,7 +259,7 @@ static void processFKeyFunction(const key_code_t Key)
case KEY_7: // VOX
#ifdef ENABLE_VOX
MAIN_stop_scan();
APP_stop_scan();
ACTION_Vox();
#else
@ -306,7 +291,7 @@ static void processFKeyFunction(const key_code_t Key)
// swap to the CALL channel
MAIN_stop_scan();
APP_stop_scan();
g_eeprom.user_channel[Vfo] = g_eeprom.chan_1_call;
g_eeprom.screen_channel[Vfo] = g_eeprom.chan_1_call;
@ -328,7 +313,7 @@ static void processFKeyFunction(const key_code_t Key)
}
}
static void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
{
g_key_input_count_down = key_input_timeout_500ms;
@ -532,7 +517,7 @@ static void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
}
static void MAIN_Key_EXIT(bool key_pressed, bool key_held)
void MAIN_Key_EXIT(bool key_pressed, bool key_held)
{
if (!key_held && key_pressed)
{ // exit key pressed
@ -598,7 +583,7 @@ static void MAIN_Key_EXIT(bool key_pressed, bool key_held)
}
}
static void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
{
if (key_pressed && !key_held)
// menu key pressed
@ -696,7 +681,7 @@ static void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
}
}
static void MAIN_Key_STAR(bool key_pressed, bool key_held)
void MAIN_Key_STAR(bool key_pressed, bool key_held)
{
if (g_input_box_index > 0)
{ // entering a channel, frequency or DTMF string
@ -770,7 +755,7 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
g_update_status = true;
}
static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Direction)
void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Direction)
{
#ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS
static bool monitor_was_enabled = false;
@ -875,7 +860,7 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
#endif
BK4819_set_rf_frequency(frequency, true);
//BK4819_PickRXFilterPathBasedOnFrequency(frequency);
BK4819_set_rf_filter_path(frequency);
}
return;

View File

@ -237,10 +237,10 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
case MENU_AM_FIX:
#endif
#ifdef ENABLE_AUDIO_BAR
case MENU_MIC_BAR:
case MENU_TX_BAR:
#endif
#ifdef ENABLE_RSSI_BAR
case MENU_RSSI_BAR:
case MENU_RX_BAR:
#endif
case MENU_BCL:
case MENU_BEEP:
@ -637,23 +637,25 @@ void MENU_AcceptSetting(void)
break;
#ifdef ENABLE_AUDIO_BAR
case MENU_MIC_BAR:
case MENU_TX_BAR:
g_setting_mic_bar = g_sub_menu_selection;
break;
#endif
#ifdef ENABLE_RSSI_BAR
case MENU_RSSI_BAR:
case MENU_RX_BAR:
g_setting_rssi_bar = g_sub_menu_selection;
break;
#endif
case MENU_COMPAND:
g_tx_vfo->compander = g_sub_menu_selection;
SETTINGS_UpdateChannel(g_tx_vfo->channel_save, g_tx_vfo, true);
g_vfo_configure_mode = VFO_CONFIGURE;
g_flag_reset_vfos = true;
// g_request_save_channel = 1;
g_tx_vfo->compand = g_sub_menu_selection;
#if 1
g_request_save_channel = 1;
#else
SETTINGS_SaveChannel(g_sub_menu_selection, g_eeprom.tx_vfo, g_tx_vfo, 3);
g_flag_reconfigure_vfos = true;
#endif
return;
case MENU_1_CALL:
@ -1095,19 +1097,19 @@ void MENU_ShowCurrentSetting(void)
break;
#ifdef ENABLE_AUDIO_BAR
case MENU_MIC_BAR:
case MENU_TX_BAR:
g_sub_menu_selection = g_setting_mic_bar;
break;
#endif
#ifdef ENABLE_RSSI_BAR
case MENU_RSSI_BAR:
case MENU_RX_BAR:
g_sub_menu_selection = g_setting_rssi_bar;
break;
#endif
case MENU_COMPAND:
g_sub_menu_selection = g_tx_vfo->compander;
g_sub_menu_selection = g_tx_vfo->compand;
return;
case MENU_1_CALL:

View File

@ -498,7 +498,8 @@ void SEARCH_Start(void)
g_search_frequency = g_rx_vfo->p_rx->frequency;
g_search_step_setting = g_rx_vfo->step_setting;
BK4819_PickRXFilterPathBasedOnFrequency(g_search_frequency);
BK4819_set_rf_filter_path(g_search_frequency);
BK4819_SetScanFrequency(g_search_frequency);
}
else
@ -506,7 +507,13 @@ void SEARCH_Start(void)
g_search_css_state = SEARCH_CSS_STATE_OFF;
g_search_frequency = 0xFFFFFFFF;
BK4819_PickRXFilterPathBasedOnFrequency(0xFFFFFFFF);
#if 1
// this is why it needs such a strong signal
BK4819_set_rf_filter_path(0xFFFFFFFF); // disable the LNA filter paths
#else
BK4819_set_rf_filter_path(g_rx_vfo->p_rx->frequency); // lets have a play ;)
#endif
BK4819_EnableFrequencyScan();
}

View File

@ -203,7 +203,7 @@ static void SetF(uint32_t f) {
fMeasure = f;
BK4819_set_rf_frequency(fMeasure);
BK4819_PickRXFilterPathBasedOnFrequency(fMeasure);
BK4819_set_rf_filter_path(fMeasure);
uint16_t reg = BK4819_ReadRegister(BK4819_REG_30);
BK4819_WriteRegister(BK4819_REG_30, 0);
BK4819_WriteRegister(BK4819_REG_30, reg);
@ -212,7 +212,7 @@ static void SetF(uint32_t f) {
static void SetTxF(uint32_t f) {
fTx = f;
BK4819_set_rf_frequency(f);
BK4819_PickRXFilterPathBasedOnFrequency(f);
BK4819_set_rf_filter_path(f);
uint16_t reg = BK4819_ReadRegister(BK4819_REG_30);
BK4819_WriteRegister(BK4819_REG_30, 0);
BK4819_WriteRegister(BK4819_REG_30, reg);
@ -364,7 +364,7 @@ static void ToggleRX(bool on) {
ToggleTX(false);
}
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, on);
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, on);
BK4819_RX_TurnOn();
ToggleAudio(on);
@ -399,7 +399,7 @@ static void ToggleTX(bool on) {
ToggleRX(false);
}
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, on);
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1_RED, on);
if (on) {
ToggleAudio(false);
@ -417,7 +417,9 @@ static void ToggleTX(bool on) {
BK4819_SetupPowerAmplifier(gCurrentVfo->TXP_CalculatedSetting,
gCurrentVfo->p_tx->Frequency);
} else {
}
else
{
RADIO_SendEndOfTransmission();
RADIO_EnableCxCSS();
@ -434,8 +436,9 @@ static void ToggleTX(bool on) {
SetF(fMeasure);
}
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_UNKNOWN, !on);
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1_UNKNOWN, on);
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, !on);
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, on);
}
// Scan info