mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-05-19 00:11:18 +03:00
Various DTMF bug fixes and renames
This commit is contained in:
parent
f4643adb2a
commit
9493f34c23
4
Makefile
4
Makefile
@ -26,8 +26,8 @@ ENABLE_NO_SCAN_TIMEOUT := 1
|
|||||||
ENABLE_AM_FIX := 1
|
ENABLE_AM_FIX := 1
|
||||||
ENABLE_AM_FIX_SHOW_DATA := 1
|
ENABLE_AM_FIX_SHOW_DATA := 1
|
||||||
ENABLE_SQUELCH1_LOWER := 0
|
ENABLE_SQUELCH1_LOWER := 0
|
||||||
ENABLE_RSSI_BAR := 1
|
ENABLE_RSSI_BAR := 0
|
||||||
ENABLE_AUDIO_BAR := 1
|
ENABLE_AUDIO_BAR := 0
|
||||||
#ENABLE_COPY_CHAN_TO_VFO := 1
|
#ENABLE_COPY_CHAN_TO_VFO := 1
|
||||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||||
#ENABLE_BAND_SCOPE := 1
|
#ENABLE_BAND_SCOPE := 1
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "app/action.h"
|
#include "app/action.h"
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
@ -167,6 +169,11 @@ void ACTION_Scan(bool bRestart)
|
|||||||
|
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
|
DTMF_clear_RX();
|
||||||
|
|
||||||
|
gDTMF_RX_live_timeout = 0;
|
||||||
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
|
||||||
RADIO_SelectVfos();
|
RADIO_SelectVfos();
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
|
162
app/app.c
162
app/app.c
@ -73,10 +73,10 @@ static void updateRSSI(const int vfo)
|
|||||||
if (gEeprom.VfoInfo[vfo].AM_mode && gSetting_AM_fix)
|
if (gEeprom.VfoInfo[vfo].AM_mode && gSetting_AM_fix)
|
||||||
rssi -= rssi_gain_diff[vfo];
|
rssi -= rssi_gain_diff[vfo];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gCurrentRSSI[vfo] == rssi)
|
if (gCurrentRSSI[vfo] == rssi)
|
||||||
return; // no change
|
return; // no change
|
||||||
|
|
||||||
gCurrentRSSI[vfo] = rssi;
|
gCurrentRSSI[vfo] = rssi;
|
||||||
|
|
||||||
UI_UpdateRSSI(rssi, vfo);
|
UI_UpdateRSSI(rssi, vfo);
|
||||||
@ -119,7 +119,7 @@ static void APP_CheckForIncoming(void)
|
|||||||
updateRSSI(gEeprom.RX_CHANNEL);
|
updateRSSI(gEeprom.RX_CHANNEL);
|
||||||
gUpdateRSSI = true;
|
gUpdateRSSI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,6 +182,10 @@ static void APP_HandleIncoming(void)
|
|||||||
|
|
||||||
if (!g_SquelchLost)
|
if (!g_SquelchLost)
|
||||||
{ // squelch is closed
|
{ // squelch is closed
|
||||||
|
|
||||||
|
if (gDTMF_RX_index > 0)
|
||||||
|
DTMF_clear_RX();
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_FOREGROUND)
|
if (gCurrentFunction != FUNCTION_FOREGROUND)
|
||||||
{
|
{
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
@ -214,12 +218,13 @@ static void APP_HandleIncoming(void)
|
|||||||
if (!bFlag)
|
if (!bFlag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DTMF_HandleRequest();
|
|
||||||
|
|
||||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{ // not scanning
|
{ // not scanning
|
||||||
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
|
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||||
{ // DTMF is enabled
|
{ // DTMF DCD is enabled
|
||||||
|
|
||||||
|
// DTMF_HandleRequest();
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE)
|
if (gDTMF_CallState == DTMF_CALL_STATE_NONE)
|
||||||
{
|
{
|
||||||
if (gRxReceptionMode == RX_MODE_DETECTED)
|
if (gRxReceptionMode == RX_MODE_DETECTED)
|
||||||
@ -234,7 +239,6 @@ static void APP_HandleIncoming(void)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -531,7 +535,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ******************************************
|
// ******************************************
|
||||||
|
|
||||||
// original setting
|
// original setting
|
||||||
uint8_t lna_short = orig_lna_short;
|
uint8_t lna_short = orig_lna_short;
|
||||||
uint8_t lna = orig_lna;
|
uint8_t lna = orig_lna;
|
||||||
@ -777,34 +781,40 @@ void APP_CheckRadioInterrupts(void)
|
|||||||
// g_CTCSS_Lost = true;
|
// g_CTCSS_Lost = true;
|
||||||
|
|
||||||
if (interrupt_status_bits & BK4819_REG_02_DTMF_5TONE_FOUND)
|
if (interrupt_status_bits & BK4819_REG_02_DTMF_5TONE_FOUND)
|
||||||
{ // save the new DTMF RX'ed character
|
{ // save the RX'ed DTMF character
|
||||||
|
|
||||||
// fetch the RX'ed char
|
|
||||||
const char c = DTMF_GetCharacter(BK4819_GetDTMF_5TONE_Code());
|
const char c = DTMF_GetCharacter(BK4819_GetDTMF_5TONE_Code());
|
||||||
if (c != 0xff)
|
if (c != 0xff)
|
||||||
{
|
{
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
gCurrentFunction == FUNCTION_INCOMING ||
|
|
||||||
gCurrentFunction == FUNCTION_MONITOR)
|
|
||||||
{
|
{
|
||||||
gDTMF_RequestPending = true;
|
if (gSetting_live_DTMF_decoder)
|
||||||
gDTMF_RecvTimeout = DTMF_RX_timeout_500ms;
|
{
|
||||||
// shift the RX buffer down one - if need be
|
size_t len = strlen(gDTMF_RX_live);
|
||||||
if (gDTMF_WriteIndex >= sizeof(gDTMF_Received))
|
if (len >= (sizeof(gDTMF_RX_live) - 1))
|
||||||
memmove(gDTMF_Received, &gDTMF_Received[1], --gDTMF_WriteIndex);
|
{ // make room
|
||||||
gDTMF_Received[gDTMF_WriteIndex++] = c;
|
memmove(&gDTMF_RX_live[0], &gDTMF_RX_live[1], sizeof(gDTMF_RX_live) - 1);
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
gDTMF_RX_live[len++] = c;
|
||||||
|
gDTMF_RX_live[len] = 0;
|
||||||
|
gDTMF_RX_live_timeout = DTMF_RX_live_timeout_500ms; // time till we delete it
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
|
||||||
// live DTMF decoder
|
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||||
size_t len = strlen(gDTMF_RX_live);
|
{
|
||||||
// shift the RX buffer down one - if need be
|
if (gDTMF_RX_index >= (sizeof(gDTMF_RX) - 1))
|
||||||
if (len >= (sizeof(gDTMF_RX_live) - 1))
|
{ // make room
|
||||||
memmove(&gDTMF_RX_live[0], &gDTMF_RX_live[1], --len);
|
memmove(&gDTMF_RX[0], &gDTMF_RX[1], sizeof(gDTMF_RX) - 1);
|
||||||
gDTMF_RX_live[len++] = c;
|
gDTMF_RX_index--;
|
||||||
gDTMF_RX_live[len] = 0;
|
}
|
||||||
gDTMF_RX_live_timeout = DTMF_RX_live_timeout_500ms; // time till we delete it
|
gDTMF_RX[gDTMF_RX_index++] = c;
|
||||||
gUpdateDisplay = true;
|
gDTMF_RX[gDTMF_RX_index] = 0;
|
||||||
|
gDTMF_RX_timeout = DTMF_RX_timeout_500ms; // time till we delete it
|
||||||
|
gDTMF_RX_pending = true;
|
||||||
|
|
||||||
DTMF_HandleRequest();
|
DTMF_HandleRequest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1257,7 +1267,7 @@ void APP_CheckKeys(void)
|
|||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
SYSTEM_DelayMs(1);
|
SYSTEM_DelayMs(1);
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
{ // PTT pressed
|
{ // PTT pressed
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
@ -1666,9 +1676,9 @@ void cancelUserInputModes(void)
|
|||||||
gKeyInputCountdown = 0;
|
gKeyInputCountdown = 0;
|
||||||
if (gDTMF_InputMode || gInputBoxIndex > 0)
|
if (gDTMF_InputMode || gInputBoxIndex > 0)
|
||||||
{
|
{
|
||||||
|
memset(gDTMF_String, 0, sizeof(gDTMF_String));
|
||||||
gDTMF_InputMode = false;
|
gDTMF_InputMode = false;
|
||||||
gDTMF_InputIndex = 0;
|
gDTMF_InputIndex = 0;
|
||||||
memset(gDTMF_String, 0, sizeof(gDTMF_String));
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
@ -1692,11 +1702,18 @@ void APP_TimeSlice500ms(void)
|
|||||||
{
|
{
|
||||||
if (--gDTMF_RX_live_timeout == 0)
|
if (--gDTMF_RX_live_timeout == 0)
|
||||||
{
|
{
|
||||||
gDTMF_RX_live[0] = 0;
|
if (gDTMF_RX_live[0] != 0)
|
||||||
gUpdateDisplay = true;
|
{
|
||||||
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gDTMF_RX_timeout > 0)
|
||||||
|
if (--gDTMF_RX_timeout == 0)
|
||||||
|
DTMF_clear_RX();
|
||||||
|
|
||||||
// Skipped authentic device check
|
// Skipped authentic device check
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@ -1711,8 +1728,16 @@ void APP_TimeSlice500ms(void)
|
|||||||
if (gReducedService)
|
if (gReducedService)
|
||||||
{
|
{
|
||||||
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);
|
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);
|
||||||
|
|
||||||
if (gBatteryCurrent > 500 || gBatteryCalibration[3] < gBatteryCurrentVoltage)
|
if (gBatteryCurrent > 500 || gBatteryCalibration[3] < gBatteryCurrentVoltage)
|
||||||
overlay_FLASH_RebootToBootloader();
|
{
|
||||||
|
#ifdef ENABLE_OVERLAY
|
||||||
|
overlay_FLASH_RebootToBootloader();
|
||||||
|
#else
|
||||||
|
NVIC_SystemReset();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1892,7 +1917,7 @@ void APP_TimeSlice500ms(void)
|
|||||||
if (gScreenToDisplay == DISPLAY_SCANNER && gScannerEditState == 0 && gScanCssState < SCAN_CSS_STATE_FOUND)
|
if (gScreenToDisplay == DISPLAY_SCANNER && gScannerEditState == 0 && gScanCssState < SCAN_CSS_STATE_FOUND)
|
||||||
{
|
{
|
||||||
gScanProgressIndicator++;
|
gScanProgressIndicator++;
|
||||||
|
|
||||||
#ifndef ENABLE_NO_SCAN_TIMEOUT
|
#ifndef ENABLE_NO_SCAN_TIMEOUT
|
||||||
if (gScanProgressIndicator > 32)
|
if (gScanProgressIndicator > 32)
|
||||||
{
|
{
|
||||||
@ -1900,15 +1925,28 @@ void APP_TimeSlice500ms(void)
|
|||||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||||
else
|
else
|
||||||
gScanCssState = SCAN_CSS_STATE_FAILED;
|
gScanCssState = SCAN_CSS_STATE_FAILED;
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
|
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
|
{
|
||||||
|
if (gDTMF_DecodeRingCountdown_500ms > 0)
|
||||||
|
{ // make "ring-ring" sound
|
||||||
|
gDTMF_DecodeRingCountdown_500ms--;
|
||||||
|
AUDIO_PlayBeep(BEEP_880HZ_200MS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||||
|
|
||||||
|
if (gDTMF_CallState != DTMF_CALL_STATE_NONE &&
|
||||||
|
gCurrentFunction != FUNCTION_TRANSMIT &&
|
||||||
|
gCurrentFunction != FUNCTION_RECEIVE)
|
||||||
{
|
{
|
||||||
if (gDTMF_AUTO_RESET_TIME > 0)
|
if (gDTMF_AUTO_RESET_TIME > 0)
|
||||||
{
|
{
|
||||||
@ -1918,15 +1956,6 @@ void APP_TimeSlice500ms(void)
|
|||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_DecodeRing && gDTMF_DecodeRingCountdown_500ms > 0)
|
|
||||||
{
|
|
||||||
if ((--gDTMF_DecodeRingCountdown_500ms % 3) == 0)
|
|
||||||
AUDIO_PlayBeep(BEEP_440HZ_500MS);
|
|
||||||
|
|
||||||
if (gDTMF_DecodeRingCountdown_500ms == 0)
|
|
||||||
gDTMF_DecodeRing = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_IsTx && gDTMF_TxStopCountdown_500ms > 0)
|
if (gDTMF_IsTx && gDTMF_TxStopCountdown_500ms > 0)
|
||||||
@ -1937,15 +1966,6 @@ void APP_TimeSlice500ms(void)
|
|||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_RecvTimeout > 0)
|
|
||||||
{
|
|
||||||
if (--gDTMF_RecvTimeout == 0)
|
|
||||||
{
|
|
||||||
gDTMF_WriteIndex = 0;
|
|
||||||
memset(gDTMF_Received, 0, sizeof(gDTMF_Received));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@ -2022,9 +2042,13 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
if (Key == KEY_EXIT && bKeyPressed && bKeyHeld && gDTMF_RX_live[0] != 0)
|
if (Key == KEY_EXIT && bKeyPressed && bKeyHeld && gDTMF_RX_live[0] != 0)
|
||||||
{ // clear the live DTMF decoder if the EXIT key is held
|
{ // clear the live DTMF decoder if the EXIT key is held
|
||||||
gDTMF_RX_live_timeout = 0;
|
if (gDTMF_RX_live[0] != 0)
|
||||||
gDTMF_RX_live[0] = 0;
|
{
|
||||||
gUpdateDisplay = true;
|
gDTMF_RX_live_timeout = 0;
|
||||||
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed)
|
||||||
@ -2065,10 +2089,12 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
if (gDTMF_DecodeRing)
|
if (gDTMF_DecodeRingCountdown_500ms > 0)
|
||||||
{
|
{ // cancel the ringing
|
||||||
gDTMF_DecodeRing = false;
|
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||||
|
|
||||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||||
|
|
||||||
if (Key != KEY_PTT)
|
if (Key != KEY_PTT)
|
||||||
{
|
{
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
@ -2115,7 +2141,8 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
Key != KEY_EXIT &&
|
Key != KEY_EXIT &&
|
||||||
Key != KEY_SIDE1 &&
|
Key != KEY_SIDE1 &&
|
||||||
Key != KEY_SIDE2 &&
|
Key != KEY_SIDE2 &&
|
||||||
Key != KEY_STAR)
|
Key != KEY_STAR &&
|
||||||
|
Key != KEY_MENU)
|
||||||
{
|
{
|
||||||
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
{ // frequency or CTCSS/DCS scanning
|
{ // frequency or CTCSS/DCS scanning
|
||||||
@ -2147,7 +2174,8 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gWasFKeyPressed && Key > KEY_9 && Key != KEY_F && Key != KEY_STAR && Key != KEY_MENU)
|
if (gWasFKeyPressed && Key > KEY_9 && Key != KEY_F && Key != KEY_STAR)
|
||||||
|
// if (gWasFKeyPressed && Key > KEY_9 && Key != KEY_F && Key != KEY_STAR && Key != KEY_MENU)
|
||||||
{
|
{
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
@ -2203,7 +2231,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gEeprom.DTMF_SIDE_TONE)
|
if (gEeprom.DTMF_SIDE_TONE)
|
||||||
{
|
{ // user will here the DTMF tones in speaker
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
}
|
}
|
||||||
@ -2416,7 +2444,7 @@ Skip:
|
|||||||
if (gFlagStartScan)
|
if (gFlagStartScan)
|
||||||
{
|
{
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||||
AUDIO_PlaySingleVoice(true);
|
AUDIO_PlaySingleVoice(true);
|
||||||
|
194
app/dtmf.c
194
app/dtmf.c
@ -22,6 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "app/scanner.h"
|
#include "app/scanner.h"
|
||||||
#include "bsp/dp32g030/gpio.h"
|
#include "bsp/dp32g030/gpio.h"
|
||||||
|
#include "audio.h"
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
#include "driver/eeprom.h"
|
#include "driver/eeprom.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
@ -33,12 +34,16 @@
|
|||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
char gDTMF_String[15];
|
char gDTMF_String[15];
|
||||||
char gDTMF_InputBox[15];
|
|
||||||
|
|
||||||
char gDTMF_Received[16];
|
char gDTMF_InputBox[15];
|
||||||
uint8_t gDTMF_WriteIndex = 0;
|
uint8_t gDTMF_InputIndex = 0;
|
||||||
|
bool gDTMF_InputMode = false;
|
||||||
uint8_t gDTMF_PreviousIndex = 0;
|
uint8_t gDTMF_PreviousIndex = 0;
|
||||||
uint8_t gDTMF_RecvTimeout = 0;
|
|
||||||
|
char gDTMF_RX[17];
|
||||||
|
uint8_t gDTMF_RX_index = 0;
|
||||||
|
uint8_t gDTMF_RX_timeout = 0;
|
||||||
|
bool gDTMF_RX_pending = false;
|
||||||
|
|
||||||
char gDTMF_RX_live[20];
|
char gDTMF_RX_live[20];
|
||||||
uint8_t gDTMF_RX_live_timeout = 0;
|
uint8_t gDTMF_RX_live_timeout = 0;
|
||||||
@ -48,12 +53,9 @@ char gDTMF_ID[4];
|
|||||||
char gDTMF_Caller[4];
|
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;
|
|
||||||
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
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;
|
|
||||||
bool gDTMF_InputMode;
|
|
||||||
DTMF_CallState_t gDTMF_CallState;
|
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;
|
||||||
@ -61,14 +63,22 @@ bool gDTMF_IsTx;
|
|||||||
uint8_t gDTMF_TxStopCountdown_500ms;
|
uint8_t gDTMF_TxStopCountdown_500ms;
|
||||||
bool gDTMF_IsGroupCall;
|
bool gDTMF_IsGroupCall;
|
||||||
|
|
||||||
bool DTMF_ValidateCodes(char *pCode, uint8_t Size)
|
void DTMF_clear_RX(void)
|
||||||
|
{
|
||||||
|
gDTMF_RX_timeout = 0;
|
||||||
|
gDTMF_RX_index = 0;
|
||||||
|
gDTMF_RX_pending = false;
|
||||||
|
memset(gDTMF_RX, 0, sizeof(gDTMF_RX));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DTMF_ValidateCodes(char *pCode, const unsigned int size)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (pCode[0] == 0xFF || pCode[0] == 0)
|
if (pCode[0] == 0xFF || pCode[0] == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (i = 0; i < Size; i++)
|
for (i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
if (pCode[i] == 0xFF || pCode[i] == 0)
|
if (pCode[i] == 0xFF || pCode[i] == 0)
|
||||||
{
|
{
|
||||||
@ -121,16 +131,16 @@ bool DTMF_FindContact(const char *pContact, char *pResult)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char DTMF_GetCharacter(const uint8_t code)
|
char DTMF_GetCharacter(const unsigned int code)
|
||||||
{
|
{
|
||||||
const char list[] = "0123456789ABCD*#";
|
const char list[] = "0123456789ABCD*#";
|
||||||
return (code < ARRAY_SIZE(list)) ? list[code] : 0xFF;
|
return (code < ARRAY_SIZE(list)) ? list[code] : 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, uint8_t Size, bool bCheckGroup)
|
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < Size; i++)
|
for (i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
if (pMsg[i] != pTemplate[i])
|
if (pMsg[i] != pTemplate[i])
|
||||||
{
|
{
|
||||||
@ -140,58 +150,69 @@ bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, uint8_t Size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DTMF_CALL_MODE_NOT_GROUP;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, uint32_t Size)
|
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
unsigned int i;
|
||||||
for (i = 0; i < Size; i++)
|
for (i = 0; i < size; i++)
|
||||||
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE)
|
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE)
|
||||||
break;
|
break;
|
||||||
return (i != Size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
|
|
||||||
|
return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DTMF_Append(char Code)
|
void DTMF_Append(const char code)
|
||||||
{
|
{
|
||||||
if (gDTMF_InputIndex == 0)
|
if (gDTMF_InputIndex == 0)
|
||||||
{
|
{
|
||||||
memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox));
|
memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox));
|
||||||
gDTMF_InputBox[sizeof(gDTMF_InputBox) - 1] = 0;
|
gDTMF_InputBox[sizeof(gDTMF_InputBox) - 1] = 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (gDTMF_InputIndex >= sizeof(gDTMF_InputBox))
|
|
||||||
return;
|
|
||||||
|
|
||||||
gDTMF_InputBox[gDTMF_InputIndex++] = Code;
|
if (gDTMF_InputIndex < sizeof(gDTMF_InputBox))
|
||||||
|
gDTMF_InputBox[gDTMF_InputIndex++] = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DTMF_HandleRequest(void)
|
void DTMF_HandleRequest(void)
|
||||||
{
|
{ // proccess the RX'ed DTMF characters
|
||||||
char String[20];
|
|
||||||
uint8_t Offset;
|
|
||||||
|
|
||||||
if (!gDTMF_RequestPending)
|
char String[20];
|
||||||
return;
|
unsigned int Offset;
|
||||||
|
|
||||||
gDTMF_RequestPending = false;
|
if (!gDTMF_RX_pending)
|
||||||
|
return; // nothing new received
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
|
{ // we're busy scanning
|
||||||
|
DTMF_clear_RX();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||||
|
{ // D-DCD is disabled or we're alive
|
||||||
|
DTMF_clear_RX();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gDTMF_RX_pending = false;
|
||||||
|
|
||||||
|
if (gDTMF_RX_index >= 9)
|
||||||
|
{ // look for the KILL code
|
||||||
|
|
||||||
if (gDTMF_WriteIndex >= 9)
|
|
||||||
{
|
|
||||||
Offset = gDTMF_WriteIndex - 9;
|
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.KILL_CODE);
|
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.KILL_CODE);
|
||||||
|
|
||||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, true))
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
{
|
|
||||||
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
|
{ // bugger
|
||||||
|
|
||||||
if (gEeprom.PERMIT_REMOTE_KILL)
|
if (gEeprom.PERMIT_REMOTE_KILL)
|
||||||
{
|
{
|
||||||
gSetting_KILLED = true;
|
gSetting_KILLED = true; // oooerr !
|
||||||
|
|
||||||
|
DTMF_clear_RX();
|
||||||
|
|
||||||
SETTINGS_SaveSettings();
|
SETTINGS_SaveSettings();
|
||||||
|
|
||||||
@ -212,82 +233,117 @@ void DTMF_HandleRequest(void)
|
|||||||
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gDTMF_RX_index >= 9)
|
||||||
|
{ // look for the REVIVE code
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
||||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, true))
|
|
||||||
{
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
|
|
||||||
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
|
{ // shit, we're back !
|
||||||
|
|
||||||
gSetting_KILLED = false;
|
gSetting_KILLED = false;
|
||||||
|
|
||||||
|
DTMF_clear_RX();
|
||||||
|
|
||||||
SETTINGS_SaveSettings();
|
SETTINGS_SaveSettings();
|
||||||
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_AB;
|
gDTMF_ReplyState = DTMF_REPLY_AB;
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_WriteIndex >= 2)
|
if (gDTMF_RX_index >= 2)
|
||||||
{
|
{ // look for ACK reply
|
||||||
if (DTMF_CompareMessage(gDTMF_Received + (gDTMF_WriteIndex - 2), "AB", 2, true))
|
|
||||||
{
|
strcpy(String, "AB");
|
||||||
gDTMF_State = DTMF_STATE_TX_SUCC;
|
|
||||||
gUpdateDisplay = true;
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
return;
|
|
||||||
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
|
{ // ends with "AB"
|
||||||
|
|
||||||
|
if (gDTMF_ReplyState != DTMF_REPLY_NONE) // 1of11
|
||||||
|
// if (gDTMF_CallState != DTMF_CALL_STATE_NONE) // 1of11
|
||||||
|
// if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) // 1of11
|
||||||
|
{
|
||||||
|
gDTMF_State = DTMF_STATE_TX_SUCC;
|
||||||
|
DTMF_clear_RX();
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT && gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP && gDTMF_WriteIndex >= 9)
|
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT &&
|
||||||
{
|
gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP &&
|
||||||
Offset = gDTMF_WriteIndex - 9;
|
gDTMF_RX_index >= 9)
|
||||||
|
{ // waiting for a reply
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||||
|
|
||||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, false))
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
{
|
|
||||||
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), false))
|
||||||
|
{ // we got a response
|
||||||
gDTMF_State = DTMF_STATE_CALL_OUT_RSP;
|
gDTMF_State = DTMF_STATE_CALL_OUT_RSP;
|
||||||
|
DTMF_clear_RX();
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gSetting_KILLED || gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
if (gSetting_KILLED || gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
{ // we've been killed or expecting a reply
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (gDTMF_WriteIndex >= 7)
|
if (gDTMF_RX_index >= 7)
|
||||||
{
|
{ // see if we're being called
|
||||||
Offset = gDTMF_WriteIndex - 7;
|
|
||||||
|
|
||||||
sprintf(String, "%s%c", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE);
|
|
||||||
|
|
||||||
gDTMF_IsGroupCall = false;
|
gDTMF_IsGroupCall = false;
|
||||||
|
|
||||||
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 4, true))
|
sprintf(String, "%s%c", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE);
|
||||||
{
|
|
||||||
|
Offset = gDTMF_RX_index - strlen(String) - 3;
|
||||||
|
|
||||||
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
|
{ // it's for us !
|
||||||
|
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED;
|
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED;
|
||||||
|
|
||||||
memmove(gDTMF_Callee, gDTMF_Received + Offset + 0, 3);
|
memset(gDTMF_Callee, 0, sizeof(gDTMF_Callee));
|
||||||
memmove(gDTMF_Caller, gDTMF_Received + Offset + 4, 3);
|
memset(gDTMF_Caller, 0, sizeof(gDTMF_Caller));
|
||||||
|
memmove(gDTMF_Callee, gDTMF_RX + Offset + 0, 3);
|
||||||
|
memmove(gDTMF_Caller, gDTMF_RX + Offset + 4, 3);
|
||||||
|
|
||||||
|
DTMF_clear_RX();
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
|
|
||||||
switch (gEeprom.DTMF_DECODE_RESPONSE)
|
switch (gEeprom.DTMF_DECODE_RESPONSE)
|
||||||
{
|
{
|
||||||
case 3:
|
case DTMF_DEC_RESPONSE_BOTH:
|
||||||
gDTMF_DecodeRing = true;
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
||||||
// Fallthrough
|
case DTMF_DEC_RESPONSE_REPLY:
|
||||||
case 2:
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
|
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case DTMF_DEC_RESPONSE_RING:
|
||||||
gDTMF_DecodeRing = true;
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gDTMF_DecodeRing = false;
|
case DTMF_DEC_RESPONSE_NONE:
|
||||||
|
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
33
app/dtmf.h
33
app/dtmf.h
@ -36,6 +36,13 @@ enum DTMF_CallState_t {
|
|||||||
DTMF_CALL_STATE_RECEIVED
|
DTMF_CALL_STATE_RECEIVED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum DTMF_DecodeResponse_t {
|
||||||
|
DTMF_DEC_RESPONSE_NONE = 0,
|
||||||
|
DTMF_DEC_RESPONSE_RING,
|
||||||
|
DTMF_DEC_RESPONSE_REPLY,
|
||||||
|
DTMF_DEC_RESPONSE_BOTH
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum DTMF_CallState_t DTMF_CallState_t;
|
typedef enum DTMF_CallState_t DTMF_CallState_t;
|
||||||
|
|
||||||
enum DTMF_ReplyState_t {
|
enum DTMF_ReplyState_t {
|
||||||
@ -56,12 +63,16 @@ enum DTMF_CallMode_t {
|
|||||||
typedef enum DTMF_CallMode_t DTMF_CallMode_t;
|
typedef enum DTMF_CallMode_t DTMF_CallMode_t;
|
||||||
|
|
||||||
extern char gDTMF_String[15];
|
extern char gDTMF_String[15];
|
||||||
extern char gDTMF_InputBox[15];
|
|
||||||
|
|
||||||
extern char gDTMF_Received[16];
|
extern char gDTMF_InputBox[15];
|
||||||
extern uint8_t gDTMF_WriteIndex;
|
extern uint8_t gDTMF_InputIndex;
|
||||||
|
extern bool gDTMF_InputMode;
|
||||||
extern uint8_t gDTMF_PreviousIndex;
|
extern uint8_t gDTMF_PreviousIndex;
|
||||||
extern uint8_t gDTMF_RecvTimeout;
|
|
||||||
|
extern char gDTMF_RX[17];
|
||||||
|
extern uint8_t gDTMF_RX_index;
|
||||||
|
extern uint8_t gDTMF_RX_timeout;
|
||||||
|
extern bool gDTMF_RX_pending;
|
||||||
|
|
||||||
extern char gDTMF_RX_live[20];
|
extern char gDTMF_RX_live[20];
|
||||||
extern uint8_t gDTMF_RX_live_timeout;
|
extern uint8_t gDTMF_RX_live_timeout;
|
||||||
@ -71,25 +82,23 @@ extern char gDTMF_ID[4];
|
|||||||
extern char gDTMF_Caller[4];
|
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 uint8_t gDTMF_DecodeRingCountdown_500ms;
|
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 bool gDTMF_InputMode;
|
|
||||||
extern DTMF_CallState_t gDTMF_CallState;
|
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_500ms;
|
extern uint8_t gDTMF_TxStopCountdown_500ms;
|
||||||
|
|
||||||
bool DTMF_ValidateCodes(char *pCode, uint8_t Size);
|
void DTMF_clear_RX(void);
|
||||||
|
bool DTMF_ValidateCodes(char *pCode, const unsigned int size);
|
||||||
bool DTMF_GetContact(const int Index, char *pContact);
|
bool DTMF_GetContact(const int Index, char *pContact);
|
||||||
bool DTMF_FindContact(const char *pContact, char *pResult);
|
bool DTMF_FindContact(const char *pContact, char *pResult);
|
||||||
char DTMF_GetCharacter(const uint8_t code);
|
char DTMF_GetCharacter(const unsigned int code);
|
||||||
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, uint8_t Size, bool bFlag);
|
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, const unsigned int size, const bool bFlag);
|
||||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, uint32_t Size);
|
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
|
||||||
void DTMF_Append(char Code);
|
void DTMF_Append(const char vode);
|
||||||
void DTMF_HandleRequest(void);
|
void DTMF_HandleRequest(void);
|
||||||
void DTMF_Reply(void);
|
void DTMF_Reply(void);
|
||||||
|
|
||||||
|
28
app/main.c
28
app/main.c
@ -452,9 +452,17 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed)
|
||||||
{
|
{ // exit key pressed
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
|
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
|
{ // clear CALL mode being displayed
|
||||||
|
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (!gFmRadioMode)
|
if (!gFmRadioMode)
|
||||||
#endif
|
#endif
|
||||||
@ -493,7 +501,8 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bKeyHeld && bKeyPressed)
|
if (bKeyHeld && bKeyPressed)
|
||||||
{
|
{ // exit key held down
|
||||||
|
|
||||||
if (gInputBoxIndex > 0)
|
if (gInputBoxIndex > 0)
|
||||||
{ // cancel key input mode (channel/frequency entry)
|
{ // cancel key input mode (channel/frequency entry)
|
||||||
gDTMF_InputMode = false;
|
gDTMF_InputMode = false;
|
||||||
@ -509,7 +518,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||||
{
|
{
|
||||||
if (bKeyHeld)
|
if (bKeyHeld)
|
||||||
{ // key held down (long press)
|
{ // menu key held down (long press)
|
||||||
|
|
||||||
if (bKeyPressed)
|
if (bKeyPressed)
|
||||||
{
|
{
|
||||||
@ -560,6 +569,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: finish this
|
||||||
|
|
||||||
//gEeprom.RX_CHANNEL = () & 1; // swap to the VFO
|
//gEeprom.RX_CHANNEL = () & 1; // swap to the VFO
|
||||||
|
|
||||||
@ -577,13 +587,13 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed && !gDTMF_InputMode)
|
||||||
{
|
{ // menu key released
|
||||||
bool bFlag;
|
const bool bFlag = (gInputBoxIndex == 0);
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
bFlag = (gInputBoxIndex == 0);
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
if (bFlag)
|
if (bFlag)
|
||||||
{
|
{
|
||||||
gFlagRefreshSetting = true;
|
gFlagRefreshSetting = true;
|
||||||
|
23
app/menu.c
23
app/menu.c
@ -109,11 +109,15 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
case MENU_XB:
|
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_CHAN) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_CHAN) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_XB:
|
||||||
|
*pMin = 0;
|
||||||
|
*pMax = ARRAY_SIZE(gSubMenu_XB) - 1;
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
case MENU_VOICE:
|
case MENU_VOICE:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
@ -591,13 +595,14 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_D_DCD:
|
case MENU_D_DCD:
|
||||||
gTxVfo->DTMF_DECODING_ENABLE = gSubMenuSelection;
|
gTxVfo->DTMF_DECODING_ENABLE = gSubMenuSelection;
|
||||||
gRequestSaveChannel = 1;
|
DTMF_clear_RX();
|
||||||
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
gDTMF_RX_live_timeout = 0;
|
|
||||||
gDTMF_RX_live[0] = '\0';
|
|
||||||
gSetting_live_DTMF_decoder = gSubMenuSelection;
|
gSetting_live_DTMF_decoder = gSubMenuSelection;
|
||||||
|
gDTMF_RX_live_timeout = 0;
|
||||||
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
if (!gSetting_live_DTMF_decoder)
|
if (!gSetting_live_DTMF_decoder)
|
||||||
BK4819_DisableDTMF();
|
BK4819_DisableDTMF();
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
@ -1317,9 +1322,13 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
|
|
||||||
gAskForConfirmation = 0;
|
gAskForConfirmation = 0;
|
||||||
gIsInSubMenu = true;
|
gIsInSubMenu = true;
|
||||||
gInputBoxIndex = 0;
|
|
||||||
edit_index = -1;
|
// if (gMenuCursor != MENU_D_LIST)
|
||||||
|
{
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
edit_index = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "app/dtmf.h"
|
||||||
#include "app/generic.h"
|
#include "app/generic.h"
|
||||||
#include "app/scanner.h"
|
#include "app/scanner.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
@ -399,12 +400,13 @@ void SCANNER_Start(void)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DTMF_clear_RX();
|
||||||
|
|
||||||
gScanDelay_10ms = scan_delay_10ms;
|
gScanDelay_10ms = scan_delay_10ms;
|
||||||
gScanCssResultCode = 0xFF;
|
gScanCssResultCode = 0xFF;
|
||||||
gScanCssResultType = 0xFF;
|
gScanCssResultType = 0xFF;
|
||||||
gScanHitCount = 0;
|
gScanHitCount = 0;
|
||||||
gScanUseCssResult = false;
|
gScanUseCssResult = false;
|
||||||
gDTMF_RequestPending = false;
|
|
||||||
g_CxCSS_TAIL_Found = false;
|
g_CxCSS_TAIL_Found = false;
|
||||||
g_CDCSS_Lost = false;
|
g_CDCSS_Lost = false;
|
||||||
gCDCSSCodeType = 0;
|
gCDCSSCodeType = 0;
|
||||||
|
15
audio.c
15
audio.c
@ -76,7 +76,12 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
uint16_t ToneFrequency;
|
uint16_t ToneFrequency;
|
||||||
uint16_t Duration;
|
uint16_t Duration;
|
||||||
|
|
||||||
if (Beep != BEEP_880HZ_60MS_TRIPLE_BEEP && Beep != BEEP_500HZ_60MS_DOUBLE_BEEP && Beep != BEEP_440HZ_500MS && !gEeprom.BEEP_CONTROL)
|
if (Beep != BEEP_880HZ_60MS_TRIPLE_BEEP &&
|
||||||
|
Beep != BEEP_500HZ_60MS_DOUBLE_BEEP &&
|
||||||
|
Beep != BEEP_440HZ_500MS &&
|
||||||
|
Beep != BEEP_880HZ_200MS &&
|
||||||
|
Beep != BEEP_880HZ_500MS &&
|
||||||
|
!gEeprom.BEEP_CONTROL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
@ -123,6 +128,8 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
break;
|
break;
|
||||||
case BEEP_880HZ_40MS_OPTIONAL:
|
case BEEP_880HZ_40MS_OPTIONAL:
|
||||||
case BEEP_880HZ_60MS_TRIPLE_BEEP:
|
case BEEP_880HZ_60MS_TRIPLE_BEEP:
|
||||||
|
case BEEP_880HZ_200MS:
|
||||||
|
case BEEP_880HZ_500MS:
|
||||||
ToneFrequency = 880;
|
ToneFrequency = 880;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -161,7 +168,13 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
Duration = 40;
|
Duration = 40;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BEEP_880HZ_200MS:
|
||||||
|
BK4819_ExitTxMute();
|
||||||
|
Duration = 200;
|
||||||
|
break;
|
||||||
|
|
||||||
case BEEP_440HZ_500MS:
|
case BEEP_440HZ_500MS:
|
||||||
|
case BEEP_880HZ_500MS:
|
||||||
default:
|
default:
|
||||||
BK4819_ExitTxMute();
|
BK4819_ExitTxMute();
|
||||||
Duration = 500;
|
Duration = 500;
|
||||||
|
2
audio.h
2
audio.h
@ -26,6 +26,8 @@ enum BEEP_Type_t
|
|||||||
BEEP_1KHZ_60MS_OPTIONAL,
|
BEEP_1KHZ_60MS_OPTIONAL,
|
||||||
BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL,
|
BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL,
|
||||||
BEEP_440HZ_500MS,
|
BEEP_440HZ_500MS,
|
||||||
|
BEEP_880HZ_200MS,
|
||||||
|
BEEP_880HZ_500MS,
|
||||||
BEEP_500HZ_60MS_DOUBLE_BEEP,
|
BEEP_500HZ_60MS_DOUBLE_BEEP,
|
||||||
BEEP_440HZ_40MS_OPTIONAL,
|
BEEP_440HZ_40MS_OPTIONAL,
|
||||||
BEEP_880HZ_40MS_OPTIONAL,
|
BEEP_880HZ_40MS_OPTIONAL,
|
||||||
|
@ -891,7 +891,7 @@ void BK4819_EnableDTMF(void)
|
|||||||
// REG_24 <3:0> 14 Max symbol number for SelCall detection
|
// REG_24 <3:0> 14 Max symbol number for SelCall detection
|
||||||
|
|
||||||
// const uint16_t threshold = 24; // doesn't decode non-QS radios
|
// const uint16_t threshold = 24; // doesn't decode non-QS radios
|
||||||
const uint16_t threshold = 200; // but 128 ~ 247 does
|
const uint16_t threshold = 140; // but 128 ~ 247 does
|
||||||
BK4819_WriteRegister(BK4819_REG_24, // 1 00011000 1 1 1 1110
|
BK4819_WriteRegister(BK4819_REG_24, // 1 00011000 1 1 1 1110
|
||||||
(1u << BK4819_REG_24_SHIFT_UNKNOWN_15)
|
(1u << BK4819_REG_24_SHIFT_UNKNOWN_15)
|
||||||
| (threshold << BK4819_REG_24_SHIFT_THRESHOLD) // 0 ~ 255
|
| (threshold << BK4819_REG_24_SHIFT_THRESHOLD) // 0 ~ 255
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
20
functions.c
20
functions.c
@ -53,15 +53,8 @@ void FUNCTION_Init(void)
|
|||||||
gCurrentCodeType = CODE_TYPE_CONTINUOUS_TONE;
|
gCurrentCodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gDTMF_RequestPending = false;
|
DTMF_clear_RX();
|
||||||
|
|
||||||
gDTMF_RecvTimeout = 0;
|
|
||||||
gDTMF_WriteIndex = 0;
|
|
||||||
memset(gDTMF_Received, 0, sizeof(gDTMF_Received));
|
|
||||||
|
|
||||||
// gDTMF_RX_timeout_live = 0;
|
|
||||||
// gDTMF_RX_timeout_live[0] = '\0';
|
|
||||||
|
|
||||||
g_CxCSS_TAIL_Found = false;
|
g_CxCSS_TAIL_Found = false;
|
||||||
g_CDCSS_Lost = false;
|
g_CDCSS_Lost = false;
|
||||||
g_CTCSS_Lost = false;
|
g_CTCSS_Lost = false;
|
||||||
@ -152,8 +145,13 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
|
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
|
||||||
BK4819_DisableDTMF();
|
BK4819_DisableDTMF();
|
||||||
|
|
||||||
|
// clear the DTMF RX buffer
|
||||||
|
DTMF_clear_RX();
|
||||||
|
|
||||||
|
// clear the DTMF RX live decoder buffer
|
||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
gDTMF_RX_live[0] = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
|
||||||
#if defined(ENABLE_FMRADIO)
|
#if defined(ENABLE_FMRADIO)
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
@ -189,7 +187,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
|
|
||||||
RADIO_SetTxParameters();
|
RADIO_SetTxParameters();
|
||||||
|
|
||||||
// turn the LED on RED
|
// turn the RED LED on
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
||||||
|
|
||||||
DTMF_Reply();
|
DTMF_Reply();
|
||||||
|
3
misc.c
3
misc.c
@ -28,7 +28,7 @@ const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
|||||||
|
|
||||||
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||||
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
||||||
const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds
|
const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
|
||||||
const uint8_t DTMF_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
const uint8_t DTMF_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
||||||
|
|
||||||
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
|
const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds
|
||||||
@ -174,7 +174,6 @@ bool gFlagSaveChannel;
|
|||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
bool gFlagSaveFM;
|
bool gFlagSaveFM;
|
||||||
#endif
|
#endif
|
||||||
uint8_t gDTMF_RequestPending;
|
|
||||||
bool g_CDCSS_Lost;
|
bool g_CDCSS_Lost;
|
||||||
uint8_t gCDCSSCodeType;
|
uint8_t gCDCSSCodeType;
|
||||||
bool g_CTCSS_Lost;
|
bool g_CTCSS_Lost;
|
||||||
|
1
misc.h
1
misc.h
@ -238,7 +238,6 @@ extern bool gFlagSaveChannel;
|
|||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
extern bool gFlagSaveFM;
|
extern bool gFlagSaveFM;
|
||||||
#endif
|
#endif
|
||||||
extern uint8_t gDTMF_RequestPending;
|
|
||||||
extern bool g_CDCSS_Lost;
|
extern bool g_CDCSS_Lost;
|
||||||
extern uint8_t gCDCSSCodeType;
|
extern uint8_t gCDCSSCodeType;
|
||||||
extern bool g_CTCSS_Lost;
|
extern bool g_CTCSS_Lost;
|
||||||
|
5
radio.c
5
radio.c
@ -747,9 +747,6 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// there's no reason the DTMF decoder can't be used in AM RX mode too
|
|
||||||
// aircraft comms use it on HF (AM and SSB)
|
|
||||||
// if (gRxVfo->AM_mode || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED))
|
|
||||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||||
{
|
{
|
||||||
BK4819_DisableDTMF();
|
BK4819_DisableDTMF();
|
||||||
@ -760,7 +757,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT && gSetting_live_DTMF_decoder)
|
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
{
|
{
|
||||||
BK4819_EnableDTMF();
|
BK4819_EnableDTMF();
|
||||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||||
|
@ -214,7 +214,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
| (pVFO->OUTPUT_POWER << 2)
|
| (pVFO->OUTPUT_POWER << 2)
|
||||||
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
||||||
| (pVFO->FrequencyReverse << 0);
|
| (pVFO->FrequencyReverse << 0);
|
||||||
State[5] = (pVFO->DTMF_PTT_ID_TX_MODE << 1) | (pVFO->DTMF_DECODING_ENABLE < 0);
|
State[5] = (pVFO->DTMF_PTT_ID_TX_MODE << 1) | (pVFO->DTMF_DECODING_ENABLE << 0);
|
||||||
State[6] = pVFO->STEP_SETTING;
|
State[6] = pVFO->STEP_SETTING;
|
||||||
State[7] = pVFO->SCRAMBLING_TYPE;
|
State[7] = pVFO->SCRAMBLING_TYPE;
|
||||||
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
||||||
|
41
ui/main.c
41
ui/main.c
@ -36,6 +36,8 @@
|
|||||||
#include "ui/main.h"
|
#include "ui/main.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
|
bool center_line_is_free = true;
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
@ -180,6 +182,9 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
|||||||
{
|
{
|
||||||
#ifdef ENABLE_RSSI_BAR
|
#ifdef ENABLE_RSSI_BAR
|
||||||
|
|
||||||
|
if (!center_line_is_free)
|
||||||
|
return;
|
||||||
|
|
||||||
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
|
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
gCurrentFunction == FUNCTION_MONITOR ||
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
gCurrentFunction == FUNCTION_INCOMING);
|
gCurrentFunction == FUNCTION_INCOMING);
|
||||||
@ -286,8 +291,9 @@ void UI_DisplayMain(void)
|
|||||||
{
|
{
|
||||||
char String[16];
|
char String[16];
|
||||||
unsigned int vfo_num;
|
unsigned int vfo_num;
|
||||||
bool center_line_is_free = true;
|
|
||||||
|
|
||||||
|
center_line_is_free = true;
|
||||||
|
|
||||||
// #ifdef SINGLE_VFO_CHAN
|
// #ifdef SINGLE_VFO_CHAN
|
||||||
// const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false;
|
// const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false;
|
||||||
// #else
|
// #else
|
||||||
@ -338,7 +344,7 @@ void UI_DisplayMain(void)
|
|||||||
strcpy(String, (gDTMF_State == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT");
|
strcpy(String, (gDTMF_State == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT");
|
||||||
else
|
else
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
||||||
sprintf(String, "CALL:%s", (DTMF_FindContact(gDTMF_Caller, Contact)) ? Contact : gDTMF_Caller);
|
sprintf(String, "CALL FRM:%s", (DTMF_FindContact(gDTMF_Caller, Contact)) ? Contact : gDTMF_Caller);
|
||||||
else
|
else
|
||||||
if (gDTMF_IsTx)
|
if (gDTMF_IsTx)
|
||||||
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");
|
||||||
@ -680,7 +686,7 @@ void UI_DisplayMain(void)
|
|||||||
UI_PrintStringSmall(String, LCD_WIDTH + 70, 0, Line + 1);
|
UI_PrintStringSmall(String, LCD_WIDTH + 70, 0, Line + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the DTMF decoding symbol(
|
// show the DTMF decoding symbol
|
||||||
if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED)
|
if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||||
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, Line + 1);
|
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, Line + 1);
|
||||||
|
|
||||||
@ -722,15 +728,26 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
if (rx || gCurrentFunction == FUNCTION_FOREGROUND)
|
if (rx || gCurrentFunction == FUNCTION_FOREGROUND)
|
||||||
{
|
{
|
||||||
if (gSetting_live_DTMF_decoder && gDTMF_RX_live[0] >= 32)
|
#if 1
|
||||||
{ // show live DTMF decode
|
if (gSetting_live_DTMF_decoder && gDTMF_RX_live[0] != 0)
|
||||||
const unsigned int len = strlen(gDTMF_RX_live);
|
{ // show live DTMF decode
|
||||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
const unsigned int len = strlen(gDTMF_RX_live);
|
||||||
strcpy(String, "DTMF ");
|
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||||
strcat(String, gDTMF_RX_live + idx);
|
strcpy(String, "DTMF ");
|
||||||
UI_PrintStringSmall(String, 2, 0, 3);
|
strcat(String, gDTMF_RX_live + idx);
|
||||||
}
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (gSetting_live_DTMF_decoder && gDTMF_RX_index > 0)
|
||||||
|
{ // show live DTMF decode
|
||||||
|
const unsigned int len = gDTMF_RX_index;
|
||||||
|
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||||
|
strcpy(String, "DTMF ");
|
||||||
|
strcat(String, gDTMF_RX + idx);
|
||||||
|
UI_PrintStringSmall(String, 2, 0, 3);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_SHOW_CHARGE_LEVEL
|
#ifdef ENABLE_SHOW_CHARGE_LEVEL
|
||||||
else
|
else
|
||||||
if (gChargingWithTypeC)
|
if (gChargingWithTypeC)
|
||||||
|
16
ui/menu.c
16
ui/menu.c
@ -184,8 +184,15 @@ const char gSubMenu_TOT[11][7] =
|
|||||||
const char gSubMenu_CHAN[3][7] =
|
const char gSubMenu_CHAN[3][7] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"OFF",
|
||||||
"CHAN_A",
|
"CHAN A",
|
||||||
"CHAN_B"
|
"CHAN B"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char gSubMenu_XB[3][7] =
|
||||||
|
{
|
||||||
|
"SAME",
|
||||||
|
"CHAN A",
|
||||||
|
"CHAN B"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@ -575,10 +582,13 @@ void UI_DisplayMenu(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
case MENU_XB:
|
|
||||||
strcpy(String, gSubMenu_CHAN[gSubMenuSelection]);
|
strcpy(String, gSubMenu_CHAN[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_XB:
|
||||||
|
strcpy(String, gSubMenu_XB[gSubMenuSelection]);
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
case MENU_TOT:
|
||||||
strcpy(String, gSubMenu_TOT[gSubMenuSelection]);
|
strcpy(String, gSubMenu_TOT[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
@ -125,6 +125,7 @@ extern const char gSubMenu_OFF_ON[2][4];
|
|||||||
extern const char gSubMenu_SAVE[5][4];
|
extern const char gSubMenu_SAVE[5][4];
|
||||||
extern const char gSubMenu_TOT[11][7];
|
extern const char gSubMenu_TOT[11][7];
|
||||||
extern const char gSubMenu_CHAN[3][7];
|
extern const char gSubMenu_CHAN[3][7];
|
||||||
|
extern const char gSubMenu_XB[3][7];
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
extern const char gSubMenu_VOICE[3][4];
|
extern const char gSubMenu_VOICE[3][4];
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user