0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 14:21:25 +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

View File

@ -94,13 +94,12 @@ enum bk4819_register_e {
typedef enum bk4819_register_e bk4819_register_t;
enum bk4819_gpio_pin_e {
BK4819_GPIO6_PIN2_UNKNOWN = 0, // please let us know if you know what this pin does
BK4819_GPIO5_PIN1_UNKNOWN = 1, // " "
BK4819_GPIO4_PIN32_UNUSED = 2,
BK4819_GPIO3_PIN31_UHF = 3,
BK4819_GPIO2_PIN30_VHF = 4,
BK4819_GPIO1_PIN29_RED = 5,
BK4819_GPIO0_PIN28_GREEN = 6
BK4819_GPIO0_PIN28_RX_ENABLE = 0,
BK4819_GPIO1_PIN29_PA_ENABLE = 1,
BK4819_GPIO3_PIN31_UHF_LNA = 3,
BK4819_GPIO4_PIN32_VHF_LNA = 4,
BK4819_GPIO5_PIN1_RED = 5,
BK4819_GPIO6_PIN2_GREEN = 6
};
typedef enum bk4819_gpio_pin_e bk4819_gpio_pin_t;

View File

@ -886,23 +886,23 @@ void BK4819_RX_TurnOn(void)
BK4819_WriteRegister(BK4819_REG_30, 0xbff1); // 1 0 1111 1 1 1111 0 0 0 1
}
void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency)
void BK4819_set_rf_filter_path(uint32_t Frequency)
{
if (Frequency < 28000000)
{ // VHF
BK4819_set_GPIO_pin(BK4819_GPIO2_PIN30_VHF, true);
BK4819_set_GPIO_pin(BK4819_GPIO3_PIN31_UHF, false);
BK4819_set_GPIO_pin(BK4819_GPIO4_PIN32_VHF_LNA, true);
BK4819_set_GPIO_pin(BK4819_GPIO3_PIN31_UHF_LNA, false);
}
else
if (Frequency == 0xFFFFFFFF)
{ // OFF
BK4819_set_GPIO_pin(BK4819_GPIO2_PIN30_VHF, false);
BK4819_set_GPIO_pin(BK4819_GPIO3_PIN31_UHF, false);
BK4819_set_GPIO_pin(BK4819_GPIO4_PIN32_VHF_LNA, false);
BK4819_set_GPIO_pin(BK4819_GPIO3_PIN31_UHF_LNA, false);
}
else
{ // UHF
BK4819_set_GPIO_pin(BK4819_GPIO2_PIN30_VHF, false);
BK4819_set_GPIO_pin(BK4819_GPIO3_PIN31_UHF, true);
BK4819_set_GPIO_pin(BK4819_GPIO4_PIN32_VHF_LNA, false);
BK4819_set_GPIO_pin(BK4819_GPIO3_PIN31_UHF_LNA, true);
}
}
@ -1226,7 +1226,7 @@ void BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable(void)
{
if (g_rx_idle_mode)
{
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_UNKNOWN, true);
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, true);
BK4819_RX_TurnOn();
}
}

View File

@ -88,7 +88,7 @@ void BK4819_SetupSquelch(
void BK4819_SetAF(BK4819_af_type_t AF);
void BK4819_RX_TurnOn(void);
void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency);
void BK4819_set_rf_filter_path(uint32_t Frequency);
void BK4819_DisableScramble(void);
void BK4819_EnableScramble(uint8_t Type);

Binary file not shown.

Binary file not shown.

View File

@ -165,7 +165,7 @@ void FUNCTION_Select(function_type_t Function)
BK4819_DisableVox();
BK4819_Sleep();
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_UNKNOWN, false);
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, false);
if (g_screen_to_display != DISPLAY_MENU) // 1of11 .. don't close the menu
GUI_SelectNextDisplay(DISPLAY_MAIN);

38
radio.c
View File

@ -129,9 +129,9 @@ void RADIO_InitInfo(vfo_info_t *pInfo, const uint8_t ChannelSave, const uint32_t
pInfo->output_power = OUTPUT_POWER_LOW;
pInfo->freq_config_rx.frequency = Frequency;
pInfo->freq_config_tx.frequency = Frequency;
pInfo->p_rx = &pInfo->freq_config_rx;
pInfo->p_tx = &pInfo->freq_config_tx;
pInfo->compander = 0; // off
pInfo->p_rx = &pInfo->freq_config_rx;
pInfo->p_tx = &pInfo->freq_config_tx;
pInfo->compand = 0; // off
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
pInfo->am_mode = 1;
@ -320,6 +320,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
g_eeprom.vfo_info[VFO].channel_bandwidth = BK4819_FILTER_BW_WIDE;
g_eeprom.vfo_info[VFO].output_power = OUTPUT_POWER_LOW;
g_eeprom.vfo_info[VFO].busy_channel_lock = false;
g_eeprom.vfo_info[VFO].compand = 0;
}
else
{
@ -328,6 +329,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
g_eeprom.vfo_info[VFO].channel_bandwidth = ((d4 >> 1) & 1u) ? true : false;
g_eeprom.vfo_info[VFO].output_power = (d4 >> 2) & 3u;
g_eeprom.vfo_info[VFO].busy_channel_lock = ((d4 >> 4) & 1u) ? true : false;
g_eeprom.vfo_info[VFO].compand = (d4 >> 6) & 3u;
}
if (Data[5] == 0xFF)
@ -419,8 +421,6 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
g_eeprom.vfo_info[VFO].freq_config_tx.code_type = CODE_TYPE_NONE;
}
g_eeprom.vfo_info[VFO].compander = (Attributes & USER_CH_COMPAND) >> 4;
RADIO_ConfigureSquelchAndOutputPower(pRadio);
}
@ -632,7 +632,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
g_enable_speaker = false;
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false);
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
@ -654,9 +654,9 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
#pragma GCC diagnostic pop
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, false); // LED off
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1_RED, false); // LED off
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
while (1)
{ // wait for the interrupt to clear ?
@ -678,17 +678,16 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
else
#endif
Frequency = g_rx_vfo->p_rx->frequency;
BK4819_set_rf_frequency(Frequency, false);
BK4819_set_rf_filter_path(Frequency);
BK4819_SetupSquelch(
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);
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
// what does this in do ?
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_UNKNOWN, true);
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, true);
// AF RX Gain and DAC
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8); // 1011 00 111010 1000
@ -789,7 +788,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
BK4819_DisableVox();
// RX expander
BK4819_SetCompander((g_rx_vfo->am_mode == 0 && g_rx_vfo->compander >= 2) ? g_rx_vfo->compander : 0);
BK4819_SetCompander((g_rx_vfo->am_mode == 0 && g_rx_vfo->compand >= 2) ? g_rx_vfo->compand : 0);
#if 0
#ifdef ENABLE_KILL_REVIVE
@ -885,7 +884,7 @@ void RADIO_enableTX(const bool fsk_tx)
g_enable_speaker = false;
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_UNKNOWN, false); // ???
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, false); // ???
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
@ -911,18 +910,19 @@ void RADIO_enableTX(const bool fsk_tx)
// so MAKE SURE that DTMF is disabled - until needed
BK4819_DisableDTMF();
BK4819_SetCompander((!fsk_tx && g_rx_vfo->am_mode == 0 && (g_rx_vfo->compander == 1 || g_rx_vfo->compander >= 3)) ? g_rx_vfo->compander : 0);
BK4819_SetCompander((!fsk_tx && g_rx_vfo->am_mode == 0 && (g_rx_vfo->compand == 1 || g_rx_vfo->compand >= 3)) ? g_rx_vfo->compand : 0);
BK4819_set_rf_frequency(g_current_vfo->p_tx->frequency, false);
BK4819_set_rf_filter_path(g_current_vfo->p_tx->frequency);
BK4819_PrepareTransmit();
BK4819_PickRXFilterPathBasedOnFrequency(g_current_vfo->p_tx->frequency);
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1_UNKNOWN, true); // ???
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_PA_ENABLE, true); // PA on
if (g_screen_to_display != DISPLAY_AIRCOPY)
BK4819_SetupPowerAmplifier(g_current_vfo->txp_calculated_setting, g_current_vfo->p_tx->frequency);
else
BK4819_SetupPowerAmplifier(0, g_current_vfo->p_tx->frequency); // very low power when in AIRCOPY mode
BK4819_SetupPowerAmplifier(0, g_current_vfo->p_tx->frequency); // very low power when in AIRCOPY mode
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, true); // turn the RED LED on
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1_RED, true); // turn the RED LED on
if (fsk_tx)
{

View File

@ -26,7 +26,7 @@
enum {
USER_CH_BAND_MASK = 0x0F << 0,
USER_CH_COMPAND = 3u << 4, // new
USER_CH_SPARE = 3u << 4,
USER_CH_SCANLIST2 = 1u << 6,
USER_CH_SCANLIST1 = 1u << 7
};
@ -111,7 +111,7 @@ typedef struct vfo_info_t
uint8_t am_mode;
uint8_t compander;
uint8_t compand;
char name[16];
} vfo_info_t;

View File

@ -370,10 +370,11 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const vfo_info_t *pVFO,
State[2] = (pVFO->freq_config_tx.code_type << 4) | pVFO->freq_config_rx.code_type;
State[3] = ((pVFO->am_mode & 1u) << 4) | pVFO->tx_offset_freq_dir;
State[4] =
(pVFO->busy_channel_lock << 4)
| (pVFO->output_power << 2)
| (pVFO->channel_bandwidth << 1)
| (pVFO->frequency_reverse << 0);
(pVFO->compand << 6) |
(pVFO->busy_channel_lock << 4) |
(pVFO->output_power << 2) |
(pVFO->channel_bandwidth << 1) |
(pVFO->frequency_reverse << 0);
State[5] = ((pVFO->dtmf_ptt_id_tx_mode & 7u) << 1) | ((pVFO->dtmf_decoding_enable & 1u) << 0);
State[6] = pVFO->step_setting;
State[7] = pVFO->scrambling_type;
@ -410,13 +411,11 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const vfo_info_t *pVFO, bool keep)
if (IS_NOAA_CHANNEL(Channel))
return;
Attributes &= (uint8_t)(~USER_CH_COMPAND); // default to '0' = compander disabled
EEPROM_ReadBuffer(Offset, State, sizeof(State));
if (keep)
{
Attributes = (pVFO->scanlist_1_participation << 7) | (pVFO->scanlist_2_participation << 6) | (pVFO->compander << 4) | (pVFO->band << 0);
Attributes = (pVFO->scanlist_1_participation << 7) | (pVFO->scanlist_2_participation << 6) | (pVFO->band << 0);
if (State[Channel & 7u] == Attributes)
return; // no change in the attributes .. don't place wear on the eeprom
}

View File

@ -154,12 +154,12 @@ typedef struct {
uint8_t frequency_reverse:1; // reverse repeater
uint8_t channel_bandwidth:1; // wide/narrow
uint8_t tx_power:2; // 0, 1 or 2 .. L, M or H
uint8_t busy_channel_lockout:1; //
uint8_t busy_channel_lock:1; //
#if 0
uint8_t unused5:3; //
#else
uint8_t unused5:1; //
uint8_t compander:2; // 0 = off, 1 = TX, 2 = RX, 3 = TX/RX
uint8_t compand:2; // 0 = off, 1 = TX, 2 = RX, 3 = TX/RX
#endif
// [13]
uint8_t dtmf_decoding_enable:1; //
@ -267,8 +267,7 @@ typedef struct {
// 0x0D60
struct { // these channel attribute settings could have been in the t_channel structure !
uint8_t band:4; // why do QS have these 4 bits ? .. band can/is computed from the frequency
uint8_t unused:2; // 0's ?
// uint8_t compander:2; // smoved this to the t_channel structure
uint8_t unused:2; // 0's
uint8_t scanlist2:1; // set if is in scan list 2
uint8_t scanlist1:1; // set if is in scan list 1
} __attribute__((packed)) channel_attr[200]; //

View File

@ -649,7 +649,7 @@ void UI_DisplayMain(void)
if (attributes & USER_CH_SCANLIST2)
memmove(p_line0 + 120, BITMAP_SCANLIST2, sizeof(BITMAP_SCANLIST2));
#ifndef ENABLE_BIG_FREQ
if ((attributes & USER_CH_COMPAND) > 0)
if (g_eeprom.vfo_info[vfo_num].compand)
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_COMPAND, sizeof(BITMAP_COMPAND));
#else
@ -727,8 +727,8 @@ void UI_DisplayMain(void)
#endif
// show the channel symbols
const uint8_t attributes = g_user_channel_attributes[g_eeprom.screen_channel[vfo_num]];
if ((attributes & USER_CH_COMPAND) > 0)
//const uint8_t attributes = g_user_channel_attributes[g_eeprom.screen_channel[vfo_num]];
if (g_eeprom.vfo_info[vfo_num].compand)
#ifdef ENABLE_BIG_FREQ
memmove(p_line0 + 120, BITMAP_COMPAND, sizeof(BITMAP_COMPAND));
#else

View File

@ -86,10 +86,10 @@ const t_menu_item g_menu_list[] =
{"MIC GN", VOICE_ID_INVALID, MENU_MIC },
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
#ifdef ENABLE_AUDIO_BAR
{"Tx BAR", VOICE_ID_INVALID, MENU_MIC_BAR },
{"Tx BAR", VOICE_ID_INVALID, MENU_TX_BAR },
#endif
#ifdef ENABLE_RSSI_BAR
{"Rx BAR", VOICE_ID_INVALID, MENU_RSSI_BAR },
{"Rx BAR", VOICE_ID_INVALID, MENU_RX_BAR },
#endif
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
@ -709,10 +709,10 @@ void UI_DisplayMenu(void)
break;
#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
#ifdef ENABLE_AM_FIX
case MENU_AM_FIX:

View File

@ -78,12 +78,12 @@ enum
MENU_STE,
MENU_RP_STE,
MENU_MIC,
#ifdef ENABLE_AUDIO_BAR
MENU_MIC_BAR,
#endif
MENU_COMPAND,
#ifdef ENABLE_AUDIO_BAR
MENU_TX_BAR,
#endif
#ifdef ENABLE_RSSI_BAR
MENU_RSSI_BAR,
MENU_RX_BAR,
#endif
MENU_1_CALL,
MENU_S_LIST,