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

added DTMF call/page compile option

This commit is contained in:
OneOfEleven
2023-12-08 14:04:02 +00:00
parent 0a9000a34c
commit 8084a92c39
21 changed files with 979 additions and 779 deletions

View File

@ -207,7 +207,9 @@ void ACTION_Scan(bool bRestart)
g_monitor_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
DTMF_clear_RX();
#ifdef ENABLE_DTMF_CALLING
DTMF_clear_RX();
#endif
#ifdef ENABLE_DTMF_LIVE_DECODER
g_dtmf_rx_live_timeout = 0;

182
app/app.c
View File

@ -198,8 +198,10 @@ static void APP_process_new_receive(void)
if (!g_squelch_open && !g_monitor_enabled)
{ // squelch is closed
if (g_dtmf_rx_index > 0)
DTMF_clear_RX();
#ifdef ENABLE_DTMF_CALLING
if (g_dtmf_rx_index > 0)
DTMF_clear_RX();
#endif
if (g_current_function != FUNCTION_FOREGROUND)
{
@ -250,10 +252,11 @@ static void APP_process_new_receive(void)
return;
}
#ifdef ENABLE_DTMF_CALLING
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && g_css_scan_mode == CSS_SCAN_MODE_OFF)
{ // not scanning
#ifdef ENABLE_KILL_REVIVE
#ifdef ENABLE_DTMF_KILL_REVIVE
if (g_rx_vfo->channel.dtmf_decoding_enable || g_eeprom.config.setting.radio_disabled)
#else
if (g_rx_vfo->channel.dtmf_decoding_enable)
@ -276,6 +279,7 @@ static void APP_process_new_receive(void)
}
}
}
#endif
APP_start_listening();
}
@ -487,10 +491,12 @@ bool APP_start_listening(void)
const unsigned int chan = g_rx_vfo_num;
// const unsigned int chan = g_rx_vfo->channel_save;
#ifdef ENABLE_KILL_REVIVE
#ifdef ENABLE_DTMF_CALLING
#ifdef ENABLE_DTMF_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
return false;
#endif
#endif
if (g_squelch_open)
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // green LED on
@ -882,8 +888,10 @@ static bool APP_toggle_dual_watch_vfo(void)
return false;
if (g_ptt_is_pressed)
return false;
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return false;
#ifdef ENABLE_DTMF_CALLING
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return false;
#endif
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode)
return false;
@ -1024,24 +1032,26 @@ void APP_process_radio_interrupts(void)
}
#endif
#ifdef ENABLE_KILL_REVIVE
if (g_rx_vfo->channel.dtmf_decoding_enable || g_eeprom.config.setting.radio_disabled)
#else
if (g_rx_vfo->channel.dtmf_decoding_enable)
#endif
{
if (g_dtmf_rx_index >= (sizeof(g_dtmf_rx) - 1))
{ // make room
memmove(&g_dtmf_rx[0], &g_dtmf_rx[1], sizeof(g_dtmf_rx) - 1);
g_dtmf_rx_index--;
#ifdef ENABLE_DTMF_CALLING
#ifdef ENABLE_DTMF_KILL_REVIVE
if (g_rx_vfo->channel.dtmf_decoding_enable || g_eeprom.config.setting.radio_disabled)
#else
if (g_rx_vfo->channel.dtmf_decoding_enable)
#endif
{
if (g_dtmf_rx_index >= (sizeof(g_dtmf_rx) - 1))
{ // make room
memmove(&g_dtmf_rx[0], &g_dtmf_rx[1], sizeof(g_dtmf_rx) - 1);
g_dtmf_rx_index--;
}
g_dtmf_rx[g_dtmf_rx_index++] = c;
g_dtmf_rx[g_dtmf_rx_index] = 0;
g_dtmf_rx_timeout = dtmf_rx_timeout_500ms; // time till we delete it
g_dtmf_rx_pending = true;
DTMF_HandleRequest();
}
g_dtmf_rx[g_dtmf_rx_index++] = c;
g_dtmf_rx[g_dtmf_rx_index] = 0;
g_dtmf_rx_timeout = dtmf_rx_timeout_500ms; // time till we delete it
g_dtmf_rx_pending = true;
DTMF_HandleRequest();
}
#endif
}
}
@ -1272,9 +1282,11 @@ void APP_end_tx(void)
g_update_status = true;
#ifdef ENABLE_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
return;
#ifdef ENABLE_DTMF_CALLING
#ifdef ENABLE_DTMF_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
return;
#endif
#endif
if (!g_eeprom.config.setting.tx_enable)
@ -1319,9 +1331,11 @@ void APP_process_keys(void)
key_code_t key;
#ifdef ENABLE_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
return;
#ifdef ENABLE_DTMF_CALLING
#ifdef ENABLE_DTMF_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
return;
#endif
#endif
// *****************
@ -1345,7 +1359,7 @@ void APP_process_keys(void)
if (g_current_display_screen != DISPLAY_AIRCOPY)
#endif
{
#ifdef ENABLE_KILL_REVIVE
#if defined(ENABLE_DTMF_CALLING) && defined(ENABLE_DTMF_KILL_REVIVE)
if (!g_eeprom.config.setting.radio_disabled)
#endif
{
@ -1929,7 +1943,9 @@ void APP_process_power_save(void)
g_scan_state_dir != SCAN_STATE_DIR_OFF ||
g_css_scan_mode != CSS_SCAN_MODE_OFF ||
g_current_display_screen != DISPLAY_MAIN ||
g_dtmf_call_state != DTMF_CALL_STATE_NONE ||
#ifdef ENABLE_DTMF_CALLING
g_dtmf_call_state != DTMF_CALL_STATE_NONE ||
#endif
g_flash_light_state == FLASHLIGHT_SOS)
{
power_save = false;
@ -2129,9 +2145,11 @@ void APP_time_slice_500ms(void)
if (--g_menu_tick_10ms == 0)
exit_menu = (g_current_display_screen == DISPLAY_MENU); // exit menu mode
if (g_dtmf_rx_timeout > 0)
if (--g_dtmf_rx_timeout == 0)
DTMF_clear_RX();
#ifdef ENABLE_DTMF_CALLING
if (g_dtmf_rx_timeout > 0)
if (--g_dtmf_rx_timeout == 0)
DTMF_clear_RX();
#endif
#ifdef ENABLE_FMRADIO
if (g_fm_radio_tick_500ms > 0)
@ -2350,48 +2368,50 @@ void APP_time_slice_500ms(void)
return;
#endif
if (g_current_function != FUNCTION_TRANSMIT)
{
if (g_dtmf_decode_ring_tick_500ms > 0)
{ // make "ring-ring" sound
g_dtmf_decode_ring_tick_500ms--;
#ifdef ENABLE_DTMF_CALL_FLASH_LIGHT
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); // light on
#endif
AUDIO_PlayBeep(BEEP_880HZ_200MS);
#ifdef ENABLE_DTMF_CALL_FLASH_LIGHT
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); // light off
#endif
}
}
else
g_dtmf_decode_ring_tick_500ms = 0;
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE &&
g_current_function != FUNCTION_TRANSMIT &&
g_current_function != FUNCTION_RECEIVE)
{
if (g_dtmf_auto_reset_time_500ms > 0)
#ifdef ENABLE_DTMF_CALLING
if (g_current_function != FUNCTION_TRANSMIT)
{
if (--g_dtmf_auto_reset_time_500ms == 0)
{
if (g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED && g_eeprom.config.setting.dtmf.auto_reset_time >= DTMF_HOLD_MAX)
g_dtmf_call_state = DTMF_CALL_STATE_RECEIVED_STAY; // keep message on-screen till a key is pressed
else
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_update_display = true;
if (g_dtmf_decode_ring_tick_500ms > 0)
{ // make "ring-ring" sound
g_dtmf_decode_ring_tick_500ms--;
#ifdef ENABLE_DTMF_CALL_FLASH_LIGHT
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); // light on
#endif
AUDIO_PlayBeep(BEEP_880HZ_200MS);
#ifdef ENABLE_DTMF_CALL_FLASH_LIGHT
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); // light off
#endif
}
}
else
g_dtmf_decode_ring_tick_500ms = 0;
// if (g_dtmf_call_state != DTMF_CALL_STATE_RECEIVED_STAY)
// {
// g_dtmf_call_state = DTMF_CALL_STATE_NONE;
// g_update_display = true;
// }
}
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE &&
g_current_function != FUNCTION_TRANSMIT &&
g_current_function != FUNCTION_RECEIVE)
{
if (g_dtmf_auto_reset_time_500ms > 0)
{
if (--g_dtmf_auto_reset_time_500ms == 0)
{
if (g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED && g_eeprom.config.setting.dtmf.auto_reset_time >= DTMF_HOLD_MAX)
g_dtmf_call_state = DTMF_CALL_STATE_RECEIVED_STAY; // keep message on-screen till a key is pressed
else
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_update_display = true;
}
}
// if (g_dtmf_call_state != DTMF_CALL_STATE_RECEIVED_STAY)
// {
// g_dtmf_call_state = DTMF_CALL_STATE_NONE;
// g_update_display = true;
// }
}
#endif
if (g_dtmf_is_tx && g_dtmf_tx_stop_tick_500ms > 0)
{
@ -2636,7 +2656,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
#ifdef ENABLE_AIRCOPY
if (g_current_display_screen == DISPLAY_AIRCOPY)
{
AIRCOPY_process_key(key, key_pressed, key_held);
AIRCOPY_process_key(Key, key_pressed, key_held);
return;
}
#endif
@ -2755,8 +2775,10 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
g_menu_tick_10ms = menu_timeout_500ms;
// cancel the ringing
if (key_pressed && g_dtmf_decode_ring_tick_500ms > 0)
g_dtmf_decode_ring_tick_500ms = 0;
#ifdef ENABLE_DTMF_CALLING
if (key_pressed && g_dtmf_decode_ring_tick_500ms > 0)
g_dtmf_decode_ring_tick_500ms = 0;
#endif
// ********************
@ -3063,10 +3085,12 @@ Skip:
// g_tx_vfo->freq_in_channel = SETTINGS_find_channel(frequency);
g_dtmf_auto_reset_time_500ms = 0;
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_dtmf_tx_stop_tick_500ms = 0;
g_dtmf_is_tx = false;
#ifdef ENABLE_DTMF_CALLING
g_dtmf_auto_reset_time_500ms = 0;
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
#endif
g_dtmf_tx_stop_tick_500ms = 0;
g_dtmf_is_tx = false;
g_vfo_rssi_bar_level[0] = 0;
g_vfo_rssi_bar_level[1] = 0;

View File

@ -41,38 +41,43 @@ uint8_t g_dtmf_input_box_index;
bool g_dtmf_input_mode;
uint8_t g_dtmf_prev_index;
char g_dtmf_rx[17];
uint8_t g_dtmf_rx_index;
uint8_t g_dtmf_rx_timeout;
bool g_dtmf_rx_pending;
#ifdef ENABLE_DTMF_LIVE_DECODER
char g_dtmf_rx_live[20];
uint8_t g_dtmf_rx_live_timeout;
#endif
bool g_dtmf_is_contact_valid;
char g_dtmf_id[4];
char g_dtmf_caller[4];
char g_dtmf_callee[4];
dtmf_state_t g_dtmf_state;
uint8_t g_dtmf_decode_ring_tick_500ms;
uint8_t g_dtmf_chosen_contact;
uint8_t g_dtmf_auto_reset_time_500ms;
dtmf_call_state_t g_dtmf_call_state;
dtmf_reply_state_t g_dtmf_reply_state;
dtmf_call_mode_t g_dtmf_call_mode;
bool g_dtmf_is_tx;
uint8_t g_dtmf_tx_stop_tick_500ms;
bool g_dtmf_IsGroupCall;
#ifdef ENABLE_DTMF_CALLING
char g_dtmf_rx[17];
uint8_t g_dtmf_rx_index;
uint8_t g_dtmf_rx_timeout;
bool g_dtmf_rx_pending;
bool g_dtmf_is_contact_valid;
char g_dtmf_id[4];
char g_dtmf_caller[4];
char g_dtmf_callee[4];
dtmf_state_t g_dtmf_state;
uint8_t g_dtmf_decode_ring_tick_500ms;
uint8_t g_dtmf_chosen_contact;
uint8_t g_dtmf_auto_reset_time_500ms;
dtmf_call_state_t g_dtmf_call_state;
dtmf_call_mode_t g_dtmf_call_mode;
bool g_dtmf_IsGroupCall;
#endif
void DTMF_clear_RX(void)
{
g_dtmf_rx_timeout = 0;
g_dtmf_rx_index = 0;
g_dtmf_rx_pending = false;
memset(g_dtmf_rx, 0, sizeof(g_dtmf_rx));
}
dtmf_reply_state_t g_dtmf_reply_state;
bool g_dtmf_is_tx;
uint8_t g_dtmf_tx_stop_tick_500ms;
#ifdef ENABLE_DTMF_CALLING
void DTMF_clear_RX(void)
{
g_dtmf_rx_timeout = 0;
g_dtmf_rx_index = 0;
g_dtmf_rx_pending = false;
memset(g_dtmf_rx, 0, sizeof(g_dtmf_rx));
}
#endif
bool DTMF_ValidateCodes(char *pCode, const unsigned int size)
{
@ -96,44 +101,46 @@ bool DTMF_ValidateCodes(char *pCode, const unsigned int size)
return true;
}
bool DTMF_GetContact(const int Index, char *pContact)
{
int i = -1;
if (Index >= 0 && Index < (int)ARRAY_SIZE(g_eeprom.config.dtmf_contact))
#ifdef ENABLE_DTMF_CALLING
bool DTMF_GetContact(const int Index, char *pContact)
{
memcpy(pContact, &g_eeprom.config.dtmf_contact[Index], 16);
// EEPROM_ReadBuffer(0x1C00 + (Index * 16), pContact, 16);
i = (int)pContact[0] - ' ';
}
return (i < 0 || i >= 95) ? false : true;
}
bool DTMF_FindContact(const char *pContact, char *pResult)
{
char Contact[16];
unsigned int i;
for (i = 0; i < MAX_DTMF_CONTACTS; i++)
{
unsigned int j;
if (!DTMF_GetContact(i, Contact))
return false;
for (j = 0; j < 3; j++)
if (pContact[j] != Contact[j + 8])
break;
if (j == 3)
int i = -1;
if (Index >= 0 && Index < (int)ARRAY_SIZE(g_eeprom.config.dtmf_contact))
{
memcpy(pResult, Contact, 8);
pResult[8] = 0;
return true;
memcpy(pContact, &g_eeprom.config.dtmf_contact[Index], 16);
// EEPROM_ReadBuffer(0x1C00 + (Index * 16), pContact, 16);
i = (int)pContact[0] - ' ';
}
return (i < 0 || i >= 95) ? false : true;
}
return false;
}
bool DTMF_FindContact(const char *pContact, char *pResult)
{
char Contact[16];
unsigned int i;
for (i = 0; i < MAX_DTMF_CONTACTS; i++)
{
unsigned int j;
if (!DTMF_GetContact(i, Contact))
return false;
for (j = 0; j < 3; j++)
if (pContact[j] != Contact[j + 8])
break;
if (j == 3)
{
memcpy(pResult, Contact, 8);
pResult[8] = 0;
return true;
}
}
return false;
}
#endif
char DTMF_GetCharacter(const unsigned int code)
{
@ -159,31 +166,33 @@ char DTMF_GetCharacter(const unsigned int code)
}
}
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
{
unsigned int i;
for (i = 0; i < size; i++)
#ifdef ENABLE_DTMF_CALLING
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
{
if (pMsg[i] != pTemplate[i])
unsigned int i;
for (i = 0; i < size; i++)
{
if (!bCheckGroup || pMsg[i] != g_eeprom.config.setting.dtmf.group_call_code)
return false;
g_dtmf_IsGroupCall = true;
if (pMsg[i] != pTemplate[i])
{
if (!bCheckGroup || pMsg[i] != g_eeprom.config.setting.dtmf.group_call_code)
return false;
g_dtmf_IsGroupCall = true;
}
}
return true;
}
return true;
}
dtmf_call_mode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
{
unsigned int i;
for (i = 0; i < size; i++)
if (pMsg[i] == g_eeprom.config.setting.dtmf.group_call_code)
break;
return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
}
dtmf_call_mode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
{
unsigned int i;
for (i = 0; i < size; i++)
if (pMsg[i] == g_eeprom.config.setting.dtmf.group_call_code)
break;
return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
}
#endif
void DTMF_clear_input_box(void)
{
@ -204,236 +213,249 @@ void DTMF_Append(const char code)
g_dtmf_input_box[g_dtmf_input_box_index++] = code;
}
void DTMF_HandleRequest(void)
{ // proccess the RX'ed DTMF characters
char String[21];
unsigned int Offset;
if (!g_dtmf_rx_pending)
return; // nothing new received
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || g_css_scan_mode != CSS_SCAN_MODE_OFF)
{ // we're busy scanning
DTMF_clear_RX();
return;
}
#ifdef ENABLE_KILL_REVIVE
if (!g_rx_vfo->channel.dtmf_decoding_enable && !g_eeprom.config.setting.radio_disabled)
#else
if (!g_rx_vfo->channel.dtmf_decoding_enable)
#endif
{ // D-DCD is disabled or we're enabled
DTMF_clear_RX();
return;
}
g_dtmf_rx_pending = false;
#ifdef ENABLE_KILL_REVIVE
if (g_dtmf_rx_index >= 9)
{ // look for the RADIO DISABLE code
#ifdef ENABLE_DTMF_CALLING
void DTMF_HandleRequest(void)
{ // proccess the RX'ed DTMF characters
sprintf(String, "%s%c%s", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code, g_eeprom.config.setting.dtmf.kill_code);
char String[21];
unsigned int Offset;
Offset = g_dtmf_rx_index - strlen(String);
if (!g_dtmf_rx_pending)
return; // nothing new received
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
{ // bugger
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || g_css_scan_mode != CSS_SCAN_MODE_OFF)
{ // we're busy scanning
DTMF_clear_RX();
return;
}
if (g_eeprom.config.setting.dtmf.permit_remote_kill != 0)
{
g_eeprom.config.setting.radio_disabled = true; // :(
#ifdef ENABLE_DTMF_KILL_REVIVE
if (!g_rx_vfo->channel.dtmf_decoding_enable && !g_eeprom.config.setting.radio_disabled)
#else
if (!g_rx_vfo->channel.dtmf_decoding_enable)
#endif
{ // D-DCD is disabled or we're enabled
DTMF_clear_RX();
return;
}
g_dtmf_rx_pending = false;
#ifdef ENABLE_DTMF_KILL_REVIVE
if (g_dtmf_rx_index >= 9)
{ // look for the RADIO DISABLE code
sprintf(String, "%s%c%s", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code, g_eeprom.config.setting.dtmf.kill_code);
Offset = g_dtmf_rx_index - strlen(String);
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
{ // bugger
if (g_eeprom.config.setting.dtmf.permit_remote_kill != 0)
{
g_eeprom.config.setting.radio_disabled = true; // :(
DTMF_clear_RX();
SETTINGS_save();
g_dtmf_reply_state = DTMF_REPLY_AB;
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode)
{
FM_turn_off();
GUI_SelectNextDisplay(DISPLAY_MAIN);
}
#endif
}
else
{
g_dtmf_reply_state = DTMF_REPLY_NONE;
}
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_update_display = true;
g_update_status = true;
return;
}
}
if (g_dtmf_rx_index >= 9)
{ // look for the REVIVE code
sprintf(String, "%s%c%s", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code, g_eeprom.config.setting.dtmf.revive_code);
Offset = g_dtmf_rx_index - strlen(String);
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
{ // shit, we're back !
g_eeprom.config.setting.radio_disabled = false;
DTMF_clear_RX();
SETTINGS_save();
g_dtmf_reply_state = DTMF_REPLY_AB;
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode)
{
FM_turn_off();
GUI_SelectNextDisplay(DISPLAY_MAIN);
}
#endif
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_update_display = true;
g_update_status = true;
return;
}
else
{
g_dtmf_reply_state = DTMF_REPLY_NONE;
}
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_update_display = true;
g_update_status = true;
return;
}
}
if (g_dtmf_rx_index >= 9)
{ // look for the REVIVE code
#endif
sprintf(String, "%s%c%s", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code, g_eeprom.config.setting.dtmf.revive_code);
if (g_dtmf_rx_index >= 2)
{ // look for ACK reply
strcpy(String, "AB");
Offset = g_dtmf_rx_index - strlen(String);
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
{ // shit, we're back !
{ // ends with "AB"
g_eeprom.config.setting.radio_disabled = false;
DTMF_clear_RX();
SETTINGS_save();
g_dtmf_reply_state = DTMF_REPLY_AB;
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_update_display = true;
g_update_status = true;
return;
if (g_dtmf_reply_state != DTMF_REPLY_NONE) // 1of11
// if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT) // 1of11
{
g_dtmf_state = DTMF_STATE_TX_SUCC;
DTMF_clear_RX();
g_update_display = true;
return;
}
}
}
#endif
if (g_dtmf_rx_index >= 2)
{ // look for ACK reply
strcpy(String, "AB");
Offset = g_dtmf_rx_index - strlen(String);
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
{ // ends with "AB"
if (g_dtmf_reply_state != DTMF_REPLY_NONE) // 1of11
// if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT) // 1of11
{
g_dtmf_state = DTMF_STATE_TX_SUCC;
if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT &&
g_dtmf_call_mode == DTMF_CALL_MODE_NOT_GROUP &&
g_dtmf_rx_index >= 9)
{ // waiting for a reply
sprintf(String, "%s%c%s", g_dtmf_string, g_eeprom.config.setting.dtmf.separate_code, "AAAAA");
Offset = g_dtmf_rx_index - strlen(String);
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), false))
{ // we got a response
g_dtmf_state = DTMF_STATE_CALL_OUT_RSP;
DTMF_clear_RX();
g_update_display = true;
return;
}
}
}
if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT &&
g_dtmf_call_mode == DTMF_CALL_MODE_NOT_GROUP &&
g_dtmf_rx_index >= 9)
{ // waiting for a reply
sprintf(String, "%s%c%s", g_dtmf_string, g_eeprom.config.setting.dtmf.separate_code, "AAAAA");
Offset = g_dtmf_rx_index - strlen(String);
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), false))
{ // we got a response
g_dtmf_state = DTMF_STATE_CALL_OUT_RSP;
DTMF_clear_RX();
g_update_display = true;
}
}
#ifdef ENABLE_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
return; // we've been disabled
#endif
if (g_dtmf_rx_index >= 7)
{ // see if we're being called
g_dtmf_IsGroupCall = false;
sprintf(String, "%s%c", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code);
Offset = g_dtmf_rx_index - strlen(String) - 3;
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
{ // it's for us !
g_dtmf_call_state = DTMF_CALL_STATE_RECEIVED;
memset(g_dtmf_callee, 0, sizeof(g_dtmf_callee));
memset(g_dtmf_caller, 0, sizeof(g_dtmf_caller));
memcpy(g_dtmf_callee, g_dtmf_rx + Offset + 0, 3);
memcpy(g_dtmf_caller, g_dtmf_rx + Offset + 4, 3);
DTMF_clear_RX();
g_update_display = true;
switch (g_eeprom.config.setting.dtmf.decode_response)
{
case DTMF_DEC_RESPONSE_BOTH:
g_dtmf_decode_ring_tick_500ms = dtmf_decode_ring_500ms;
// Fallthrough
case DTMF_DEC_RESPONSE_REPLY:
g_dtmf_reply_state = DTMF_REPLY_AAAAA;
break;
case DTMF_DEC_RESPONSE_RING:
g_dtmf_decode_ring_tick_500ms = dtmf_decode_ring_500ms;
break;
default:
case DTMF_DEC_RESPONSE_NONE:
g_dtmf_decode_ring_tick_500ms = 0;
#ifdef ENABLE_DTMF_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
return; // we've been disabled
#endif
if (g_dtmf_rx_index >= 7)
{ // see if we're being called
g_dtmf_IsGroupCall = false;
sprintf(String, "%s%c", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code);
Offset = g_dtmf_rx_index - strlen(String) - 3;
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
{ // it's for us !
g_dtmf_call_state = DTMF_CALL_STATE_RECEIVED;
memset(g_dtmf_callee, 0, sizeof(g_dtmf_callee));
memset(g_dtmf_caller, 0, sizeof(g_dtmf_caller));
memcpy(g_dtmf_callee, g_dtmf_rx + Offset + 0, 3);
memcpy(g_dtmf_caller, g_dtmf_rx + Offset + 4, 3);
DTMF_clear_RX();
g_update_display = true;
switch (g_eeprom.config.setting.dtmf.decode_response)
{
case DTMF_DEC_RESPONSE_BOTH:
g_dtmf_decode_ring_tick_500ms = dtmf_decode_ring_500ms;
// Fallthrough
case DTMF_DEC_RESPONSE_REPLY:
g_dtmf_reply_state = DTMF_REPLY_AAAAA;
break;
case DTMF_DEC_RESPONSE_RING:
g_dtmf_decode_ring_tick_500ms = dtmf_decode_ring_500ms;
break;
default:
case DTMF_DEC_RESPONSE_NONE:
g_dtmf_decode_ring_tick_500ms = 0;
g_dtmf_reply_state = DTMF_REPLY_NONE;
break;
}
if (g_dtmf_IsGroupCall)
g_dtmf_reply_state = DTMF_REPLY_NONE;
break;
}
if (g_dtmf_IsGroupCall)
g_dtmf_reply_state = DTMF_REPLY_NONE;
}
}
}
#endif
bool DTMF_Reply(void)
{
const uint16_t delay_ms = ((g_eeprom.config.setting.dtmf.preload_time < 15) ? 15 : g_eeprom.config.setting.dtmf.preload_time) * 10;
const char *pString = NULL;
char str[23];
#ifdef ENABLE_DTMF_CALLING
char str[23];
#endif
switch (g_dtmf_reply_state)
{
case DTMF_REPLY_ANI:
case DTMF_REPLY_STR:
pString = g_dtmf_string;
break;
if (g_dtmf_call_mode != DTMF_CALL_MODE_DTMF)
{ // append our ID code onto the end of the DTMF code to send
sprintf(str, "%s%c%s", g_dtmf_string, g_eeprom.config.setting.dtmf.separate_code, g_eeprom.config.setting.dtmf.ani_id);
#ifdef ENABLE_DTMF_CALLING
case DTMF_REPLY_ANI:
pString = g_dtmf_string;
if (g_dtmf_call_mode != DTMF_CALL_MODE_DTMF)
{ // append our ID code onto the end of the DTMF code to send
sprintf(str, "%s%c%s", g_dtmf_string, g_eeprom.config.setting.dtmf.separate_code, g_eeprom.config.setting.dtmf.ani_id);
pString = str;
}
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("dtmf tx reply ani %s\r\n", pString);
#endif
break;
case DTMF_REPLY_AB:
pString = "AB";
break;
case DTMF_REPLY_AAAAA:
sprintf(str, "%s%c%s", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code, "AAAAA");
pString = str;
}
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("dtmf tx reply ani %s\r\n", pString);
#endif
break;
case DTMF_REPLY_AB:
pString = "AB";
break;
case DTMF_REPLY_AAAAA:
sprintf(str, "%s%c%s", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code, "AAAAA");
pString = str;
break;
break;
case DTMF_REPLY_NONE:
#endif
default:
case DTMF_REPLY_NONE:
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("dtmf tx reply none %s\r\n", g_dtmf_string);
#endif
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE ||
g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_APOLLO ||
g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_OFF ||
g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_EOT)
if (
#ifdef ENABLE_DTMF_CALLING
g_dtmf_call_state != DTMF_CALL_STATE_NONE ||
#endif
g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_APOLLO ||
g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_OFF ||
g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_EOT)
{
g_dtmf_reply_state = DTMF_REPLY_NONE;
return false;
@ -446,7 +468,7 @@ bool DTMF_Reply(void)
g_dtmf_reply_state = DTMF_REPLY_NONE;
if (pString == NULL)
if (pString == NULL || strlen(pString) == 0)
return false;
if (g_eeprom.config.setting.dtmf.side_tone)

View File

@ -20,7 +20,7 @@
#include <stdbool.h>
#include <stdint.h>
#define MAX_DTMF_CONTACTS 16
#define MAX_DTMF_CONTACTS 16
enum { // seconds
DTMF_HOLD_MIN = 5,
@ -34,36 +34,45 @@ enum dtmf_state_e {
};
typedef enum dtmf_state_e dtmf_state_t;
enum dtmf_call_state_e {
DTMF_CALL_STATE_NONE = 0,
DTMF_CALL_STATE_CALL_OUT,
DTMF_CALL_STATE_RECEIVED,
DTMF_CALL_STATE_RECEIVED_STAY
};
typedef enum dtmf_call_state_e dtmf_call_state_t;
#ifdef ENABLE_DTMF_CALLING
enum dtmf_call_state_e {
DTMF_CALL_STATE_NONE = 0,
DTMF_CALL_STATE_CALL_OUT,
DTMF_CALL_STATE_RECEIVED,
DTMF_CALL_STATE_RECEIVED_STAY
};
typedef enum dtmf_call_state_e dtmf_call_state_t;
enum dtmf_decode_response_e {
DTMF_DEC_RESPONSE_NONE = 0,
DTMF_DEC_RESPONSE_RING,
DTMF_DEC_RESPONSE_REPLY,
DTMF_DEC_RESPONSE_BOTH
};
typedef enum dtmf_decode_response_e dtmf_decode_response_t;
enum dtmf_reply_state_e {
DTMF_REPLY_NONE = 0,
DTMF_REPLY_STR,
DTMF_REPLY_ANI,
DTMF_REPLY_AB,
DTMF_REPLY_AAAAA
};
typedef enum dtmf_reply_state_e dtmf_reply_state_t;
enum dtmf_decode_response_e {
DTMF_DEC_RESPONSE_NONE = 0,
DTMF_DEC_RESPONSE_RING,
DTMF_DEC_RESPONSE_REPLY,
DTMF_DEC_RESPONSE_BOTH
};
typedef enum dtmf_decode_response_e dtmf_decode_response_t;
enum dtmf_reply_state_e {
DTMF_REPLY_NONE = 0,
DTMF_REPLY_ANI,
DTMF_REPLY_AB,
DTMF_REPLY_AAAAA
};
typedef enum dtmf_reply_state_e dtmf_reply_state_t;
enum dtmf_call_mode_e {
DTMF_CALL_MODE_NOT_GROUP = 0,
DTMF_CALL_MODE_GROUP,
DTMF_CALL_MODE_DTMF
};
typedef enum dtmf_call_mode_e dtmf_call_mode_t;
enum dtmf_call_mode_e {
DTMF_CALL_MODE_NOT_GROUP = 0,
DTMF_CALL_MODE_GROUP,
DTMF_CALL_MODE_DTMF
};
typedef enum dtmf_call_mode_e dtmf_call_mode_t;
#else
enum dtmf_reply_state_e {
DTMF_REPLY_NONE = 0,
DTMF_REPLY_STR
};
typedef enum dtmf_reply_state_e dtmf_reply_state_t;
#endif
extern char g_dtmf_string[15];
@ -72,40 +81,51 @@ extern uint8_t g_dtmf_input_box_index;
extern bool g_dtmf_input_mode;
extern uint8_t g_dtmf_prev_index;
extern char g_dtmf_rx[17];
extern uint8_t g_dtmf_rx_index;
extern uint8_t g_dtmf_rx_timeout;
extern bool g_dtmf_rx_pending;
#ifdef ENABLE_DTMF_LIVE_DECODER
extern char g_dtmf_rx_live[20];
extern uint8_t g_dtmf_rx_live_timeout;
extern char g_dtmf_rx_live[20];
extern uint8_t g_dtmf_rx_live_timeout;
#endif
extern bool g_dtmf_is_contact_valid;
extern char g_dtmf_id[4];
extern char g_dtmf_caller[4];
extern char g_dtmf_callee[4];
extern dtmf_state_t g_dtmf_state;
extern uint8_t g_dtmf_decode_ring_tick_500ms;
extern uint8_t g_dtmf_chosen_contact;
extern uint8_t g_dtmf_auto_reset_time_500ms;
extern dtmf_call_state_t g_dtmf_call_state;
extern dtmf_reply_state_t g_dtmf_reply_state;
extern dtmf_call_mode_t g_dtmf_call_mode;
extern bool g_dtmf_is_tx;
extern uint8_t g_dtmf_tx_stop_tick_500ms;
#ifdef ENABLE_DTMF_CALLING
extern char g_dtmf_rx[17];
extern uint8_t g_dtmf_rx_index;
extern uint8_t g_dtmf_rx_timeout;
extern bool g_dtmf_rx_pending;
void DTMF_clear_RX(void);
extern bool g_dtmf_is_contact_valid;
extern char g_dtmf_id[4];
extern char g_dtmf_caller[4];
extern char g_dtmf_callee[4];
extern dtmf_state_t g_dtmf_state;
extern uint8_t g_dtmf_decode_ring_tick_500ms;
extern uint8_t g_dtmf_chosen_contact;
extern uint8_t g_dtmf_auto_reset_time_500ms;
extern dtmf_call_state_t g_dtmf_call_state;
extern dtmf_call_mode_t g_dtmf_call_mode;
#endif
extern dtmf_reply_state_t g_dtmf_reply_state;
extern bool g_dtmf_is_tx;
extern uint8_t g_dtmf_tx_stop_tick_500ms;
#ifdef ENABLE_DTMF_CALLING
void DTMF_clear_RX(void);
#endif
bool DTMF_ValidateCodes(char *pCode, const unsigned int size);
bool DTMF_GetContact(const int Index, char *pContact);
bool DTMF_FindContact(const char *pContact, char *pResult);
#ifdef ENABLE_DTMF_CALLING
bool DTMF_GetContact(const int Index, char *pContact);
bool DTMF_FindContact(const char *pContact, char *pResult);
#endif
char DTMF_GetCharacter(const unsigned int code);
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, const unsigned int size, const bool flag);
dtmf_call_mode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
#ifdef ENABLE_DTMF_CALLING
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, const unsigned int size, const bool flag);
dtmf_call_mode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
#endif
void DTMF_clear_input_box(void);
void DTMF_Append(const char vode);
void DTMF_HandleRequest(void);
#ifdef ENABLE_DTMF_CALLING
void DTMF_HandleRequest(void);
#endif
bool DTMF_Reply(void);
#endif

View File

@ -214,26 +214,32 @@ void GENERIC_Key_PTT(bool key_pressed)
g_dtmf_input_box[g_dtmf_input_box_index] = 0; // NULL term the string
// append our DTMF ID to the inputted DTMF code -
#if 0
// QS
if (g_dtmf_input_box_index == 3)
g_dtmf_call_mode = DTMF_CheckGroupCall(g_dtmf_input_box, 3);
else
g_dtmf_call_mode = DTMF_CALL_MODE_DTMF;
#else
// 1of11
if (g_dtmf_input_box_index == 3 && g_dtmf_input_box[0] != '*' && g_dtmf_input_box[0] != '#')
g_dtmf_call_mode = DTMF_CheckGroupCall(g_dtmf_input_box, 3);
else
g_dtmf_call_mode = DTMF_CALL_MODE_DTMF;
#ifdef ENABLE_DTMF_CALLING
#if 0
// QS
if (g_dtmf_input_box_index == 3)
g_dtmf_call_mode = DTMF_CheckGroupCall(g_dtmf_input_box, 3);
else
g_dtmf_call_mode = DTMF_CALL_MODE_DTMF;
#else
// 1of11
if (g_dtmf_input_box_index == 3 && g_dtmf_input_box[0] != '*' && g_dtmf_input_box[0] != '#')
g_dtmf_call_mode = DTMF_CheckGroupCall(g_dtmf_input_box, 3);
else
g_dtmf_call_mode = DTMF_CALL_MODE_DTMF;
#endif
#endif
// remember the DTMF string
g_dtmf_prev_index = g_dtmf_input_box_index;
strcpy(g_dtmf_string, g_dtmf_input_box);
g_dtmf_reply_state = DTMF_REPLY_ANI;
g_dtmf_state = DTMF_STATE_0;
#ifdef ENABLE_DTMF_CALLING
g_dtmf_reply_state = DTMF_REPLY_ANI;
g_dtmf_state = DTMF_STATE_0;
#else
g_dtmf_reply_state = DTMF_REPLY_STR; // just send the straight string
#endif
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("generic ptt tx %s\r\n", g_dtmf_string);

View File

@ -703,12 +703,14 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held)
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE && g_current_function != FUNCTION_TRANSMIT)
{ // clear CALL mode being displayed
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_update_display = true;
return;
}
#ifdef ENABLE_DTMF_CALLING
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE && g_current_function != FUNCTION_TRANSMIT)
{ // clear CALL mode being displayed
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_update_display = true;
return;
}
#endif
#ifdef ENABLE_FMRADIO
if (!g_fm_radio_mode)

View File

@ -261,7 +261,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
case MENU_S_ADD2:
case MENU_STE:
case MENU_DTMF_ST:
case MENU_DTMF_DCD:
#ifdef ENABLE_DTMF_CALLING
case MENU_DTMF_DCD:
#endif
#ifdef ENABLE_DTMF_LIVE_DECODER
case MENU_DTMF_LIVE_DEC:
#endif
@ -322,11 +324,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
*pMax = 2;
break;
case MENU_DTMF_RSP:
*pMin = 0;
*pMax = ARRAY_SIZE(g_sub_menu_dtmf_rsp) - 1;
break;
#ifdef ENABLE_MDC1200
case MENU_MDC1200_MODE:
*pMin = 0;
@ -344,16 +341,28 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
*pMax = ARRAY_SIZE(g_sub_menu_ptt_id) - 1;
break;
#ifdef ENABLE_DTMF_CALLING
case MENU_DTMF_RSP:
*pMin = 0;
*pMax = ARRAY_SIZE(g_sub_menu_dtmf_rsp) - 1;
break;
case MENU_DTMF_HOLD:
*pMin = DTMF_HOLD_MIN;
*pMax = DTMF_HOLD_MAX;
break;
case MENU_DTMF_LIST:
*pMin = 1;
*pMax = 16;
break;
#endif
case MENU_BAT_TXT:
*pMin = 0;
*pMax = ARRAY_SIZE(g_sub_menu_bat_text) - 1;
break;
case MENU_DTMF_HOLD:
*pMin = DTMF_HOLD_MIN;
*pMax = DTMF_HOLD_MAX;
break;
#ifdef ENABLE_DTMF_TIMING_SETTINGS
case MENU_DTMF_PRE:
*pMin = 3;
@ -369,11 +378,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
break;
#endif
case MENU_DTMF_LIST:
*pMin = 1;
*pMax = 16;
break;
#ifdef ENABLE_TX_POWER_CAL_MENU
case MENU_TX_CALI:
*pMin = 0;
@ -741,13 +745,33 @@ void MENU_AcceptSetting(void)
g_eeprom.config.setting.dtmf.side_tone = g_sub_menu_selection;
break;
case MENU_DTMF_RSP:
g_eeprom.config.setting.dtmf.decode_response = g_sub_menu_selection;
break;
#ifdef ENABLE_DTMF_CALLING
case MENU_DTMF_RSP:
g_eeprom.config.setting.dtmf.decode_response = g_sub_menu_selection;
break;
case MENU_DTMF_HOLD:
g_eeprom.config.setting.dtmf.auto_reset_time = g_sub_menu_selection;
break;
case MENU_DTMF_HOLD:
g_eeprom.config.setting.dtmf.auto_reset_time = g_sub_menu_selection;
break;
case MENU_DTMF_DCD:
g_tx_vfo->channel.dtmf_decoding_enable = g_sub_menu_selection;
DTMF_clear_RX();
g_request_save_channel = 1;
return;
case MENU_DTMF_LIST:
g_dtmf_chosen_contact = g_sub_menu_selection - 1;
if (g_dtmf_is_contact_valid)
{
GUI_SelectNextDisplay(DISPLAY_MAIN);
g_dtmf_input_mode = true;
g_dtmf_input_box_index = 3;
memcpy(g_dtmf_input_box, g_dtmf_id, 4);
g_request_display_screen = DISPLAY_INVALID;
}
return;
#endif
#ifdef ENABLE_DTMF_TIMING_SETTINGS
case MENU_DTMF_PRE:
@ -798,12 +822,6 @@ void MENU_AcceptSetting(void)
g_eeprom.config.setting.battery_text = g_sub_menu_selection;
break;
case MENU_DTMF_DCD:
g_tx_vfo->channel.dtmf_decoding_enable = g_sub_menu_selection;
DTMF_clear_RX();
g_request_save_channel = 1;
return;
#ifdef ENABLE_DTMF_LIVE_DECODER
case MENU_DTMF_LIVE_DEC:
g_eeprom.config.setting.dtmf_live_decoder = g_sub_menu_selection;
@ -816,18 +834,6 @@ void MENU_AcceptSetting(void)
break;
#endif
case MENU_DTMF_LIST:
g_dtmf_chosen_contact = g_sub_menu_selection - 1;
if (g_dtmf_is_contact_valid)
{
GUI_SelectNextDisplay(DISPLAY_MAIN);
g_dtmf_input_mode = true;
g_dtmf_input_box_index = 3;
memcpy(g_dtmf_input_box, g_dtmf_id, 4);
g_request_display_screen = DISPLAY_INVALID;
}
return;
case MENU_PON_MSG:
g_eeprom.config.setting.power_on_display_mode = g_sub_menu_selection;
break;
@ -871,21 +877,21 @@ void MENU_AcceptSetting(void)
return;
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT:
g_eeprom.config.setting.key1_short = g_sub_menu_selection;
break;
case MENU_SIDE1_LONG:
g_eeprom.config.setting.key1_long = g_sub_menu_selection;
break;
case MENU_SIDE2_SHORT:
g_eeprom.config.setting.key2_short = g_sub_menu_selection;
break;
case MENU_SIDE2_LONG:
g_eeprom.config.setting.key2_long = g_sub_menu_selection;
break;
case MENU_SIDE1_SHORT:
g_eeprom.config.setting.key1_short = g_sub_menu_selection;
break;
case MENU_SIDE1_LONG:
g_eeprom.config.setting.key1_long = g_sub_menu_selection;
break;
case MENU_SIDE2_SHORT:
g_eeprom.config.setting.key2_short = g_sub_menu_selection;
break;
case MENU_SIDE2_LONG:
g_eeprom.config.setting.key2_long = g_sub_menu_selection;
break;
#endif
case MENU_RESET:
@ -1190,9 +1196,9 @@ void MENU_ShowCurrentSetting(void)
break;
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK:
g_sub_menu_selection = g_eeprom.config.setting.auto_key_lock;
break;
case MENU_AUTO_KEY_LOCK:
g_sub_menu_selection = g_eeprom.config.setting.auto_key_lock;
break;
#endif
#ifdef ENABLE_SCAN_RANGES
@ -1257,47 +1263,57 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = RADIO_FindNextChannel(0, 1, true, 1);
break;
#ifdef ENABLE_ALARM
#ifdef ENABLE_ALARM
case MENU_ALARM_MODE:
g_sub_menu_selection = g_eeprom.config.setting.alarm_mode;
break;
#endif
#endif
case MENU_DTMF_ST:
g_sub_menu_selection = g_eeprom.config.setting.dtmf.side_tone;
break;
case MENU_DTMF_RSP:
g_sub_menu_selection = g_eeprom.config.setting.dtmf.decode_response;
break;
#ifdef ENABLE_DTMF_CALLING
case MENU_DTMF_RSP:
g_sub_menu_selection = g_eeprom.config.setting.dtmf.decode_response;
break;
case MENU_DTMF_HOLD:
g_sub_menu_selection = g_eeprom.config.setting.dtmf.auto_reset_time;
if (g_sub_menu_selection <= DTMF_HOLD_MIN)
g_sub_menu_selection = DTMF_HOLD_MIN;
else
if (g_sub_menu_selection <= 10)
g_sub_menu_selection = 10;
else
if (g_sub_menu_selection <= 20)
g_sub_menu_selection = 20;
else
if (g_sub_menu_selection <= 30)
g_sub_menu_selection = 30;
else
if (g_sub_menu_selection <= 40)
g_sub_menu_selection = 40;
else
if (g_sub_menu_selection <= 50)
g_sub_menu_selection = 50;
else
if (g_sub_menu_selection < DTMF_HOLD_MAX)
g_sub_menu_selection = 50;
else
g_sub_menu_selection = DTMF_HOLD_MAX;
break;
case MENU_DTMF_HOLD:
g_sub_menu_selection = g_eeprom.config.setting.dtmf.auto_reset_time;
case MENU_DTMF_DCD:
g_sub_menu_selection = g_tx_vfo->channel.dtmf_decoding_enable;
break;
if (g_sub_menu_selection <= DTMF_HOLD_MIN)
g_sub_menu_selection = DTMF_HOLD_MIN;
else
if (g_sub_menu_selection <= 10)
g_sub_menu_selection = 10;
else
if (g_sub_menu_selection <= 20)
g_sub_menu_selection = 20;
else
if (g_sub_menu_selection <= 30)
g_sub_menu_selection = 30;
else
if (g_sub_menu_selection <= 40)
g_sub_menu_selection = 40;
else
if (g_sub_menu_selection <= 50)
g_sub_menu_selection = 50;
else
if (g_sub_menu_selection < DTMF_HOLD_MAX)
g_sub_menu_selection = 50;
else
g_sub_menu_selection = DTMF_HOLD_MAX;
break;
case MENU_DTMF_LIST:
g_sub_menu_selection = g_dtmf_chosen_contact + 1;
break;
#endif
#ifdef ENABLE_DTMF_TIMING_SETTINGS
case MENU_DTMF_PRE:
@ -1339,14 +1355,6 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_eeprom.config.setting.battery_text;
return;
case MENU_DTMF_DCD:
g_sub_menu_selection = g_tx_vfo->channel.dtmf_decoding_enable;
break;
case MENU_DTMF_LIST:
g_sub_menu_selection = g_dtmf_chosen_contact + 1;
break;
#ifdef ENABLE_DTMF_LIVE_DECODER
case MENU_DTMF_LIVE_DEC:
g_sub_menu_selection = g_eeprom.config.setting.dtmf_live_decoder;
@ -1365,49 +1373,49 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_tx_vfo->channel.mod_mode;
break;
/*
#ifdef ENABLE_AM_FIX
#ifdef ENABLE_AM_FIX
case MENU_AM_FIX:
g_sub_menu_selection = g_eeprom.config.setting.am_fix;
break;
#endif
#endif
*/
#ifdef ENABLE_AM_FIX_TEST1
#ifdef ENABLE_AM_FIX_TEST1
case MENU_AM_FIX_TEST1:
g_sub_menu_selection = g_eeprom.config.setting.am_fix_test1;
break;
#endif
#endif
#ifdef ENABLE_NOAA
#ifdef ENABLE_NOAA
case MENU_NOAA_SCAN:
g_sub_menu_selection = g_eeprom.config.setting.noaa_auto_scan;
break;
#endif
#endif
case MENU_MEM_DEL:
#if 0
#if 0
g_sub_menu_selection = RADIO_FindNextChannel(g_eeprom.config.setting.indices.vfo[0].user, 1, false, 1);
#else
#else
g_sub_menu_selection = RADIO_FindNextChannel(g_eeprom.config.setting.indices.vfo[g_eeprom.config.setting.tx_vfo_num].user, 1, false, 1);
#endif
#endif
break;
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT:
g_sub_menu_selection = g_eeprom.config.setting.key1_short;
break;
case MENU_SIDE1_LONG:
g_sub_menu_selection = g_eeprom.config.setting.key1_long;
break;
case MENU_SIDE2_SHORT:
g_sub_menu_selection = g_eeprom.config.setting.key2_short;
break;
case MENU_SIDE2_LONG:
g_sub_menu_selection = g_eeprom.config.setting.key2_long;
break;
#endif
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT:
g_sub_menu_selection = g_eeprom.config.setting.key1_short;
break;
case MENU_SIDE1_LONG:
g_sub_menu_selection = g_eeprom.config.setting.key1_long;
break;
case MENU_SIDE2_SHORT:
g_sub_menu_selection = g_eeprom.config.setting.key2_short;
break;
case MENU_SIDE2_LONG:
g_sub_menu_selection = g_eeprom.config.setting.key2_long;
break;
#endif
case MENU_350_TX:
g_sub_menu_selection = g_eeprom.config.setting.enable_tx_350;

View File

@ -650,7 +650,9 @@ void SEARCH_Start(void)
BK4819_EnableFrequencyScan();
}
DTMF_clear_RX();
#ifdef ENABLE_DTMF_CALLING
DTMF_clear_RX();
#endif
#ifdef ENABLE_VOX
g_vox_lost = false;

View File

@ -352,7 +352,7 @@ static void cmd_051D(const uint8_t *pBuffer)
memset(data, 0xff, 8); // wipe the AES key
#endif
//#ifndef ENABLE_KILL_REVIVE
//#ifndef ENABLE_DTMF_KILL_REVIVE
if (Offset == 0x0F40)
{ // killed flag is here
data[2] = false; // remove it