Live DTMF decoder display tidy up + more counter renames

This commit is contained in:
OneOfEleven 2023-09-17 10:13:55 +01:00
parent 78c62d5489
commit 19fa9718f5
10 changed files with 73 additions and 53 deletions

View File

@ -1685,19 +1685,19 @@ void APP_TimeSlice500ms(void)
} }
} }
if (gDTMF_DecodeRing && gDTMF_DecodeRingCountdown > 0) if (gDTMF_DecodeRing && gDTMF_DecodeRingCountdown_500ms > 0)
{ {
if ((--gDTMF_DecodeRingCountdown % 3) == 0) if ((--gDTMF_DecodeRingCountdown_500ms % 3) == 0)
AUDIO_PlayBeep(BEEP_440HZ_500MS); AUDIO_PlayBeep(BEEP_440HZ_500MS);
if (gDTMF_DecodeRingCountdown == 0) if (gDTMF_DecodeRingCountdown_500ms == 0)
gDTMF_DecodeRing = false; gDTMF_DecodeRing = false;
} }
} }
if (gDTMF_IsTx && gDTMF_TxStopCountdown > 0) if (gDTMF_IsTx && gDTMF_TxStopCountdown_500ms > 0)
{ {
if (--gDTMF_TxStopCountdown == 0) if (--gDTMF_TxStopCountdown_500ms == 0)
{ {
gDTMF_IsTx = false; gDTMF_IsTx = false;
gUpdateDisplay = true; gUpdateDisplay = true;
@ -2165,10 +2165,10 @@ Skip:
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
gDTMF_AUTO_RESET_TIME = 0; gDTMF_AUTO_RESET_TIME = 0;
gDTMF_CallState = DTMF_CALL_STATE_NONE; gDTMF_CallState = DTMF_CALL_STATE_NONE;
gDTMF_TxStopCountdown = 0; gDTMF_TxStopCountdown_500ms = 0;
gDTMF_IsTx = false; gDTMF_IsTx = false;
gVFO_RSSI_Level[0] = 0; gVFO_RSSI_Level[0] = 0;
gVFO_RSSI_Level[1] = 0; gVFO_RSSI_Level[1] = 0;

View File

@ -50,7 +50,7 @@ char gDTMF_Caller[4];
char gDTMF_Callee[4]; char gDTMF_Callee[4];
DTMF_State_t gDTMF_State; DTMF_State_t gDTMF_State;
bool gDTMF_DecodeRing; bool gDTMF_DecodeRing;
uint8_t gDTMF_DecodeRingCountdown; uint8_t gDTMF_DecodeRingCountdown_500ms;
uint8_t gDTMFChosenContact; uint8_t gDTMFChosenContact;
uint8_t gDTMF_AUTO_RESET_TIME; uint8_t gDTMF_AUTO_RESET_TIME;
uint8_t gDTMF_InputIndex; uint8_t gDTMF_InputIndex;
@ -59,7 +59,7 @@ DTMF_CallState_t gDTMF_CallState;
DTMF_ReplyState_t gDTMF_ReplyState; DTMF_ReplyState_t gDTMF_ReplyState;
DTMF_CallMode_t gDTMF_CallMode; DTMF_CallMode_t gDTMF_CallMode;
bool gDTMF_IsTx; bool gDTMF_IsTx;
uint8_t gDTMF_TxStopCountdown; uint8_t gDTMF_TxStopCountdown_500ms;
bool gDTMF_IsGroupCall; bool gDTMF_IsGroupCall;
bool DTMF_ValidateCodes(char *pCode, uint8_t Size) bool DTMF_ValidateCodes(char *pCode, uint8_t Size)
@ -271,15 +271,15 @@ void DTMF_HandleRequest(void)
switch (gEeprom.DTMF_DECODE_RESPONSE) switch (gEeprom.DTMF_DECODE_RESPONSE)
{ {
case 3: case 3:
gDTMF_DecodeRing = true; gDTMF_DecodeRing = true;
gDTMF_DecodeRingCountdown = 20; gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
// Fallthrough // Fallthrough
case 2: case 2:
gDTMF_ReplyState = DTMF_REPLY_AAAAA; gDTMF_ReplyState = DTMF_REPLY_AAAAA;
break; break;
case 1: case 1:
gDTMF_DecodeRing = true; gDTMF_DecodeRing = true;
gDTMF_DecodeRingCountdown = 20; gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
break; break;
default: default:
gDTMF_DecodeRing = false; gDTMF_DecodeRing = false;

View File

@ -72,7 +72,7 @@ extern char gDTMF_Caller[4];
extern char gDTMF_Callee[4]; extern char gDTMF_Callee[4];
extern DTMF_State_t gDTMF_State; extern DTMF_State_t gDTMF_State;
extern bool gDTMF_DecodeRing; extern bool gDTMF_DecodeRing;
extern uint8_t gDTMF_DecodeRingCountdown; extern uint8_t gDTMF_DecodeRingCountdown_500ms;
extern uint8_t gDTMFChosenContact; extern uint8_t gDTMFChosenContact;
extern uint8_t gDTMF_AUTO_RESET_TIME; extern uint8_t gDTMF_AUTO_RESET_TIME;
extern uint8_t gDTMF_InputIndex; extern uint8_t gDTMF_InputIndex;
@ -81,7 +81,7 @@ extern DTMF_CallState_t gDTMF_CallState;
extern DTMF_ReplyState_t gDTMF_ReplyState; extern DTMF_ReplyState_t gDTMF_ReplyState;
extern DTMF_CallMode_t gDTMF_CallMode; extern DTMF_CallMode_t gDTMF_CallMode;
extern bool gDTMF_IsTx; extern bool gDTMF_IsTx;
extern uint8_t gDTMF_TxStopCountdown; extern uint8_t gDTMF_TxStopCountdown_500ms;
bool DTMF_ValidateCodes(char *pCode, uint8_t Size); bool DTMF_ValidateCodes(char *pCode, uint8_t Size);
bool DTMF_GetContact(const int Index, char *pContact); bool DTMF_GetContact(const int Index, char *pContact);

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

68
misc.c
View File

@ -18,41 +18,43 @@
#include "misc.h" #include "misc.h"
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
const uint8_t DTMF_RX_timeout_500ms = 2500 / 500; // 2.5 seconds
const uint8_t DTMF_RX_timeout_saved_500ms = 20000 / 500; // 20 seconds
const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds
const uint8_t DTMF_txstop_countdown_500ms = 3000 / 500; // 6 seconds
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
const uint16_t key_repeat_delay_10ms = 400 / 10; // 400ms
const uint16_t key_repeat_10ms = 80 / 10; // 80ms .. MUST be less than 'key_repeat_delay'
const uint16_t key_debounce_10ms = 20 / 10; // 20ms
const uint8_t scan_delay_10ms = 210 / 10; // 210ms
// 10ms count down resolution
const uint16_t dual_watch_count_after_tx_10ms = 3600 / 10; // 3.6 sec after TX ends
const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ?
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
const uint16_t gMax_bat_v = 843; // 8.43V
const uint16_t gMin_bat_v = 660; // 6.6V
const uint8_t DTMF_RX_timeout_500ms = 2500 / 500; // 2.5 seconds const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BBA7F92};
const uint8_t DTMF_RX_timeout_saved_500ms = 20000 / 500; // 20 seconds
const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
const uint16_t key_repeat_delay_10ms = 400 / 10; // 400ms
const uint16_t key_repeat_10ms = 80 / 10; // 80ms .. MUST be less than 'key_repeat_delay'
const uint16_t key_debounce_10ms = 20 / 10; // 20ms
const uint8_t scan_delay_10ms = 210 / 10; // 210ms
// 10ms count down resolution
const uint16_t dual_watch_count_after_tx_10ms = 3600 / 10; // 3.6 sec after TX ends
const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ?
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
const uint16_t gMax_bat_v = 843; // 8.43V
const uint16_t gMin_bat_v = 660; // 6.6V
const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BBA7F92};
const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
bool gSetting_350TX; bool gSetting_350TX;
bool gSetting_KILLED; bool gSetting_KILLED;

2
misc.h
View File

@ -87,6 +87,8 @@ extern const uint8_t menu_timeout_500ms;
extern const uint8_t DTMF_RX_timeout_500ms; extern const uint8_t DTMF_RX_timeout_500ms;
extern const uint8_t DTMF_RX_timeout_saved_500ms; extern const uint8_t DTMF_RX_timeout_saved_500ms;
extern const uint8_t DTMF_decode_ring_countdown_500ms;
extern const uint8_t DTMF_txstop_countdown_500ms;
extern const uint8_t key_input_timeout_500ms; extern const uint8_t key_input_timeout_500ms;

View File

@ -913,9 +913,9 @@ Skip:
{ {
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF) if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
{ {
gDTMF_IsTx = true; gDTMF_IsTx = true;
gDTMF_CallState = DTMF_CALL_STATE_NONE; gDTMF_CallState = DTMF_CALL_STATE_NONE;
gDTMF_TxStopCountdown = 6; gDTMF_TxStopCountdown_500ms = DTMF_txstop_countdown_500ms;
} }
else else
{ {

View File

@ -98,7 +98,13 @@ void UI_DisplayMain(void)
strcpy(String, (gDTMF_State == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX"); strcpy(String, (gDTMF_State == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX");
} }
else else
{
sprintf(String, ">%s", gDTMF_InputBox); sprintf(String, ">%s", gDTMF_InputBox);
#ifdef ENABLE_DTMF_DECODER
show_dtmf_rx = false;
#endif
}
UI_PrintString(String, 2, 0, vfo_num * 3, 8); UI_PrintString(String, 2, 0, vfo_num * 3, 8);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
@ -114,6 +120,12 @@ void UI_DisplayMain(void)
if (gDTMF_IsTx) if (gDTMF_IsTx)
sprintf(String, ">%s", gDTMF_String); sprintf(String, ">%s", gDTMF_String);
} }
else
{
#ifdef ENABLE_DTMF_DECODER
show_dtmf_rx = false;
#endif
}
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8); UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
#ifdef ENABLE_DTMF_DECODER #ifdef ENABLE_DTMF_DECODER
@ -225,6 +237,10 @@ void UI_DisplayMain(void)
if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num) if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
{ // user entering a frequency { // user entering a frequency
UI_DisplayFrequency(gInputBox, 31, Line, true, false); UI_DisplayFrequency(gInputBox, 31, Line, true, false);
#ifdef ENABLE_DTMF_DECODER
show_dtmf_rx = false;
#endif
} }
else else
{ {