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

Lots n lots

This commit is contained in:
OneOfEleven
2023-10-29 22:33:38 +00:00
parent 230fdccf10
commit f3e347bc5a
39 changed files with 951 additions and 770 deletions

View File

@ -64,18 +64,18 @@ void FUNCTION_Init(void)
g_ctcss_lost = false;
#ifdef ENABLE_VOX
g_vox_lost = false;
g_vox_lost = false;
#endif
g_squelch_open = false;
g_squelch_open = false;
g_flag_tail_tone_elimination_complete = false;
g_tail_tone_elimination_tick_10ms = 0;
g_found_ctcss = false;
g_found_cdcss = false;
g_found_ctcss_tick_10ms = 0;
g_found_cdcss_tick_10ms = 0;
g_end_of_rx_detected_maybe = false;
g_flag_tail_tone_elimination_complete = false;
g_tail_tone_elimination_tick_10ms = 0;
g_found_ctcss = false;
g_found_cdcss = false;
g_found_ctcss_tick_10ms = 0;
g_found_cdcss_tick_10ms = 0;
g_end_of_rx_detected_maybe = false;
#ifdef ENABLE_NOAA
g_noaa_tick_10ms = 0;
@ -93,10 +93,8 @@ void FUNCTION_Select(function_type_t Function)
if (was_power_save && Function != FUNCTION_POWER_SAVE)
{ // wake up
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
BK4819_Conditional_RX_TurnOn();
g_rx_idle_mode = false;
UI_DisplayStatus(false);
}
@ -135,26 +133,16 @@ void FUNCTION_Select(function_type_t Function)
return;
case FUNCTION_MONITOR:
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("func monitor\r\n");
#endif
g_monitor_enabled = true;
break;
case FUNCTION_NEW_RECEIVE:
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("func new receive\r\n");
#endif
break;
case FUNCTION_RECEIVE:
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("func receive\r\n");
#endif
break;
case FUNCTION_POWER_SAVE:
@ -162,19 +150,24 @@ void FUNCTION_Select(function_type_t Function)
UART_SendText("func power save\r\n");
#endif
g_power_save_10ms = g_eeprom.battery_save * 10;
g_power_save_expired = false;
if (g_flash_light_state != FLASHLIGHT_SOS)
{
g_speaker_enabled = false;
g_monitor_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
}
g_power_save_tick_10ms = g_eeprom.battery_save * 10;
g_power_save_expired = false;
g_rx_idle_mode = true;
g_monitor_enabled = false;
BK4819_DisableVox();
BK4819_Sleep();
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, false);
if (g_current_display_screen != DISPLAY_MENU) // 1of11 .. don't close the menu
if (g_current_display_screen != DISPLAY_MENU)
GUI_SelectNextDisplay(DISPLAY_MAIN);
return;
@ -189,9 +182,9 @@ void FUNCTION_Select(function_type_t Function)
if (g_eeprom.dual_watch != DUAL_WATCH_OFF)
{ // dual-RX is enabled
g_dual_watch_delay_10ms = dual_watch_delay_after_tx_10ms;
if (g_dual_watch_delay_10ms < (g_eeprom.scan_hold_time_500ms * 50))
g_dual_watch_delay_10ms = g_eeprom.scan_hold_time_500ms * 50;
g_dual_watch_tick_10ms = dual_watch_delay_after_tx_10ms;
if (g_dual_watch_tick_10ms < (g_eeprom.scan_hold_time_500ms * 50))
g_dual_watch_tick_10ms = g_eeprom.scan_hold_time_500ms * 50;
}
#ifdef ENABLE_MDC1200
@ -229,13 +222,12 @@ void FUNCTION_Select(function_type_t Function)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
SYSTEM_DelayMs(20);
SYSTEM_DelayMs(2);
BK4819_StartTone1(500, 28, true);
SYSTEM_DelayMs(2);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = true;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
SYSTEM_DelayMs(60);
BK4819_ExitTxMute();
@ -264,8 +256,8 @@ void FUNCTION_Select(function_type_t Function)
SYSTEM_DelayMs(2);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = true;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
#ifdef ENABLE_ALARM
g_alarm_tone_counter_10ms = 0;
@ -326,11 +318,10 @@ void FUNCTION_Select(function_type_t Function)
UART_SendText("func panadpter\r\n");
#endif
break;
}
g_battery_save_tick_10ms = battery_save_count_10ms;
g_schedule_power_save_tick_10ms = battery_save_count_10ms;
g_schedule_power_save = false;
#ifdef ENABLE_FMRADIO