0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-05-18 16:01:18 +03:00

fix side-butt TX tone

This commit is contained in:
OneOfEleven 2023-12-08 17:43:01 +00:00
parent ade0b61c67
commit 3dc430905d
18 changed files with 205 additions and 167 deletions

View File

@ -31,7 +31,7 @@ ENABLE_VOX := 1
ENABLE_VOX_MORE_SENSITIVE := 1 ENABLE_VOX_MORE_SENSITIVE := 1
# Tx Alarm 600 B # Tx Alarm 600 B
ENABLE_ALARM := 0 ENABLE_ALARM := 0
ENABLE_TX1750 := 0 ENABLE_TX_TONE_HZ := 1750
# MDC1200 2.8 kB # MDC1200 2.8 kB
ENABLE_MDC1200 := 0 ENABLE_MDC1200 := 0
ENABLE_MDC1200_SHOW_OP_ARG := 1 ENABLE_MDC1200_SHOW_OP_ARG := 1
@ -42,7 +42,7 @@ ENABLE_RESET_AES_KEY := 0
ENABLE_BIG_FREQ := 0 ENABLE_BIG_FREQ := 0
# DTMF_CALLING 2.8 kB # DTMF_CALLING 2.8 kB
ENABLE_DTMF_CALLING := 0 ENABLE_DTMF_CALLING := 0
ENABLE_DTMF_LIVE_DECODER := 1 ENABLE_DTMF_LIVE_DECODER := 0
ENABLE_DTMF_TIMING_SETTINGS := 0 ENABLE_DTMF_TIMING_SETTINGS := 0
ENABLE_DTMF_CALL_FLASH_LIGHT := 0 ENABLE_DTMF_CALL_FLASH_LIGHT := 0
# Kill and Revive 400 B # Kill and Revive 400 B
@ -379,8 +379,10 @@ endif
ifeq ($(ENABLE_ALARM),1) ifeq ($(ENABLE_ALARM),1)
CFLAGS += -DENABLE_ALARM CFLAGS += -DENABLE_ALARM
endif endif
ifeq ($(ENABLE_TX1750),1) ifdef ENABLE_TX_TONE_HZ
CFLAGS += -DENABLE_TX1750 ifneq ($(ENABLE_TX_TONE_HZ), 0)
CFLAGS += -DENABLE_TX_TONE_HZ=$(ENABLE_TX_TONE_HZ)
endif
endif endif
ifeq ($(ENABLE_MDC1200),1) ifeq ($(ENABLE_MDC1200),1)
CFLAGS += -DENABLE_MDC1200 CFLAGS += -DENABLE_MDC1200

132
README.md
View File

@ -37,72 +37,72 @@ You can customize the firmware by enabling/disabling various compile options, th
You'll find the options at the top of "Makefile" ('0' = remove code, '1' = include code) .. You'll find the options at the top of "Makefile" ('0' = remove code, '1' = include code) ..
``` ```
ENABLE_CLANG := 0 **experimental, builds with clang instead of gcc (LTO will be disabled if you enable this) ENABLE_CLANG := 0 **1 = builds with clang instead of gcc (LTO will be disabled if you enable this)
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming) ENABLE_SWD := 0 1 = enable CPU's SWD port (debugging/flash-programming)
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed ENABLE_OVERLAY := 0 1 = cpu FLASH stuff, not needed
ENABLE_LTO := 1 **experimental, reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this) ENABLE_LTO := 1 **1 = reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this)
ENABLE_UART := 1 without this you can't configure radio via PC ENABLE_UART := 1 1 = enable config radio via programming lead
ENABLE_UART_DEBUG := 0 just for code debugging, it sends debug info along the USB serial connection (programming lead) ENABLE_UART_DEBUG := 0 1 = enable UART debug messages via the serial programming lead
ENABLE_AIRCOPY := 0 clone radio-to-radio via RF ENABLE_AIRCOPY := 0 1 = enable clone radio-to-radio via RF
ENABLE_AIRCOPY_REMEMBER_FREQ := 1 remember the aircopy frequency ENABLE_AIRCOPY_REMEMBER_FREQ := 1 1 = enable remember the aircopy frequency
ENABLE_AIRCOPY_RX_REBOOT := 0 auto reboot on an aircopy successful RX completion ENABLE_AIRCOPY_RX_REBOOT := 0 1 = auto reboot on an aircopy successful RX completion
ENABLE_FMRADIO_64_76 := 0 enable FM radio 64MHz ~ 76MHz ENABLE_FMRADIO_64_76 := 0 1 = enable FM radio 64MHz ~ 76MHz
ENABLE_FMRADIO_76_90 := 0 enable FM radio 76MHz ~ 90MHz ENABLE_FMRADIO_76_90 := 0 1 = enable FM radio 76MHz ~ 90MHz
ENABLE_FMRADIO_76_108 := 0 enable FM radio 76MHz ~ 108MHz ENABLE_FMRADIO_76_108 := 0 1 = enable FM radio 76MHz ~ 108MHz
ENABLE_FMRADIO_875_108 := 1 enable FM radio 87.5MHz ~ 108MHz ENABLE_FMRADIO_875_108 := 1 1 = enable FM radio 87.5MHz ~ 108MHz
ENABLE_FMRADIO_64_108 := 0 enable the FM radios full frequency range ENABLE_FMRADIO_64_108 := 0 1 = enable the FM radios full frequency range
ENABLE_NOAA := 0 everything NOAA (only of any use in the USA) ENABLE_NOAA := 0 1 = enable NOAA stuff (only of any use in the USA)
ENABLE_VOICE := 0 want to hear voices ? ENABLE_VOICE := 0 1 = enable voices
ENABLE_MUTE_RADIO_FOR_VOICE := 1 mute the radios audio when a voice is playing ENABLE_MUTE_RADIO_FOR_VOICE := 1 1 = mute the radios audio when a voice is playing
ENABLE_VOX := 0 voice operated transmission ENABLE_VOX := 0 1 = voice operated transmission
ENABLE_VOX_MORE_SENSITIVE := 1 make VOX more sensitive ENABLE_VOX_MORE_SENSITIVE := 1 1 = make VOX more sensitive
ENABLE_ALARM := 0 TX alarms ENABLE_ALARM := 0 1 = enable TX alarm
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access) ENABLE_TX_TONE_HZ := 1750 side key tx tone frequency 0 = disable >0 = frequency of tone
ENABLE_MDC1200 := 0 enable MDC1200 TX/RX + menu TX option ENABLE_MDC1200 := 0 1 = enable MDC1200 TX/RX + menu TX option
ENABLE_MDC1200_SHOW_OP_ARG := 1 show RX opcode and argument values when MDC1200 is RX'ed ENABLE_MDC1200_SHOW_OP_ARG := 1 1 = show RX opcode and argument values when MDC1200 is RX'ed
ENABLE_MDC1200_SIDE_BEEP := 1 enable short side tone/beep when MDC1200 is sent - so user knows when they can start taking after PTT pressed ENABLE_MDC1200_SIDE_BEEP := 1 1 = enable short side tone/beep when MDC1200 is sent - so user knows when they can start taking after PTT pressed
ENABLE_PWRON_PASSWORD := 0 include power-on password code ENABLE_PWRON_PASSWORD := 0 1 = include power-on password code
ENABLE_RESET_AES_KEY := 1 '1' = reset/clear the AES key stored in the eeprom (only if it's set) ENABLE_RESET_AES_KEY := 1 1 = reset/clear the AES key stored in the eeprom (only if it's set)
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware) ENABLE_BIG_FREQ := 0 1 = big font frequencies (like original QS firmware)
ENABLE_DTMF_CALLING := 0 enable the DTMF calling/paging features ENABLE_DTMF_CALLING := 0 1 = enable the DTMF calling/paging features
ENABLE_DTMF_LIVE_DECODER := 0 enable the live DTMF display/decoder .. adds a menu option ENABLE_DTMF_LIVE_DECODER := 0 1 = enable the live DTMF display/decoder .. adds a menu option
ENABLE_DTMF_TIMING_SETTINGS := 0 enable the DTMF timing settings in the menu ENABLE_DTMF_TIMING_SETTINGS := 0 1 = enable the DTMF timing settings in the menu
ENABLE_DTMF_CALL_FLASH_LIGHT := 0 flash the flash light LED when a DTMF call is received ENABLE_DTMF_CALL_FLASH_LIGHT := 0 1 = flash the flash light LED when a DTMF call is received
ENABLE_SHOW_FREQ_IN_CHAN := 0 indicate if frequency found in a channel ENABLE_SHOW_FREQ_IN_CHAN := 0 1 = indicate if frequency found in a channel
ENABLE_SMALL_BOLD := 0 bold channel name/no. (when name + freq channel display mode) ENABLE_SMALL_BOLD := 0 1 = bold channel name/no. (when name + freq channel display mode)
ENABLE_TRIM_TRAILING_ZEROS := 0 trim away any trailing zeros on frequencies ENABLE_TRIM_TRAILING_ZEROS := 0 1 = trim away any trailing zeros on frequencies
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-end/PA not designed for full range) ENABLE_WIDE_RX := 1 1 = full 18MHz to 1300MHz RX (though front-end/PA not designed for full range)
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM ENABLE_TX_WHEN_AM := 0 1 = allow TX (always FM) when RX is set to AM
ENABLE_F_CAL_MENU := 0 enable frequency calibration hidden menu ENABLE_F_CAL_MENU := 0 1 = enable frequency calibration hidden menu
ENABLE_FM_DEV_CAL_MENU := 0 enable FM deviation calibration hidden menu ENABLE_FM_DEV_CAL_MENU := 0 1 = enable FM deviation calibration hidden menu
ENABLE_TX_UNLOCK_MENU := 0 allow TX everywhere EXCEPT airband (108~137) .. TX harmonic content will cause interference to other services, do so entirely at your own risk ! ENABLE_TX_UNLOCK_MENU := 0 1 = allow TX everywhere EXCEPT airband (108~137) .. TX harmonic content will cause interference to other services, do so entirely at your own risk !
ENABLE_TX_POWER_CAL_MENU := 0 used to compute the TX power register values .. leave at '0' ENABLE_TX_POWER_CAL_MENU := 0 1 = used to compute the TX power register values .. leave at '0'
ENABLE_TX_POWER_FIX := 1 fix the TX output power, L ~ 10mW, M ~ 500mW, H ~ 4W, U ~ user settable ENABLE_TX_POWER_FIX := 1 1 = fix the TX output power, L ~ 10mW, M ~ 500mW, H ~ 4W, U ~ user settable
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0 standard CTCSS tail phase shift rather than QS's own 55Hz tone method ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0 1 = standard CTCSS tail phase shift rather than QS's own 55Hz tone method
ENABLE_CONTRAST := 0 add contrast menu ENABLE_CONTRAST := 0 1 = add contrast menu
ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up ENABLE_BOOT_BEEPS := 0 1 = gives user audio feedback on volume knob position at boot-up
ENABLE_FLASH_LIGHT_SOS_TONE := 0 also do SOS in morse ENABLE_FLASH_LIGHT_SOS_TONE := 0 1 = also do SOS in morse
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge ENABLE_SHOW_CHARGE_LEVEL := 0 1 = show the charge level when the radio is on charge
ENABLE_REVERSE_BAT_SYMBOL := 0 mirror the battery symbol on the status bar (+ pole on the right) ENABLE_REVERSE_BAT_SYMBOL := 0 1 = mirror the battery symbol on the status bar (+ pole on the right)
ENABLE_FREQ_SEARCH_LNA := 0 keep this disabled ENABLE_FREQ_SEARCH_LNA := 0 1 = keep this disabled
ENABLE_FREQ_SEARCH_TIMEOUT := 0 timeout if FREQ not found when using F+4 search function ENABLE_FREQ_SEARCH_TIMEOUT := 0 1 = timeout if FREQ not found when using F+4 search function
ENABLE_CODE_SEARCH_TIMEOUT := 0 timeout if CTCSS/CDCSS not found when using F+* search function ENABLE_CODE_SEARCH_TIMEOUT := 0 1 = timeout if CTCSS/CDCSS not found when using F+* search function
ENABLE_SCAN_IGNORE_LIST := 0 ignore selected frequencies when scanning - add freqs to list with short */scan button when freq scanning, remove freq from list with long press MENU when not scanning ENABLE_SCAN_IGNORE_LIST := 0 1 = ignore selected frequencies when scanning - add freqs to list with short */scan button when freq scanning, remove freq from list with long press MENU when not scanning
ENABLE_SCAN_RANGES := 0 adds menu option to auto select frequency scan range/step depending on your initial frequency ENABLE_SCAN_RANGES := 0 1 = adds menu option to auto select frequency scan range/step depending on your initial frequency
ENABLE_DTMF_KILL_REVIVE := 0 include kill and revive code ENABLE_DTMF_KILL_REVIVE := 0 1 = include kill and revive code
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to help prevent AM demodulator saturation, ignore the on-screen RSSI level (for now) ENABLE_AM_FIX := 1 1 = dynamically adjust the front end gains when in AM mode to help prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
ENABLE_AM_FIX_SHOW_DATA := 0 show debug data for the AM fix (still tweaking it) ENABLE_AM_FIX_SHOW_DATA := 0 1 = show debug data for the AM fix (still tweaking it)
ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves ENABLE_SQUELCH_MORE_SENSITIVE := 1 1 = make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 open the squelch when holding down UP or DN buttons when in frequency mode ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 1 = open the squelch when holding down UP or DN buttons when in frequency mode
ENABLE_FASTER_CHANNEL_SCAN := 1 increase the channel scan speed, but also make the squelch more twitchy ENABLE_FASTER_CHANNEL_SCAN := 1 1 = increase the channel scan speed, but also make the squelch more twitchy
ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1 long press M, copy channel to VFO, or VFO to channel ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1 1 = long press M, copy channel to VFO, or VFO to channel
ENABLE_TX_AUDIO_BAR := 0 enable a menu option for showing a TX audio level bar ENABLE_TX_AUDIO_BAR := 0 1 = enable a menu option for showing a TX audio level bar
ENABLE_TX_AUDIO_BACKLIGHT := 0 backlight will follow TX audio level ENABLE_TX_AUDIO_BACKLIGHT := 0 1 = backlight will follow TX audio level
ENABLE_SIDE_BUTT_MENU := 0 enable menu option for configuring the programmable side buttons ENABLE_SIDE_BUTT_MENU := 0 1 = enable menu option for configuring the programmable side buttons
ENABLE_KEYLOCK := 0 enable keylock menu option + keylock code ENABLE_KEYLOCK := 0 1 = enable keylock menu option + keylock code
ENABLE_PANADAPTER := 1 centered on the selected VFO RX frequency, only shows if dual-watch is disabled ENABLE_PANADAPTER := 1 1 = centered on the selected VFO RX frequency, only shows if dual-watch is disabled
ENABLE_PANADAPTER_PEAK_FREQ := 0 show the peak panadapter frequency ENABLE_PANADAPTER_PEAK_FREQ := 0 1 = show the peak panadapter frequency
ENABLE_SINGLE_VFO_CHAN := 1 switch to single VFO display when dual-watch and cross-VFO are disabled ENABLE_SINGLE_VFO_CHAN := 1 1 = switch to single VFO display when dual-watch and cross-VFO are disabled
``` ```
# New/modified function keys # New/modified function keys

View File

@ -338,22 +338,21 @@ void ACTION_Scan(bool bRestart)
} }
#endif #endif
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || (ENABLE_TX_TONE_HZ > 0)
static void ACTION_AlarmOr1750(const bool b1750) static void ACTION_AlarmOrTone(const bool tone)
{ {
g_input_box_index = 0; g_input_box_index = 0;
(void)b1750; // stop compile warning (void)tone; // stop compile warning
#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) && (ENABLE_TX_TONE_HZ > 0)
g_alarm_state = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM; g_alarm_state = tone ? ALARM_STATE_TX_TONE : ALARM_STATE_TX_ALARM;
g_alarm_running_counter_10ms = 0;
#elif defined(ENABLE_ALARM) #elif defined(ENABLE_ALARM)
g_alarm_state = ALARM_STATE_TXALARM; g_alarm_state = ALARM_STATE_TX_ALARM;
g_alarm_running_counter_10ms = 0;
#else #else
g_alarm_state = ALARM_STATE_TX1750; g_alarm_state = ALARM_STATE_TX_TONE;
#endif #endif
g_alarm_running_counter_10ms = 0;
g_flag_prepare_tx = true; g_flag_prepare_tx = true;
@ -362,7 +361,6 @@ void ACTION_Scan(bool bRestart)
} }
#endif #endif
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
void ACTION_FM(void) void ACTION_FM(void)
{ {
@ -454,7 +452,7 @@ void ACTION_process(const key_code_t Key, const bool key_pressed, const bool key
break; break;
case ACTION_OPT_ALARM: case ACTION_OPT_ALARM:
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
ACTION_AlarmOr1750(false); ACTION_AlarmOrTone(false);
#endif #endif
break; break;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
@ -462,9 +460,9 @@ void ACTION_process(const key_code_t Key, const bool key_pressed, const bool key
ACTION_FM(); ACTION_FM();
break; break;
#endif #endif
case ACTION_OPT_1750: case ACTION_OPT_TX_TONE:
#ifdef ENABLE_TX1750 #if (ENABLE_TX_TONE_HZ > 0)
ACTION_AlarmOr1750(true); ACTION_AlarmOrTone(true);
#endif #endif
break; break;
} }

View File

@ -19,20 +19,15 @@
#include "driver/keyboard.h" #include "driver/keyboard.h"
//static void ACTION_FlashLight(void)
void ACTION_Power(void); void ACTION_Power(void);
void ACTION_Monitor(void); void ACTION_Monitor(void);
void ACTION_Scan(bool bFlag); void ACTION_Scan(bool bFlag);
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
void ACTION_Vox(void); void ACTION_Vox(void);
#endif #endif
#ifdef ENABLE_ALARM
//static void ACTION_AlarmOr1750(bool b1750)
#endif
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
void ACTION_FM(void); void ACTION_FM(void);
#endif #endif
void ACTION_process(const key_code_t Key, const bool bKeyPressed, const bool bKeyHeld); void ACTION_process(const key_code_t Key, const bool bKeyPressed, const bool bKeyHeld);
#endif #endif

View File

@ -1558,7 +1558,7 @@ void APP_cancel_user_input_modes(void)
} }
} }
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || (ENABLE_TX_TONE_HZ > 0)
static void APP_alarm_off(void) static void APP_alarm_off(void)
{ {
if (!g_squelch_open && !g_monitor_enabled) if (!g_squelch_open && !g_monitor_enabled)
@ -1806,7 +1806,7 @@ void APP_process_transmit(void)
return; return;
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (g_alarm_state == ALARM_STATE_TXALARM || g_alarm_state == ALARM_STATE_ALARM) if (g_alarm_state == ALARM_STATE_TX_ALARM || g_alarm_state == ALARM_STATE_ALARM)
{ // TX alarm tone { // TX alarm tone
uint16_t Tone; uint16_t Tone;
@ -1825,9 +1825,13 @@ void APP_process_transmit(void)
if (g_eeprom.config.setting.alarm_mode == ALARM_MODE_TONE && g_alarm_running_counter_10ms == 512) if (g_eeprom.config.setting.alarm_mode == ALARM_MODE_TONE && g_alarm_running_counter_10ms == 512)
{ {
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("alm tone\n");
#endif
g_alarm_running_counter_10ms = 0; g_alarm_running_counter_10ms = 0;
if (g_alarm_state == ALARM_STATE_TXALARM) if (g_alarm_state == ALARM_STATE_TX_ALARM)
{ {
g_alarm_state = ALARM_STATE_ALARM; g_alarm_state = ALARM_STATE_ALARM;
@ -1842,7 +1846,7 @@ void APP_process_transmit(void)
} }
else else
{ {
g_alarm_state = ALARM_STATE_TXALARM; g_alarm_state = ALARM_STATE_TX_ALARM;
GUI_DisplayScreen(); GUI_DisplayScreen();
@ -2086,19 +2090,41 @@ void APP_time_slice_500ms(void)
return; return;
#endif #endif
static bool tx_timeout_tone_on = false;
if (g_current_function == FUNCTION_TRANSMIT) if (g_current_function == FUNCTION_TRANSMIT)
{ {
if (g_tx_timer_tick_500ms < 6) if (g_tx_timer_tick_500ms < 6)
{ // <= 3 seconds left { // <= 3 seconds TX time left .. start beeping
if (g_tx_timer_tick_500ms & 1u) if (g_tx_timer_tick_500ms & 1u)
BK4819_start_tone(880, 10, true, true); {
if (!tx_timeout_tone_on)
{
tx_timeout_tone_on = true;
//BK4819_start_tone(880, 10, true, false);
BK4819_TransmitTone(true, 880);
}
}
else else
BK4819_stop_tones(true); {
if (tx_timeout_tone_on)
{
tx_timeout_tone_on = false;
//GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
BK4819_stop_tones(true);
}
}
} }
if (g_tx_timer_tick_500ms & 1u) if (g_tx_timer_tick_500ms & 1u)
g_update_display = true; g_update_display = true;
} }
else
if (tx_timeout_tone_on)
{
tx_timeout_tone_on = false;
BK4819_stop_tones(false);
}
if (g_update_screen_tick_500ms > 0) if (g_update_screen_tick_500ms > 0)
{ // update display once every 500ms { // update display once every 500ms
@ -2851,7 +2877,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
if (g_current_function == FUNCTION_TRANSMIT) if (g_current_function == FUNCTION_TRANSMIT)
{ // transmitting { // transmitting
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || (ENABLE_TX_TONE_HZ > 0)
if (g_alarm_state == ALARM_STATE_OFF) if (g_alarm_state == ALARM_STATE_OFF)
#endif #endif
{ {
@ -2864,7 +2890,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
} }
if (Key == KEY_SIDE2) if (Key == KEY_SIDE2)
{ // transmit 1750Hz tone { // transmit tone
Code = 0xFE; Code = 0xFE;
} }
else else
@ -2900,15 +2926,19 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
BK4819_set_scrambler(0); BK4819_set_scrambler(0);
if (Code == 0xFE) if (Code == 0xFE)
BK4819_TransmitTone(g_eeprom.config.setting.dtmf.side_tone, 1750); BK4819_TransmitTone(g_eeprom.config.setting.dtmf.side_tone, ENABLE_TX_TONE_HZ);
else else
BK4819_PlayDTMFEx(g_eeprom.config.setting.dtmf.side_tone, Code); BK4819_PlayDTMFEx(g_eeprom.config.setting.dtmf.side_tone, Code);
} }
} }
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || (ENABLE_TX_TONE_HZ > 0)
else else
if ((!key_held && key_pressed) || (g_alarm_state == ALARM_STATE_TX1750 && key_held && !key_pressed)) if ((!key_held && key_pressed) || (g_alarm_state == ALARM_STATE_TX_TONE && key_held && !key_pressed))
{ {
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("alarm off\n");
#endif
APP_alarm_off(); APP_alarm_off();
if (g_eeprom.config.setting.repeater_tail_tone_elimination == 0) if (g_eeprom.config.setting.repeater_tail_tone_elimination == 0)

View File

@ -411,7 +411,7 @@ bool DTMF_Reply(void)
#endif #endif
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf("dtmf reply none %d, %s\n", g_dtmf_reply_state, g_dtmf_string); // UART_printf("dtmf reply none %d, %s\n", g_dtmf_reply_state, g_dtmf_string);
#endif #endif
switch (g_dtmf_reply_state) switch (g_dtmf_reply_state)

View File

@ -53,17 +53,17 @@ bool g_manual_scanning;
void resume_scanning(void) void resume_scanning(void)
{ {
g_scan_tick_10ms = 0;
g_scan_pause_time_mode = false;
g_squelch_open = false;
g_rx_reception_mode = RX_MODE_NONE;
FUNCTION_Select(FUNCTION_FOREGROUND);
if (g_current_display_screen != DISPLAY_SEARCH && if (g_current_display_screen != DISPLAY_SEARCH &&
g_scan_state_dir != SCAN_STATE_DIR_OFF && g_scan_state_dir != SCAN_STATE_DIR_OFF &&
!g_ptt_is_pressed) !g_ptt_is_pressed)
{ {
g_scan_tick_10ms = 0;
g_scan_pause_time_mode = false;
g_squelch_open = false;
g_rx_reception_mode = RX_MODE_NONE;
FUNCTION_Select(FUNCTION_FOREGROUND);
if (g_scan_next_channel <= USER_CHANNEL_LAST) if (g_scan_next_channel <= USER_CHANNEL_LAST)
APP_next_channel(); APP_next_channel();
else else

View File

@ -870,6 +870,45 @@ void BK4819_EnableDTMF(void)
(15u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15 (15u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15
} }
void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency)
{
BK4819_EnterTxMute();
// REG_70
//
// <15> 0 Enable TONE1
// 1 = Enable
// 0 = Disable
//
// <14:8> 0 TONE1 tuning gain
// 0 ~ 127
//
// <7> 0 Enable TONE2
// 1 = Enable
// 0 = Disable
//
// <6:0> 0 TONE2/FSK amplitude
// 0 ~ 127
//
// 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(0x71, scale_freq(Frequency));
BK4819_SetAF(bLocalLoopback ? BK4819_AF_BEEP : BK4819_AF_MUTE);
if (bLocalLoopback)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
BK4819_EnableTXLink();
SYSTEM_DelayMs(50);
BK4819_ExitTxMute();
}
void BK4819_start_tone(const uint16_t frequency, const unsigned int level, const bool tx, const bool tx_mute) void BK4819_start_tone(const uint16_t frequency, const unsigned int level, const bool tx, const bool tx_mute)
{ {
SYSTEM_DelayMs(1); SYSTEM_DelayMs(1);
@ -884,7 +923,6 @@ void BK4819_start_tone(const uint16_t frequency, const unsigned int level, const
BK4819_write_reg(0x70, BK4819_REG_70_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); BK4819_write_reg(0x70, BK4819_REG_70_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_write_reg(0x30, 0); BK4819_write_reg(0x30, 0);
if (!tx) if (!tx)
{ {
BK4819_write_reg(0x30, BK4819_write_reg(0x30,
@ -934,6 +972,10 @@ void BK4819_start_tone(const uint16_t frequency, const unsigned int level, const
void BK4819_stop_tones(const bool tx) void BK4819_stop_tones(const bool tx)
{ {
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf("stop tones\n");
#endif
SYSTEM_DelayMs(1); SYSTEM_DelayMs(1);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
@ -1294,42 +1336,6 @@ void BK4819_PlayDTMFString(const char *pString, bool bDelayFirst, uint16_t First
} }
} }
void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency)
{
BK4819_EnterTxMute();
// REG_70
//
// <15> 0 Enable TONE1
// 1 = Enable
// 0 = Disable
//
// <14:8> 0 TONE1 tuning gain
// 0 ~ 127
//
// <7> 0 Enable TONE2
// 1 = Enable
// 0 = Disable
//
// <6:0> 0 TONE2/FSK amplitude
// 0 ~ 127
//
// 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(0x71, scale_freq(Frequency));
BK4819_SetAF(bLocalLoopback ? BK4819_AF_BEEP : BK4819_AF_MUTE);
BK4819_EnableTXLink();
SYSTEM_DelayMs(50);
BK4819_ExitTxMute();
}
void BK4819_disable_sub_audible(void) void BK4819_disable_sub_audible(void)
{ {
BK4819_write_reg(0x51, 0); BK4819_write_reg(0x51, 0);

Binary file not shown.

Binary file not shown.

View File

@ -185,7 +185,7 @@ void FUNCTION_Select(function_type_t Function)
g_rtte_count_down = 0; g_rtte_count_down = 0;
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || (ENABLE_TX_TONE_HZ > 0)
if (g_alarm_state == ALARM_STATE_OFF) if (g_alarm_state == ALARM_STATE_OFF)
#endif #endif
{ {
@ -245,15 +245,15 @@ void FUNCTION_Select(function_type_t Function)
// UART_printf("function tx %u %s\r\n", g_dtmf_reply_state, g_dtmf_string); // UART_printf("function tx %u %s\r\n", g_dtmf_reply_state, g_dtmf_string);
#endif #endif
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || (ENABLE_TX_TONE_HZ > 0)
if (g_alarm_state != ALARM_STATE_OFF) if (g_alarm_state != ALARM_STATE_OFF)
{ {
#ifdef ENABLE_TX1750 #if (ENABLE_TX_TONE_HZ > 0)
if (g_alarm_state == ALARM_STATE_TX1750) if (g_alarm_state == ALARM_STATE_TX_TONE)
BK4819_TransmitTone(true, 1750); BK4819_TransmitTone(true, ENABLE_TX_TONE_HZ);
#endif #endif
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (g_alarm_state == ALARM_STATE_TXALARM) if (g_alarm_state == ALARM_STATE_TX_ALARM)
BK4819_TransmitTone(true, 500); BK4819_TransmitTone(true, 500);
#endif #endif
@ -264,6 +264,11 @@ void FUNCTION_Select(function_type_t Function)
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
g_alarm_tone_counter_10ms = 0; g_alarm_tone_counter_10ms = 0;
#endif #endif
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("tx tone %u\n", ENABLE_TX_TONE_HZ);
#endif
break; break;
} }
else else

8
misc.c
View File

@ -143,7 +143,7 @@ uint8_t g_vfo_rssi_bar_level[2];
uint8_t g_reduced_service; uint8_t g_reduced_service;
uint8_t g_battery_voltage_index; uint8_t g_battery_voltage_index;
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX_TONE_HZ)
alarm_state_t g_alarm_state; alarm_state_t g_alarm_state;
#endif #endif
uint16_t g_menu_tick_10ms; uint16_t g_menu_tick_10ms;
@ -206,10 +206,8 @@ scan_state_dir_t g_scan_state_dir;
uint8_t g_rx_vfo_num; uint8_t g_rx_vfo_num;
bool g_rx_vfo_is_active; bool g_rx_vfo_is_active;
#ifdef ENABLE_ALARM uint16_t g_alarm_tone_counter_10ms;
uint16_t g_alarm_tone_counter_10ms; uint16_t g_alarm_running_counter_10ms;
uint16_t g_alarm_running_counter_10ms;
#endif
uint8_t g_menu_list_count; uint8_t g_menu_list_count;

4
misc.h
View File

@ -83,9 +83,9 @@ enum {
enum alarm_state_e { enum alarm_state_e {
ALARM_STATE_OFF = 0, ALARM_STATE_OFF = 0,
ALARM_STATE_TXALARM, ALARM_STATE_TX_ALARM,
ALARM_STATE_ALARM, ALARM_STATE_ALARM,
ALARM_STATE_TX1750 ALARM_STATE_TX_TONE
}; };
typedef enum alarm_state_e alarm_state_t; typedef enum alarm_state_e alarm_state_t;

View File

@ -1081,7 +1081,7 @@ void RADIO_PrepareTX(void)
vfo_state_t State = VFO_STATE_NORMAL; // default to OK for TX vfo_state_t State = VFO_STATE_NORMAL; // default to OK for TX
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (g_alarm_state == ALARM_STATE_TXALARM && g_eeprom.config.setting.alarm_mode != ALARM_MODE_TONE) if (g_alarm_state == ALARM_STATE_TX_ALARM && g_eeprom.config.setting.alarm_mode != ALARM_MODE_TONE)
{ // enable the alarm tone but not the TX { // enable the alarm tone but not the TX
g_alarm_state = ALARM_STATE_ALARM; g_alarm_state = ALARM_STATE_ALARM;
@ -1154,7 +1154,7 @@ void RADIO_PrepareTX(void)
RADIO_set_vfo_state(State); RADIO_set_vfo_state(State);
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || (ENABLE_TX_TONE_HZ > 0)
g_alarm_state = ALARM_STATE_OFF; g_alarm_state = ALARM_STATE_OFF;
#endif #endif
@ -1233,7 +1233,7 @@ void RADIO_PrepareCssTX(void)
void RADIO_tx_eot(void) void RADIO_tx_eot(void)
{ {
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || (ENABLE_TX_TONE_HZ > 0)
if (g_alarm_state != ALARM_STATE_OFF) if (g_alarm_state != ALARM_STATE_OFF)
{ // don't send EOT if TX'ing tone/alarm { // don't send EOT if TX'ing tone/alarm
BK4819_ExitDTMF_TX(true); BK4819_ExitDTMF_TX(true);

View File

@ -448,7 +448,7 @@ void SETTINGS_save(void)
memset(&g_eeprom.config.setting.power_on_password, 0xff, sizeof(g_eeprom.config.setting.power_on_password)); memset(&g_eeprom.config.setting.power_on_password, 0xff, sizeof(g_eeprom.config.setting.power_on_password));
#endif #endif
#if !defined(ENABLE_ALARM) && !defined(ENABLE_TX1750) #if !defined(ENABLE_ALARM) && (!defined(ENABLE_TX_TONE_HZ) || (ENABLE_TX_TONE_HZ == 0))
g_eeprom.config.setting.alarm_mode = 0; g_eeprom.config.setting.alarm_mode = 0;
#endif #endif

View File

@ -102,7 +102,7 @@ enum {
ACTION_OPT_VOX, ACTION_OPT_VOX,
ACTION_OPT_ALARM, ACTION_OPT_ALARM,
ACTION_OPT_FM, ACTION_OPT_FM,
ACTION_OPT_1750, ACTION_OPT_TX_TONE,
ACTION_OPT_LEN ACTION_OPT_LEN
}; };

View File

@ -114,7 +114,7 @@ void draw_bar(uint8_t *line, const int len, const int max_width)
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE) if (g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return false; return false;
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || (ENABLE_TX_TONE_HZ > 0)
if (g_alarm_state != ALARM_STATE_OFF) if (g_alarm_state != ALARM_STATE_OFF)
return false; return false;
#endif #endif

View File

@ -401,7 +401,7 @@ const char g_sub_menu_side_butt[9][16] =
"VOX\non\\off", "VOX\non\\off",
"ALARM\non\\off", "ALARM\non\\off",
"FM RADIO\non\\off", "FM RADIO\non\\off",
"TX\n1750Hz", "TX\nTONE",
// "2nd PTT", // "2nd PTT",
}; };
#endif #endif
@ -1192,6 +1192,10 @@ void UI_DisplayMenu(void)
case MENU_SIDE2_SHORT: case MENU_SIDE2_SHORT:
case MENU_SIDE2_LONG: case MENU_SIDE2_LONG:
strcpy(str, g_sub_menu_side_butt[g_sub_menu_selection]); strcpy(str, g_sub_menu_side_butt[g_sub_menu_selection]);
#if defined(ENABLE_TX_TONE_HZ) && (ENABLE_TX_TONE_HZ > 0)
if (g_sub_menu_selection == ACTION_OPT_TX_TONE)
sprintf(str + strlen(str), "\n%uHz", ENABLE_TX_TONE_HZ);
#endif
break; break;
#endif #endif