0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 14:21:25 +03:00

fix dtmf tx

This commit is contained in:
OneOfEleven 2023-11-19 22:47:50 +00:00
parent c68bff681e
commit 34c80a6805
7 changed files with 43 additions and 18 deletions

View File

@ -24,6 +24,9 @@
#include "driver/eeprom.h" #include "driver/eeprom.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "driver/system.h" #include "driver/system.h"
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
#include "driver/uart.h"
#endif
#include "dtmf.h" #include "dtmf.h"
#include "external/printf/printf.h" #include "external/printf/printf.h"
#include "misc.h" #include "misc.h"
@ -326,7 +329,7 @@ void DTMF_HandleRequest(void)
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), false)) if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), false))
{ // we got a response { // we got a response
g_dtmf_state = DTMF_STATE_CALL_OUT_RSP; g_dtmf_state = DTMF_STATE_CALL_OUT_RSP;
DTMF_clear_RX(); DTMF_clear_RX();
g_update_display = true; g_update_display = true;
} }
@ -390,7 +393,7 @@ 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 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; const char *pString = NULL;
char String[23]; char str[23];
switch (g_dtmf_reply_state) switch (g_dtmf_reply_state)
{ {
@ -401,9 +404,14 @@ bool DTMF_Reply(void)
} }
else else
{ // append our ID code onto the end of the DTMF code to send { // append our ID code onto the end of the DTMF code to send
sprintf(String, "%s%c%s", g_dtmf_string, g_eeprom.config.setting.dtmf.separate_code, g_eeprom.config.setting.dtmf.ani_id); sprintf(str, "%s%c%s", g_dtmf_string, g_eeprom.config.setting.dtmf.separate_code, g_eeprom.config.setting.dtmf.ani_id);
pString = String; pString = str;
} }
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("dtmf tx reply ani %s\r\n", pString);
#endif
break; break;
case DTMF_REPLY_AB: case DTMF_REPLY_AB:
@ -411,13 +419,18 @@ bool DTMF_Reply(void)
break; break;
case DTMF_REPLY_AAAAA: case DTMF_REPLY_AAAAA:
sprintf(String, "%s%c%s", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code, "AAAAA"); sprintf(str, "%s%c%s", g_eeprom.config.setting.dtmf.ani_id, g_eeprom.config.setting.dtmf.separate_code, "AAAAA");
pString = String; pString = str;
break; break;
default: default:
case DTMF_REPLY_NONE: case DTMF_REPLY_NONE:
if (g_dtmf_call_state != DTMF_CALL_STATE_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_APOLLO ||
g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_OFF || g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_OFF ||
g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN) g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN)
@ -449,9 +462,9 @@ bool DTMF_Reply(void)
pString, pString,
1, 1,
g_eeprom.config.setting.dtmf.first_code_persist_time * 10, g_eeprom.config.setting.dtmf.first_code_persist_time * 10,
g_eeprom.config.setting.dtmf.hash_code_persist_time * 10, g_eeprom.config.setting.dtmf.hash_code_persist_time * 10,
g_eeprom.config.setting.dtmf.code_persist_time * 10, g_eeprom.config.setting.dtmf.code_persist_time * 10,
g_eeprom.config.setting.dtmf.code_interval_time * 10); g_eeprom.config.setting.dtmf.code_interval_time * 10);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);

View File

@ -209,7 +209,7 @@ void GENERIC_Key_PTT(bool key_pressed)
if (g_dtmf_input_box_index < sizeof(g_dtmf_input_box)) if (g_dtmf_input_box_index < sizeof(g_dtmf_input_box))
g_dtmf_input_box[g_dtmf_input_box_index] = 0; // NULL term the string g_dtmf_input_box[g_dtmf_input_box_index] = 0; // NULL term the string
#if 0 #if 1
// append our DTMF ID to the inputted DTMF code - // append our DTMF ID to the inputted DTMF code -
// IF the user inputted code is exactly 3 digits long // IF the user inputted code is exactly 3 digits long
if (g_dtmf_input_box_index == 3) if (g_dtmf_input_box_index == 3)
@ -231,6 +231,10 @@ void GENERIC_Key_PTT(bool key_pressed)
g_dtmf_reply_state = DTMF_REPLY_ANI; g_dtmf_reply_state = DTMF_REPLY_ANI;
g_dtmf_state = DTMF_STATE_0; g_dtmf_state = DTMF_STATE_0;
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("generic ptt tx %s\r\n", g_dtmf_string);
#endif
} }
DTMF_clear_input_box(); DTMF_clear_input_box();

View File

@ -363,6 +363,7 @@ void processFKeyFunction(const key_code_t Key)
#ifdef ENABLE_PANADAPTER #ifdef ENABLE_PANADAPTER
if (g_fkey_pressed) if (g_fkey_pressed)
{ {
g_fkey_pressed = false;
g_eeprom.config.setting.panadapter = (g_eeprom.config.setting.panadapter + 1) & 1u; g_eeprom.config.setting.panadapter = (g_eeprom.config.setting.panadapter + 1) & 1u;
g_request_save_settings = true; g_request_save_settings = true;
break; break;

Binary file not shown.

Binary file not shown.

View File

@ -179,8 +179,7 @@ void FUNCTION_Select(function_type_t Function)
g_tx_timeout_reached = false; g_tx_timeout_reached = false;
g_flag_end_tx = false; g_flag_end_tx = false;
g_rtte_count_down = 0; g_rtte_count_down = 0;
g_dtmf_reply_state = DTMF_REPLY_NONE;
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
if (g_alarm_state == ALARM_STATE_OFF) if (g_alarm_state == ALARM_STATE_OFF)
@ -234,6 +233,10 @@ void FUNCTION_Select(function_type_t Function)
RADIO_enableTX(false); RADIO_enableTX(false);
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("function tx %u %s\r\n", g_dtmf_reply_state, g_dtmf_string);
#endif
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
if (g_alarm_state != ALARM_STATE_OFF) if (g_alarm_state != ALARM_STATE_OFF)
{ {

14
radio.c
View File

@ -1085,9 +1085,9 @@ void RADIO_PrepareTX(void)
else else
if (g_battery_display_level == 0) if (g_battery_display_level == 0)
State = VFO_STATE_BAT_LOW; // charge your battery ! State = VFO_STATE_BAT_LOW; // charge your battery !
else // else
if (g_battery_display_level >= 6) // if (g_battery_display_level >= 6)
State = VFO_STATE_VOLTAGE_HIGH; // over voltage (no doubt to protect the PA) .. this is being a pain // State = VFO_STATE_VOLTAGE_HIGH; // over voltage (no doubt to protect the PA) .. this is being a pain
} }
else else
State = VFO_STATE_TX_DISABLE; // TX frequency not allowed State = VFO_STATE_TX_DISABLE; // TX frequency not allowed
@ -1110,12 +1110,16 @@ void RADIO_PrepareTX(void)
// ****************************** // ******************************
// TX is allowed // TX is allowed
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf("radio prepare tx %u %s\r\n", g_dtmf_reply_state, g_dtmf_string);
#endif
if (g_dtmf_reply_state == DTMF_REPLY_ANI) if (g_dtmf_reply_state == DTMF_REPLY_ANI)
{ {
if (g_dtmf_call_mode == DTMF_CALL_MODE_DTMF) if (g_dtmf_call_mode == DTMF_CALL_MODE_DTMF)
{ {
g_dtmf_is_tx = true; g_dtmf_is_tx = true;
g_dtmf_call_state = DTMF_CALL_STATE_NONE; g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_dtmf_tx_stop_tick_500ms = dtmf_txstop_500ms; g_dtmf_tx_stop_tick_500ms = dtmf_txstop_500ms;
} }
else else