0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-30 15:21:26 +03:00
This commit is contained in:
OneOfEleven 2023-10-30 00:14:38 +00:00
parent f3e347bc5a
commit dac0cc0d18
7 changed files with 75 additions and 72 deletions

View File

@ -30,7 +30,7 @@ ENABLE_MUTE_RADIO_FOR_VOICE := 0
# Tx on Voice 1.0 kB
ENABLE_VOX := 0
ENABLE_REDUCE_LOW_MID_TX_POWER := 1
# Tx Alarm 0.6 kB
# Tx Alarm 600 B
ENABLE_ALARM := 0
ENABLE_TX1750 := 1
# MDC1200 2.8 kB
@ -42,12 +42,12 @@ ENABLE_BIG_FREQ := 0
ENABLE_SMALL_BOLD := 1
# smallest font 2 kB
ENABLE_SMALLEST_FONT := 0
# trim trailing 0.044 kB
# trim trailing 44 B
ENABLE_TRIM_TRAILING_ZEROS := 1
ENABLE_KEEP_MEM_NAME := 1
ENABLE_WIDE_RX := 1
ENABLE_TX_WHEN_AM := 0
# Freq calibration 0.188 kB
# Freq calibration 188 B
ENABLE_F_CAL_MENU := 0
ENABLE_TX_UNLOCK := 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
@ -59,25 +59,25 @@ ENABLE_SHOW_CHARGE_LEVEL := 0
ENABLE_REVERSE_BAT_SYMBOL := 1
ENABLE_FREQ_SEARCH_TIMEOUT := 0
ENABLE_CODE_SEARCH_TIMEOUT := 0
# Kill and Revive 0.4 kB
# Kill and Revive 400 B
ENABLE_KILL_REVIVE := 0
# AM Fix 0.8 kB
# AM Fix 800 B
ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0
# Squelch 0.012 kB .. can't be right ?
# Squelch 12 B .. can't be right ?
ENABLE_SQUELCH_MORE_SENSITIVE := 1
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1
ENABLE_FASTER_CHANNEL_SCAN := 1
ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1
# Rx Signal Bar 0.4 kB
ENABLE_RX_SIGNAL_BAR := 0
# Tx Timeout Bar 0.2 kB
# Rx Signal Bar 400 B
ENABLE_RX_SIGNAL_BAR := 1
# Tx Timeout Bar 200 B
ENABLE_TX_TIMEOUT_BAR := 0
# Tx Audio Bar 0.3 kB
# Tx Audio Bar 300 B
ENABLE_TX_AUDIO_BAR := 1
# Side Button Menu 0.3 kB
# Side Button Menu 300 B
ENABLE_SIDE_BUTT_MENU := 1
# Key Lock 0.4 kB
# Key Lock 400 B
ENABLE_KEYLOCK := 0
#ENABLE_PANADAPTER := 0
#ENABLE_SINGLE_VFO_CHAN := 0

View File

@ -99,10 +99,11 @@ void ACTION_Monitor(void)
if (!g_monitor_enabled) // (g_current_function != FUNCTION_MONITOR)
{ // enable monitor mode
g_beep_to_play = BEEP_NONE;
g_monitor_enabled = true;
// g_squelch_open = true;
g_beep_to_play = BEEP_NONE;
if (!g_squelch_open && GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER))
BK4819_StopTones(g_current_function == FUNCTION_TRANSMIT);
#ifdef ENABLE_NOAA
// if (g_rx_vfo->channel_save >= NOAA_CHANNEL_FIRST && g_is_noaa_mode)

View File

@ -95,7 +95,8 @@ static void APP_update_rssi(const int vfo)
g_current_rssi[vfo] = rssi;
UI_update_rssi(rssi, vfo);
if (g_squelch_open)
UI_update_rssi(rssi, vfo);
}
static void APP_check_for_new_receive(void)
@ -166,6 +167,7 @@ done:
#endif
APP_update_rssi(g_eeprom.rx_vfo);
g_update_rssi = true;
}
}
@ -487,16 +489,18 @@ bool APP_start_listening(void)
case SCAN_RESUME_TIME:
if (!g_scan_pause_time_mode)
{
g_scan_pause_tick_10ms = g_eeprom.scan_hold_time_500ms * 50;
g_scan_pause_tick_10ms = g_eeprom.scan_hold_time_500ms * 50;
g_scan_pause_time_mode = true;
}
break;
case SCAN_RESUME_CARRIER:
g_scan_pause_tick_10ms = g_eeprom.scan_hold_time_500ms * 50;
g_scan_pause_tick_10ms = g_eeprom.scan_hold_time_500ms * 50;
g_scan_pause_time_mode = false;
break;
case SCAN_RESUME_STOP:
g_scan_pause_tick_10ms = 0;
g_scan_pause_tick_10ms = 0;
g_scan_pause_time_mode = false;
break;
}
@ -509,7 +513,7 @@ bool APP_start_listening(void)
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.screen_channel[chan] = 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;
}
#endif
@ -523,17 +527,16 @@ bool APP_start_listening(void)
{ // dual watch is active
g_dual_watch_tick_10ms = g_eeprom.scan_hold_time_500ms * 50;
g_rx_vfo_is_active = true;
g_update_status = true;
g_rx_vfo_is_active = true;
g_update_status = true;
}
// AF gain - original QS values
if (g_rx_vfo->am_mode)
{
BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000
}
else
// if (g_rx_vfo->am_mode)
// {
// BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000
// }
// else
{
BK4819_WriteRegister(0x48,
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
@ -562,7 +565,7 @@ bool APP_start_listening(void)
if (g_current_display_screen != DISPLAY_MENU)
GUI_SelectNextDisplay(DISPLAY_MAIN);
g_update_status = true;
g_update_status = true;
g_update_display = true;
return true;
@ -927,7 +930,7 @@ void APP_process_radio_interrupts(void)
if (interrupt_bits & BK4819_REG_02_CDCSS_LOST)
{
g_cdcss_lost = true;
g_cdcss_lost = true;
g_cdcss_code_type = BK4819_get_CDCSS_code_type();
}
@ -947,29 +950,29 @@ void APP_process_radio_interrupts(void)
#ifdef ENABLE_VOX
if (interrupt_bits & BK4819_REG_02_VOX_LOST)
{
g_vox_lost = true;
g_vox_lost = true;
g_vox_pause_tick_10ms = 10;
if (g_eeprom.vox_switch)
{
if (g_current_function == FUNCTION_POWER_SAVE && !g_rx_idle_mode)
{
g_power_save_tick_10ms = power_save2_10ms;
g_power_save_expired = false;
g_power_save_tick_10ms = power_save2_10ms;
g_power_save_expired = false;
}
if (g_eeprom.dual_watch != DUAL_WATCH_OFF &&
(g_dual_watch_tick_10ms == 0 || g_dual_watch_tick_10ms < dual_watch_delay_after_vox_10ms))
{
g_dual_watch_tick_10ms = dual_watch_delay_after_vox_10ms;
g_update_status = true;
g_update_status = true;
}
}
}
if (interrupt_bits & BK4819_REG_02_VOX_FOUND)
{
g_vox_lost = false;
g_vox_lost = false;
g_vox_pause_tick_10ms = 0;
}
#endif
@ -977,13 +980,14 @@ void APP_process_radio_interrupts(void)
if (interrupt_bits & BK4819_REG_02_SQUELCH_CLOSED)
{
g_squelch_open = false;
// g_squelch_open = g_monitor_enabled;
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("sq close\r\n");
#endif
g_update_display = true;
}
if (interrupt_bits & BK4819_REG_02_SQUELCH_OPENED)
@ -993,6 +997,11 @@ void APP_process_radio_interrupts(void)
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("sq open\r\n");
#endif
if (g_monitor_enabled)
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
g_update_display = true;
}
}
}
@ -1003,28 +1012,28 @@ void APP_end_tx(void)
RADIO_tx_eot();
if (g_current_vfo->p_tx->code_type != CODE_TYPE_NONE)
{ // CTCSS/DCS is enabled
{ // CTCSS/CDCSS is enabled
//if (g_eeprom.tail_note_elimination && g_eeprom.repeater_tail_tone_elimination > 0)
if (g_eeprom.tail_note_elimination)
{ // send the CTCSS/DCS tail tone - allows the receivers to mute the usual FM squelch tail/crash
RADIO_EnableCxCSS();
}
#if 0
#if 1
else
{ // TX a short blank carrier
// this gives the receivers time to mute RX audio before we drop carrier
{ // TX a short blank carrier after disabling the CTCSS/CDCSS
// this gives the receivers time to mute their RX audio before we drop carrier
BK4819_ExitSubAu();
SYSTEM_DelayMs(200);
}
#endif
}
g_speaker_enabled = false;
RADIO_setup_registers(false);
if (!g_speaker_enabled && !g_monitor_enabled)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
else
if (g_monitor_enabled)
APP_start_listening();
}
@ -1458,7 +1467,7 @@ void APP_process_flash_light_10ms(void)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
#ifdef ENABLE_FLASH_LIGHT_SOS_TONE
if (!g_squelch_open && !g_monitor_enabled && !GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER))
BK4819_StartTone1(880, 127, true);
BK4819_StartTone1(880, 50, true);
#endif
}
}
@ -1468,7 +1477,7 @@ void APP_process_flash_light_10ms(void)
{ // LED off
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); // OFF
#ifdef ENABLE_FLASH_LIGHT_SOS_TONE
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER))
if (!g_squelch_open && !g_monitor_enabled && GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER))
BK4819_StopTones(g_current_function == FUNCTION_TRANSMIT);
#endif
}
@ -2530,9 +2539,7 @@ void APP_time_slice_10ms(void)
if (g_vox_pause_tick_10ms > 0)
g_vox_pause_tick_10ms--;
#endif
#ifdef ENABLE_VOX
if (g_eeprom.vox_switch)
APP_process_vox();
#endif

Binary file not shown.

Binary file not shown.

11
radio.c
View File

@ -695,12 +695,11 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, true);
// AF RX Gain and DAC
// BK4819_WriteRegister(0x48, 0xB3A8); // 1011 00 111010 1000
if (g_rx_vfo->am_mode)
{
BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000
}
else
// if (g_rx_vfo->am_mode)
// {
// BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000
// }
// else
{
BK4819_WriteRegister(0x48,
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference

View File

@ -587,8 +587,7 @@ void UI_DisplayMain(void)
else
{ // receiving .. show the RX symbol
mode = 2;
if ((g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_NEW_RECEIVE) &&
g_eeprom.rx_vfo == vfo_num)
if ((g_current_function == FUNCTION_RECEIVE && g_squelch_open) && g_eeprom.rx_vfo == vfo_num)
{
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold("RX", 14, 0, line);
@ -829,11 +828,8 @@ void UI_DisplayMain(void)
else
if (mode == 2)
{ // RX signal level
//#ifndef ENABLE_RX_SIGNAL_BAR
// antenna bar graph
if (g_vfo_rssi_bar_level[vfo_num] > 0)
Level = g_vfo_rssi_bar_level[vfo_num];
//#endif
if (g_vfo_rssi_bar_level[vfo_num] > 0)
Level = g_vfo_rssi_bar_level[vfo_num];
}
UI_drawBars(p_line1 + LCD_WIDTH, Level);
@ -917,7 +913,7 @@ void UI_DisplayMain(void)
g_dtmf_call_state == DTMF_CALL_STATE_NONE)
{ // we're free to use the middle line
const bool rx = (g_current_function == FUNCTION_RECEIVE);
const bool rx = (g_current_function == FUNCTION_RECEIVE && g_squelch_open) ? true : false;
#ifdef ENABLE_TX_TIMEOUT_BAR
// show the TX timeout count down