mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 06:11:24 +03:00
added TX timeout beeps
This commit is contained in:
parent
b4841f0ba9
commit
521793ba6f
@ -323,7 +323,7 @@ void ACTION_Scan(bool bRestart)
|
||||
{
|
||||
g_input_box_index = 0;
|
||||
|
||||
(void)b1750; // stop unused compile warning
|
||||
(void)b1750; // stop compile warning
|
||||
|
||||
#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750)
|
||||
g_alarm_state = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM;
|
||||
@ -337,7 +337,7 @@ void ACTION_Scan(bool bRestart)
|
||||
|
||||
g_flag_prepare_tx = true;
|
||||
|
||||
if (g_current_display_screen != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||
if (g_current_display_screen != DISPLAY_MENU)
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
}
|
||||
#endif
|
||||
|
@ -671,6 +671,8 @@ static void AIRCOPY_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
|
||||
INPUTBOX_append(Key);
|
||||
|
||||
NUMBER_Get(g_input_box, &Frequency);
|
||||
|
||||
g_request_display_screen = DISPLAY_AIRCOPY;
|
||||
|
||||
if (g_input_box_index < 6)
|
||||
@ -683,8 +685,6 @@ static void AIRCOPY_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
|
||||
g_input_box_index = 0;
|
||||
|
||||
NUMBER_Get(g_input_box, &Frequency);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(FREQ_BAND_TABLE); i++)
|
||||
{
|
||||
if (Frequency >= FREQ_BAND_TABLE[i].lower && Frequency < FREQ_BAND_TABLE[i].upper)
|
||||
|
171
app/app.c
171
app/app.c
@ -1994,8 +1994,19 @@ void APP_time_slice_500ms(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_current_function == FUNCTION_TRANSMIT && (g_tx_timer_tick_500ms & 1u))
|
||||
g_update_display = true;
|
||||
if (g_current_function == FUNCTION_TRANSMIT)
|
||||
{
|
||||
if (g_tx_timer_tick_500ms < 6)
|
||||
{ // <= 3 seconds left
|
||||
if (g_tx_timer_tick_500ms & 1u)
|
||||
BK4819_start_tone(880, 10, true, false);
|
||||
else
|
||||
BK4819_stop_tones(true);
|
||||
}
|
||||
|
||||
if (g_tx_timer_tick_500ms & 1u)
|
||||
g_update_display = true;
|
||||
}
|
||||
|
||||
if (g_menu_tick_10ms > 0)
|
||||
if (--g_menu_tick_10ms == 0)
|
||||
@ -2289,75 +2300,6 @@ void APP_time_slice_10ms(void)
|
||||
{
|
||||
g_flash_light_blink_tick_10ms++;
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (g_current_display_screen == DISPLAY_AIRCOPY)
|
||||
{ // we're in AIRCOPY mode
|
||||
|
||||
if (g_aircopy_state == AIRCOPY_TX)
|
||||
AIRCOPY_process_fsk_tx_10ms();
|
||||
|
||||
AIRCOPY_process_fsk_rx_10ms();
|
||||
|
||||
APP_check_keys();
|
||||
|
||||
if (g_update_display)
|
||||
GUI_DisplayScreen();
|
||||
|
||||
if (g_update_status)
|
||||
UI_DisplayStatus(false);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_UART
|
||||
if (UART_IsCommandAvailable())
|
||||
{
|
||||
__disable_irq();
|
||||
UART_HandleCommand();
|
||||
__enable_irq();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_current_function == FUNCTION_TRANSMIT && (g_tx_timeout_reached || g_serial_config_tick_500ms > 0))
|
||||
{ // transmitter timed out or must de-key
|
||||
|
||||
g_tx_timeout_reached = false;
|
||||
g_flag_end_tx = true;
|
||||
|
||||
APP_end_tx();
|
||||
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
|
||||
RADIO_set_vfo_state(VFO_STATE_TIMEOUT);
|
||||
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UART
|
||||
if (g_serial_config_tick_500ms > 0)
|
||||
{ // config upload/download is running
|
||||
if (g_update_display)
|
||||
GUI_DisplayScreen();
|
||||
if (g_update_status)
|
||||
UI_DisplayStatus(false);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if (g_rx_vfo->channel.am_mode > 0 && g_eeprom.config.setting.am_fix)
|
||||
AM_fix_10ms(g_rx_vfo_num);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_flag_save_fm)
|
||||
{
|
||||
SETTINGS_save_fm();
|
||||
g_flag_save_fm = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_flag_save_vfo)
|
||||
{
|
||||
SETTINGS_save_vfo_indices();
|
||||
@ -2370,6 +2312,32 @@ void APP_time_slice_10ms(void)
|
||||
g_flag_save_settings = false;
|
||||
}
|
||||
|
||||
if (g_request_display_screen != DISPLAY_INVALID)
|
||||
{
|
||||
GUI_SelectNextDisplay(g_request_display_screen);
|
||||
g_request_display_screen = DISPLAY_INVALID;
|
||||
}
|
||||
|
||||
if (g_update_display)
|
||||
GUI_DisplayScreen();
|
||||
|
||||
if (g_update_status)
|
||||
UI_DisplayStatus(false);
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (g_current_display_screen == DISPLAY_AIRCOPY)
|
||||
{ // we're in AIRCOPY mode
|
||||
|
||||
if (g_aircopy_state == AIRCOPY_TX)
|
||||
AIRCOPY_process_fsk_tx_10ms();
|
||||
|
||||
AIRCOPY_process_fsk_rx_10ms();
|
||||
|
||||
APP_check_keys();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_flag_save_channel)
|
||||
{
|
||||
SETTINGS_save_channel(g_tx_vfo->channel_save, g_eeprom.config.setting.tx_vfo_num, g_tx_vfo, g_flag_save_channel ? 1 : 0);
|
||||
@ -2385,17 +2353,55 @@ void APP_time_slice_10ms(void)
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UART
|
||||
if (UART_IsCommandAvailable())
|
||||
{
|
||||
__disable_irq();
|
||||
UART_HandleCommand();
|
||||
__enable_irq();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_current_function == FUNCTION_TRANSMIT && (g_tx_timeout_reached || g_serial_config_tick_500ms > 0))
|
||||
{ // transmitter timed out or must de-key
|
||||
|
||||
BK4819_stop_tones(true);
|
||||
|
||||
g_tx_timeout_reached = false;
|
||||
g_flag_end_tx = true;
|
||||
|
||||
APP_end_tx();
|
||||
|
||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||
|
||||
RADIO_set_vfo_state(VFO_STATE_TIMEOUT);
|
||||
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UART
|
||||
if (g_serial_config_tick_500ms > 0)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if (g_rx_vfo->channel.am_mode > 0 && g_eeprom.config.setting.am_fix)
|
||||
AM_fix_10ms(g_rx_vfo_num);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_flag_save_fm)
|
||||
{
|
||||
SETTINGS_save_fm();
|
||||
g_flag_save_fm = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_reduced_service || g_serial_config_tick_500ms > 0)
|
||||
{
|
||||
if (g_current_function == FUNCTION_TRANSMIT)
|
||||
g_tx_timeout_reached = true;
|
||||
|
||||
if (g_update_display)
|
||||
GUI_DisplayScreen();
|
||||
|
||||
if (g_update_status)
|
||||
UI_DisplayStatus(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2427,12 +2433,6 @@ void APP_time_slice_10ms(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_update_display)
|
||||
GUI_DisplayScreen();
|
||||
|
||||
if (g_update_status)
|
||||
UI_DisplayStatus(false);
|
||||
|
||||
APP_process_flash_light_10ms();
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@ -2958,9 +2958,4 @@ Skip:
|
||||
g_another_voice_id = VOICE_ID_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
GUI_SelectNextDisplay(g_request_display_screen);
|
||||
|
||||
g_request_display_screen = DISPLAY_INVALID;
|
||||
g_update_display = true;
|
||||
}
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
46
functions.c
46
functions.c
@ -39,6 +39,7 @@
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/status.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
@ -174,6 +175,26 @@ void FUNCTION_Select(function_type_t Function)
|
||||
UART_SendText("func transmit\r\n");
|
||||
#endif
|
||||
|
||||
g_tx_timer_tick_500ms = 0;
|
||||
g_tx_timeout_reached = false;
|
||||
g_flag_end_tx = false;
|
||||
|
||||
g_rtte_count_down = 0;
|
||||
g_dtmf_reply_state = DTMF_REPLY_NONE;
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (g_alarm_state == ALARM_STATE_OFF)
|
||||
#endif
|
||||
{
|
||||
if (g_eeprom.config.setting.tx_timeout == 0)
|
||||
g_tx_timer_tick_500ms = 60; // 30 sec
|
||||
else
|
||||
if (g_eeprom.config.setting.tx_timeout < (ARRAY_SIZE(g_sub_menu_tx_timeout) - 1))
|
||||
g_tx_timer_tick_500ms = 120 * g_eeprom.config.setting.tx_timeout; // minutes
|
||||
else
|
||||
g_tx_timer_tick_500ms = 120 * 15; // 15 minutes
|
||||
}
|
||||
|
||||
if (g_eeprom.config.setting.backlight_on_tx_rx == 1 || g_eeprom.config.setting.backlight_on_tx_rx == 3)
|
||||
backlight_turn_on(backlight_tx_rx_time_500ms);
|
||||
|
||||
@ -209,30 +230,6 @@ void FUNCTION_Select(function_type_t Function)
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
if (g_alarm_state == ALARM_STATE_TXALARM && g_eeprom.config.setting.alarm_mode != ALARM_MODE_TONE)
|
||||
{ // enable the alarm tone but not the TX
|
||||
|
||||
g_alarm_state = ALARM_STATE_ALARM;
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
SYSTEM_DelayMs(2);
|
||||
BK4819_start_tone(500, 28, g_current_function == FUNCTION_TRANSMIT, false);
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
SYSTEM_DelayMs(60);
|
||||
BK4819_ExitTxMute();
|
||||
|
||||
g_alarm_tone_counter_10ms = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
BK4819_set_scrambler(0);
|
||||
|
||||
RADIO_enableTX(false);
|
||||
@ -260,7 +257,6 @@ void FUNCTION_Select(function_type_t Function)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if (!DTMF_Reply())
|
||||
{
|
||||
#ifdef ENABLE_MDC1200
|
||||
|
44
radio.c
44
radio.c
@ -619,11 +619,6 @@ void RADIO_ApplyOffset(vfo_info_t *p_vfo, const bool set_pees)
|
||||
}
|
||||
}
|
||||
|
||||
static void RADIO_SelectCurrentVfo(void)
|
||||
{
|
||||
g_current_vfo = (g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? g_rx_vfo : &g_vfo_info[g_eeprom.config.setting.tx_vfo_num];
|
||||
}
|
||||
|
||||
void RADIO_select_vfos(void)
|
||||
{
|
||||
g_eeprom.config.setting.tx_vfo_num = get_TX_VFO();
|
||||
@ -632,7 +627,7 @@ void RADIO_select_vfos(void)
|
||||
g_tx_vfo = &g_vfo_info[g_eeprom.config.setting.tx_vfo_num];
|
||||
g_rx_vfo = &g_vfo_info[g_rx_vfo_num];
|
||||
|
||||
RADIO_SelectCurrentVfo();
|
||||
g_current_vfo = (g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? g_rx_vfo : &g_vfo_info[g_eeprom.config.setting.tx_vfo_num];
|
||||
}
|
||||
|
||||
void RADIO_setup_registers(bool switch_to_function_foreground)
|
||||
@ -1031,6 +1026,20 @@ void RADIO_PrepareTX(void)
|
||||
{
|
||||
vfo_state_t State = VFO_STATE_NORMAL; // default to OK for TX
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
if (g_alarm_state == ALARM_STATE_TXALARM && g_eeprom.config.setting.alarm_mode != ALARM_MODE_TONE)
|
||||
{ // enable the alarm tone but not the TX
|
||||
|
||||
g_alarm_state = ALARM_STATE_ALARM;
|
||||
GUI_DisplayScreen();
|
||||
BK4819_start_tone(500, 28, g_current_function == FUNCTION_TRANSMIT, false);
|
||||
SYSTEM_DelayMs(60);
|
||||
BK4819_ExitTxMute();
|
||||
g_alarm_tone_counter_10ms = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF)
|
||||
{ // dual-RX is enabled
|
||||
#if 0
|
||||
@ -1054,7 +1063,7 @@ void RADIO_PrepareTX(void)
|
||||
g_update_status = true;
|
||||
}
|
||||
|
||||
RADIO_SelectCurrentVfo();
|
||||
g_current_vfo = (g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF) ? g_rx_vfo : &g_vfo_info[g_eeprom.config.setting.tx_vfo_num];
|
||||
|
||||
#ifndef ENABLE_TX_WHEN_AM
|
||||
if (g_current_vfo->channel.am_mode > 0)
|
||||
@ -1097,6 +1106,7 @@ void RADIO_PrepareTX(void)
|
||||
return;
|
||||
}
|
||||
|
||||
// ******************************
|
||||
// TX is allowed
|
||||
|
||||
if (g_dtmf_reply_state == DTMF_REPLY_ANI)
|
||||
@ -1115,26 +1125,6 @@ void RADIO_PrepareTX(void)
|
||||
}
|
||||
|
||||
FUNCTION_Select(FUNCTION_TRANSMIT);
|
||||
|
||||
g_tx_timer_tick_500ms = 0; // no timeout
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (g_alarm_state == ALARM_STATE_OFF)
|
||||
#endif
|
||||
{
|
||||
if (g_eeprom.config.setting.tx_timeout == 0)
|
||||
g_tx_timer_tick_500ms = 60; // 30 sec
|
||||
else
|
||||
if (g_eeprom.config.setting.tx_timeout < (ARRAY_SIZE(g_sub_menu_tx_timeout) - 1))
|
||||
g_tx_timer_tick_500ms = 120 * g_eeprom.config.setting.tx_timeout; // minutes
|
||||
else
|
||||
g_tx_timer_tick_500ms = 120 * 15; // 15 minutes
|
||||
}
|
||||
|
||||
g_tx_timeout_reached = false;
|
||||
g_flag_end_tx = false;
|
||||
g_rtte_count_down = 0;
|
||||
g_dtmf_reply_state = DTMF_REPLY_NONE;
|
||||
}
|
||||
|
||||
void RADIO_enable_CxCSS_tail(void)
|
||||
|
@ -102,8 +102,8 @@ enum {
|
||||
#endif
|
||||
|
||||
enum alarm_mode_e {
|
||||
ALARM_MODE_SITE = 0,
|
||||
ALARM_MODE_TONE
|
||||
ALARM_MODE_SITE = 0, // TX
|
||||
ALARM_MODE_TONE // don't TX
|
||||
};
|
||||
typedef enum alarm_mode_e alarm_mode_t;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user