0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-27 22:01:26 +03:00

tx timeout ding update

This commit is contained in:
OneOfEleven 2023-12-08 18:06:12 +00:00
parent 3dc430905d
commit e76272d597
6 changed files with 22 additions and 17 deletions

View File

@ -1851,7 +1851,7 @@ void APP_process_transmit(void)
GUI_DisplayScreen();
RADIO_enableTX(false);
BK4819_TransmitTone(true, 500);
BK4819_tx_tone(true, 500, 28);
SYSTEM_DelayMs(2);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
@ -2091,9 +2091,10 @@ void APP_time_slice_500ms(void)
#endif
static bool tx_timeout_tone_on = false;
if (g_current_function == FUNCTION_TRANSMIT)
{
if (g_tx_timer_tick_500ms < 6)
if (g_tx_timer_tick_500ms <= 7)
{ // <= 3 seconds TX time left .. start beeping
if (g_tx_timer_tick_500ms & 1u)
@ -2102,7 +2103,7 @@ void APP_time_slice_500ms(void)
{
tx_timeout_tone_on = true;
//BK4819_start_tone(880, 10, true, false);
BK4819_TransmitTone(true, 880);
BK4819_tx_tone(true, 660, 10);
}
}
else
@ -2110,7 +2111,6 @@ void APP_time_slice_500ms(void)
if (tx_timeout_tone_on)
{
tx_timeout_tone_on = false;
//GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
BK4819_stop_tones(true);
}
}
@ -2926,7 +2926,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
BK4819_set_scrambler(0);
if (Code == 0xFE)
BK4819_TransmitTone(g_eeprom.config.setting.dtmf.side_tone, ENABLE_TX_TONE_HZ);
BK4819_tx_tone(g_eeprom.config.setting.dtmf.side_tone, ENABLE_TX_TONE_HZ, 28);
else
BK4819_PlayDTMFEx(g_eeprom.config.setting.dtmf.side_tone, Code);
}

View File

@ -870,8 +870,11 @@ void BK4819_EnableDTMF(void)
(15u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15
}
void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency)
void BK4819_tx_tone(const bool side_tone, const unsigned int frequency, const unsigned int level)
{
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
SYSTEM_DelayMs(1);
BK4819_SetAF(BK4819_AF_MUTE);
BK4819_EnterTxMute();
// REG_70
@ -893,20 +896,23 @@ void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency)
// set the tone amplitude
//
// BK4819_write_reg(0x70, BK4819_REG_70_MASK_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_write_reg(0x70, BK4819_REG_70_MASK_ENABLE_TONE1 | (28u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
// BK4819_write_reg(0x70, BK4819_REG_70_MASK_ENABLE_TONE1 | (28u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_write_reg(0x70, BK4819_REG_70_MASK_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_write_reg(0x71, scale_freq(Frequency));
BK4819_SetAF(bLocalLoopback ? BK4819_AF_BEEP : BK4819_AF_MUTE);
if (bLocalLoopback)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
BK4819_write_reg(0x71, scale_freq(frequency));
BK4819_EnableTXLink();
SYSTEM_DelayMs(50);
BK4819_ExitTxMute();
if (side_tone)
{
BK4819_SetAF(BK4819_AF_BEEP);
SYSTEM_DelayMs(1);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
}
}
void BK4819_start_tone(const uint16_t frequency, const unsigned int level, const bool tx, const bool tx_mute)

View File

@ -107,6 +107,7 @@ void BK4819_DisableVox(void);
void BK4819_DisableDTMF(void);
void BK4819_EnableDTMF(void);
void BK4819_tx_tone(const bool side_tone, const unsigned int frequency, const unsigned int level);
void BK4819_start_tone(const uint16_t frequency, const unsigned int level, const bool tx, const bool tx_mute);
void BK4819_stop_tones(const bool tx);
@ -143,8 +144,6 @@ void BK4819_EnableTXLink(void);
void BK4819_PlayDTMF(char Code);
void BK4819_PlayDTMFString(const char *pString, bool bDelayFirst, uint16_t FirstCodePersistTime, uint16_t HashCodePersistTime, uint16_t CodePersistTime, uint16_t CodeInternalTime);
void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency);
uint16_t BK4819_GetRSSI(void);
uint8_t BK4819_GetGlitchIndicator(void);
uint8_t BK4819_GetExNoiceIndicator(void);

Binary file not shown.

Binary file not shown.

View File

@ -250,11 +250,11 @@ void FUNCTION_Select(function_type_t Function)
{
#if (ENABLE_TX_TONE_HZ > 0)
if (g_alarm_state == ALARM_STATE_TX_TONE)
BK4819_TransmitTone(true, ENABLE_TX_TONE_HZ);
BK4819_tx_tone(true, ENABLE_TX_TONE_HZ, 28);
#endif
#ifdef ENABLE_ALARM
if (g_alarm_state == ALARM_STATE_TX_ALARM)
BK4819_TransmitTone(true, 500);
BK4819_tx_tone(true, 500, 28);
#endif
SYSTEM_DelayMs(2);