mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-22 01:32:43 +00:00
Part of the recent changes form 1o11, including DTMF input box error #19
This commit is contained in:
parent
60ccd3372f
commit
063dc61e65
@ -334,10 +334,10 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (gDTMF_InputIndex > 0)
|
if (gDTMF_InputBox_Index > 0)
|
||||||
{
|
{
|
||||||
gDTMF_InputBox[--gDTMF_InputIndex] = '-';
|
gDTMF_InputBox[--gDTMF_InputBox_Index] = '-';
|
||||||
if (gDTMF_InputIndex > 0)
|
if (gDTMF_InputBox_Index > 0)
|
||||||
{
|
{
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
379
app/app.c
379
app/app.c
@ -1367,27 +1367,20 @@ void APP_CheckKeys(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gDebounceCounter < key_repeat_delay_10ms)
|
||||||
|
return;
|
||||||
|
|
||||||
// key is being held pressed
|
// key is being held pressed
|
||||||
|
|
||||||
if (gDebounceCounter == key_repeat_delay_10ms)
|
if (gDebounceCounter == key_repeat_delay_10ms)
|
||||||
{ // initial delay after pressed
|
{ // initial key repeat delay after pressed
|
||||||
if (Key == KEY_STAR ||
|
if (Key != KEY_PTT)
|
||||||
Key == KEY_F ||
|
|
||||||
Key == KEY_SIDE2 ||
|
|
||||||
Key == KEY_SIDE1 ||
|
|
||||||
Key == KEY_UP ||
|
|
||||||
Key == KEY_DOWN ||
|
|
||||||
Key == KEY_EXIT ||
|
|
||||||
Key == KEY_MENU ||
|
|
||||||
(Key >= KEY_0 && Key <= KEY_9)) // keys 0-9 can be held down to bypass pressing the F-Key
|
|
||||||
{
|
{
|
||||||
gKeyBeingHeld = true;
|
gKeyBeingHeld = true;
|
||||||
APP_ProcessKey(Key, true, true);
|
APP_ProcessKey(Key, true, true);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (gDebounceCounter > key_repeat_delay_10ms)
|
|
||||||
{ // key repeat
|
{ // key repeat
|
||||||
if (Key == KEY_UP || Key == KEY_DOWN)
|
if (Key == KEY_UP || Key == KEY_DOWN)
|
||||||
{
|
{
|
||||||
@ -1400,7 +1393,6 @@ void APP_CheckKeys(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
gDebounceCounter = key_repeat_delay_10ms;
|
gDebounceCounter = key_repeat_delay_10ms;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1433,34 +1425,23 @@ void APP_TimeSlice10ms(void)
|
|||||||
if (gCurrentFunction != FUNCTION_POWER_SAVE || !gRxIdleMode)
|
if (gCurrentFunction != FUNCTION_POWER_SAVE || !gRxIdleMode)
|
||||||
APP_CheckRadioInterrupts();
|
APP_CheckRadioInterrupts();
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
{ // receiving
|
|
||||||
if (gUpdateStatus)
|
|
||||||
UI_DisplayStatus(false);
|
|
||||||
|
|
||||||
if (gUpdateDisplay)
|
|
||||||
{
|
|
||||||
gUpdateDisplay = false;
|
|
||||||
GUI_DisplayScreen();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // transmitting
|
{ // transmitting
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
if (gSetting_mic_bar && (gFlashLightBlinkCounter % (150 / 10)) == 0) // once every 150ms
|
if (gSetting_mic_bar && (gFlashLightBlinkCounter % (150 / 10)) == 0) // once every 150ms
|
||||||
UI_DisplayAudioBar();
|
UI_DisplayAudioBar();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gUpdateDisplay)
|
|
||||||
{
|
|
||||||
gUpdateDisplay = false;
|
|
||||||
GUI_DisplayScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gUpdateStatus)
|
|
||||||
UI_DisplayStatus(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gUpdateDisplay)
|
||||||
|
{
|
||||||
|
gUpdateDisplay = false;
|
||||||
|
GUI_DisplayScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gUpdateStatus)
|
||||||
|
UI_DisplayStatus(false);
|
||||||
|
|
||||||
// Skipping authentic device checks
|
// Skipping authentic device checks
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@ -1474,7 +1455,7 @@ void APP_TimeSlice10ms(void)
|
|||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
if (gVoxResumeCountdown > 0)
|
if (gVoxResumeCountdown > 0)
|
||||||
gVoxResumeCountdown--;
|
gVoxResumeCountdown--;
|
||||||
|
|
||||||
if (gVoxPauseCountdown > 0)
|
if (gVoxPauseCountdown > 0)
|
||||||
gVoxPauseCountdown--;
|
gVoxPauseCountdown--;
|
||||||
#endif
|
#endif
|
||||||
@ -1567,9 +1548,11 @@ void APP_TimeSlice10ms(void)
|
|||||||
|
|
||||||
if (gScanDelay_10ms > 0)
|
if (gScanDelay_10ms > 0)
|
||||||
{
|
{
|
||||||
gScanDelay_10ms--;
|
if (--gScanDelay_10ms > 0)
|
||||||
APP_CheckKeys();
|
{
|
||||||
return;
|
APP_CheckKeys();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScannerEditState != 0)
|
if (gScannerEditState != 0)
|
||||||
@ -1698,23 +1681,30 @@ void APP_TimeSlice10ms(void)
|
|||||||
|
|
||||||
void cancelUserInputModes(void)
|
void cancelUserInputModes(void)
|
||||||
{
|
{
|
||||||
gKeyInputCountdown = 0;
|
if (gDTMF_InputMode || gDTMF_InputBox_Index > 0)
|
||||||
if (gDTMF_InputMode || gInputBoxIndex > 0)
|
|
||||||
{
|
{
|
||||||
memset(gDTMF_String, 0, sizeof(gDTMF_String));
|
DTMF_clear_input_box();
|
||||||
gDTMF_InputMode = false;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
gDTMF_InputIndex = 0;
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
if (gWasFKeyPressed || gKeyInputCountdown > 0 || gInputBoxIndex > 0)
|
||||||
|
{
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
gKeyInputCountdown = 0;
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is called once every 500ms
|
// this is called once every 500ms
|
||||||
void APP_TimeSlice500ms(void)
|
void APP_TimeSlice500ms(void)
|
||||||
{
|
{
|
||||||
|
bool exit_menu = false;
|
||||||
|
|
||||||
// Skipped authentic device check
|
// Skipped authentic device check
|
||||||
|
|
||||||
if (gKeypadLocked > 0)
|
if (gKeypadLocked > 0)
|
||||||
@ -1722,9 +1712,19 @@ void APP_TimeSlice500ms(void)
|
|||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
|
|
||||||
if (gKeyInputCountdown > 0)
|
if (gKeyInputCountdown > 0)
|
||||||
|
{
|
||||||
if (--gKeyInputCountdown == 0)
|
if (--gKeyInputCountdown == 0)
|
||||||
|
{
|
||||||
cancelUserInputModes();
|
cancelUserInputModes();
|
||||||
|
|
||||||
|
if (gBeepToPlay != BEEP_NONE)
|
||||||
|
{
|
||||||
|
AUDIO_PlayBeep(gBeepToPlay);
|
||||||
|
gBeepToPlay = BEEP_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (gDTMF_RX_live_timeout > 0)
|
if (gDTMF_RX_live_timeout > 0)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_RSSI_BAR
|
#ifdef ENABLE_RSSI_BAR
|
||||||
@ -1742,16 +1742,15 @@ void APP_TimeSlice500ms(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gMenuCountdown > 0)
|
||||||
|
if (--gMenuCountdown == 0)
|
||||||
|
exit_menu = (gScreenToDisplay == DISPLAY_MENU); // exit menu mode
|
||||||
|
|
||||||
if (gDTMF_RX_timeout > 0)
|
if (gDTMF_RX_timeout > 0)
|
||||||
if (--gDTMF_RX_timeout == 0)
|
if (--gDTMF_RX_timeout == 0)
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
|
|
||||||
if (gSerialConfigCountDown_500ms > 0)
|
|
||||||
{
|
|
||||||
// gReducedService = true; // a serial config upload/download is in progress
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skipped authentic device check
|
// Skipped authentic device check
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@ -1763,6 +1762,16 @@ void APP_TimeSlice500ms(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (gBacklightCountdown > 0 && !gAskToSave && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
|
if (gScreenToDisplay != DISPLAY_MENU || gMenuCursor != MENU_ABR) // don't turn off backlight if user is in backlight menu option
|
||||||
|
if (--gBacklightCountdown == 0)
|
||||||
|
if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
||||||
|
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
|
||||||
|
|
||||||
|
if (gSerialConfigCountDown_500ms > 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
if (gReducedService)
|
if (gReducedService)
|
||||||
{
|
{
|
||||||
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);
|
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);
|
||||||
@ -1793,104 +1802,103 @@ void APP_TimeSlice500ms(void)
|
|||||||
gBatteryVoltageIndex = 0;
|
gBatteryVoltageIndex = 0;
|
||||||
BATTERY_GetReadings(true);
|
BATTERY_GetReadings(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// regular display updates (once every 2 sec) - if need be
|
||||||
|
if ((gBatteryCheckCounter & 3) == 0)
|
||||||
|
{
|
||||||
|
if (gChargingWithTypeC || gSetting_battery_text > 0)
|
||||||
|
gUpdateStatus = true;
|
||||||
|
#ifdef ENABLE_SHOW_CHARGE_LEVEL
|
||||||
|
if (gChargingWithTypeC)
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// regular display updates (once every 2 sec) - if need be
|
#ifdef ENABLE_FMRADIO
|
||||||
if ((gBatteryCheckCounter & 3) == 0)
|
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{
|
#else
|
||||||
if (gChargingWithTypeC || gSetting_battery_text > 0)
|
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
gUpdateStatus = true;
|
#endif
|
||||||
#ifdef ENABLE_SHOW_CHARGE_LEVEL
|
{
|
||||||
if (gChargingWithTypeC)
|
#ifdef ENABLE_AIRCOPY
|
||||||
gUpdateDisplay = true;
|
if (gScanStateDir == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
|
||||||
updateRSSI(gEeprom.RX_VFO);
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF)
|
|
||||||
#else
|
#else
|
||||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (gBacklightCountdown > 0)
|
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
|
||||||
if (gScreenToDisplay != DISPLAY_MENU || gMenuCursor != MENU_ABR) // don't turn off backlight if user is in backlight menu option
|
|
||||||
if (--gBacklightCountdown == 0)
|
|
||||||
if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
|
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
|
||||||
if (gScanStateDir == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
|
||||||
#else
|
|
||||||
if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
bool exit_menu = false;
|
if (--gKeyLockCountdown == 0)
|
||||||
|
gEeprom.KEY_LOCK = true; // lock the keyboard
|
||||||
|
gUpdateStatus = true; // lock symbol needs showing
|
||||||
|
}
|
||||||
|
|
||||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
|
if (exit_menu)
|
||||||
|
{
|
||||||
|
gMenuCountdown = 0;
|
||||||
|
|
||||||
|
if (gEeprom.BACKLIGHT == 0)
|
||||||
{
|
{
|
||||||
if (--gKeyLockCountdown == 0)
|
gBacklightCountdown = 0;
|
||||||
gEeprom.KEY_LOCK = true; // lock the keyboard
|
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||||
|
|
||||||
gUpdateStatus = true; // lock symbol needs showing
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMenuCountdown > 0)
|
if (gInputBoxIndex > 0 || gDTMF_InputMode)
|
||||||
if (--gMenuCountdown == 0)
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
exit_menu = true; // exit menu mode
|
/*
|
||||||
|
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||||
if (exit_menu)
|
|
||||||
{
|
{
|
||||||
gMenuCountdown = 0;
|
BK4819_StopScan();
|
||||||
|
|
||||||
if (gEeprom.BACKLIGHT == 0 && gScreenToDisplay == DISPLAY_MENU)
|
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||||
{
|
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||||
gBacklightCountdown = 0;
|
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gInputBoxIndex > 0 || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
|
RADIO_SetupRegisters(true);
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
}
|
||||||
|
*/
|
||||||
|
DTMF_clear_input_box();
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
gWasFKeyPressed = false;
|
||||||
{
|
gInputBoxIndex = 0;
|
||||||
BK4819_StopScan();
|
|
||||||
|
|
||||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
gAskToSave = false;
|
||||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
gAskToDelete = false;
|
||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
gUpdateStatus = true;
|
||||||
}
|
gUpdateDisplay = true;
|
||||||
|
|
||||||
gWasFKeyPressed = false;
|
{
|
||||||
gUpdateStatus = true;
|
GUI_DisplayType_t disp = DISPLAY_INVALID;
|
||||||
gInputBoxIndex = 0;
|
|
||||||
gDTMF_InputMode = false;
|
|
||||||
gDTMF_InputIndex = 0;
|
|
||||||
gAskToSave = false;
|
|
||||||
gAskToDelete = false;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode &&
|
if (gFmRadioMode &&
|
||||||
gCurrentFunction != FUNCTION_RECEIVE &&
|
gCurrentFunction != FUNCTION_RECEIVE &&
|
||||||
gCurrentFunction != FUNCTION_MONITOR &&
|
gCurrentFunction != FUNCTION_MONITOR &&
|
||||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
{
|
{
|
||||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
disp = DISPLAY_FM;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef ENABLE_CODE_SCAN_TIMEOUT
|
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
if (disp == DISPLAY_INVALID)
|
||||||
#endif
|
{
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
#ifndef ENABLE_CODE_SCAN_TIMEOUT
|
||||||
|
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||||
|
#endif
|
||||||
|
disp = DISPLAY_MAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disp != DISPLAY_INVALID)
|
||||||
|
GUI_SelectNextDisplay(disp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gCurrentFunction != FUNCTION_POWER_SAVE && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
|
updateRSSI(gEeprom.RX_VFO);
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (!gPttIsPressed && gFM_ResumeCountdown_500ms > 0)
|
if (!gPttIsPressed && gFM_ResumeCountdown_500ms > 0)
|
||||||
{
|
{
|
||||||
@ -1948,7 +1956,7 @@ void APP_TimeSlice500ms(void)
|
|||||||
//if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
//if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||||
|
|
||||||
ST7565_Configure_GPIO_B11();
|
ST7565_HardwareReset();
|
||||||
|
|
||||||
if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight off
|
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight off
|
||||||
@ -2000,7 +2008,10 @@ void APP_TimeSlice500ms(void)
|
|||||||
{
|
{
|
||||||
if (--gDTMF_auto_reset_time_500ms == 0)
|
if (--gDTMF_auto_reset_time_500ms == 0)
|
||||||
{
|
{
|
||||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED && gEeprom.DTMF_auto_reset_time >= DTMF_HOLD_MAX)
|
||||||
|
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED_STAY; // keep message on-screen till a key is pressed
|
||||||
|
else
|
||||||
|
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2127,7 +2138,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Key != KEY_PTT)
|
if (Key != KEY_PTT || gSetting_backlight_on_tx_rx == 1 || gSetting_backlight_on_tx_rx == 3)
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
if (Key == KEY_EXIT && bKeyHeld)
|
if (Key == KEY_EXIT && bKeyHeld)
|
||||||
@ -2140,6 +2151,9 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cancel user input
|
||||||
|
cancelUserInputModes();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
|
||||||
@ -2190,14 +2204,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Key != KEY_PTT &&
|
if ((Key >= KEY_0 && Key <= KEY_9) || Key == KEY_F)
|
||||||
Key != KEY_UP &&
|
|
||||||
Key != KEY_DOWN &&
|
|
||||||
Key != KEY_EXIT &&
|
|
||||||
Key != KEY_SIDE1 &&
|
|
||||||
Key != KEY_SIDE2 &&
|
|
||||||
Key != KEY_STAR &&
|
|
||||||
Key != KEY_MENU)
|
|
||||||
{
|
{
|
||||||
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
{ // FREQ/CTCSS/DCS scanning
|
{ // FREQ/CTCSS/DCS scanning
|
||||||
@ -2224,7 +2231,6 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
if (bKeyHeld)
|
if (bKeyHeld)
|
||||||
bFlag = true;
|
bFlag = true;
|
||||||
|
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed)
|
||||||
{
|
{
|
||||||
bFlag = true;
|
bFlag = true;
|
||||||
@ -2232,9 +2238,8 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gWasFKeyPressed && Key > KEY_9 && Key != KEY_F && Key != KEY_STAR)
|
if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2))
|
||||||
// if (gWasFKeyPressed && Key > KEY_9 && Key != KEY_F && Key != KEY_STAR && Key != KEY_MENU)
|
{ // cancel the F-key
|
||||||
{
|
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
@ -2248,59 +2253,58 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (gAlarmState == ALARM_STATE_OFF)
|
if (gAlarmState == ALARM_STATE_OFF)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
char Code;
|
||||||
|
|
||||||
if (Key == KEY_PTT)
|
if (Key == KEY_PTT)
|
||||||
{
|
{
|
||||||
GENERIC_Key_PTT(bKeyPressed);
|
GENERIC_Key_PTT(bKeyPressed);
|
||||||
|
goto Skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Key == KEY_SIDE2)
|
||||||
|
{ // transmit 1750Hz tone
|
||||||
|
Code = 0xFE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char Code;
|
Code = DTMF_GetCharacter(Key - KEY_0);
|
||||||
|
if (Code == 0xFF)
|
||||||
|
goto Skip;
|
||||||
|
|
||||||
if (Key == KEY_SIDE2)
|
// transmit DTMF keys
|
||||||
{ // transmit 1750Hz tone
|
}
|
||||||
Code = 0xFE;
|
|
||||||
}
|
if (!bKeyPressed || bKeyHeld)
|
||||||
else
|
{
|
||||||
|
if (!bKeyPressed)
|
||||||
{
|
{
|
||||||
Code = DTMF_GetCharacter(Key - KEY_0);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
if (Code == 0xFF)
|
|
||||||
goto Skip;
|
|
||||||
|
|
||||||
// transmit DTMF keys
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bKeyPressed || bKeyHeld)
|
gEnableSpeaker = false;
|
||||||
{
|
|
||||||
if (!bKeyPressed)
|
|
||||||
{
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
|
||||||
|
|
||||||
gEnableSpeaker = false;
|
BK4819_ExitDTMF_TX(false);
|
||||||
|
|
||||||
BK4819_ExitDTMF_TX(false);
|
if (gCurrentVfo->SCRAMBLING_TYPE == 0 || !gSetting_ScrambleEnable)
|
||||||
|
BK4819_DisableScramble();
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE == 0 || !gSetting_ScrambleEnable)
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
else
|
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (gEeprom.DTMF_SIDE_TONE)
|
|
||||||
{ // user will here the DTMF tones in speaker
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
|
||||||
gEnableSpeaker = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
BK4819_DisableScramble();
|
|
||||||
|
|
||||||
if (Code == 0xFE)
|
|
||||||
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
|
|
||||||
else
|
else
|
||||||
BK4819_PlayDTMFEx(gEeprom.DTMF_SIDE_TONE, Code);
|
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gEeprom.DTMF_SIDE_TONE)
|
||||||
|
{ // user will here the DTMF tones in speaker
|
||||||
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
gEnableSpeaker = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
BK4819_DisableScramble();
|
||||||
|
|
||||||
|
if (Code == 0xFE)
|
||||||
|
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
|
||||||
|
else
|
||||||
|
BK4819_PlayDTMFEx(gEeprom.DTMF_SIDE_TONE, Code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
else
|
else
|
||||||
@ -2308,13 +2312,8 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
ALARM_Off();
|
ALARM_Off();
|
||||||
|
|
||||||
// TODO: fix side key 1750, you have to press it twice to restart the tone :(
|
|
||||||
|
|
||||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||||
{
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
//if (gCurrentFunction != FUNCTION_FOREGROUND)
|
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
||||||
|
|
||||||
@ -2333,9 +2332,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
case DISPLAY_MAIN:
|
case DISPLAY_MAIN:
|
||||||
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
|
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
|
||||||
|
// bKeyHeld = false; // allow the channel setting to be saved
|
||||||
bKeyHeld = false; // allow the channel setting to be saved
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@ -2376,11 +2373,6 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed)
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Key == KEY_EXIT && bKeyHeld)
|
|
||||||
cancelUserInputModes();
|
|
||||||
}
|
|
||||||
|
|
||||||
Skip:
|
Skip:
|
||||||
if (gBeepToPlay != BEEP_NONE)
|
if (gBeepToPlay != BEEP_NONE)
|
||||||
@ -2402,7 +2394,6 @@ Skip:
|
|||||||
if (gFlagStopScan)
|
if (gFlagStopScan)
|
||||||
{
|
{
|
||||||
BK4819_StopScan();
|
BK4819_StopScan();
|
||||||
|
|
||||||
gFlagStopScan = false;
|
gFlagStopScan = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2509,6 +2500,8 @@ Skip:
|
|||||||
|
|
||||||
if (gFlagStartScan)
|
if (gFlagStartScan)
|
||||||
{
|
{
|
||||||
|
gFlagStartScan = false;
|
||||||
|
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@ -2519,7 +2512,6 @@ Skip:
|
|||||||
SCANNER_Start();
|
SCANNER_Start();
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||||
gFlagStartScan = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gFlagPrepareTX)
|
if (gFlagPrepareTX)
|
||||||
@ -2539,6 +2531,7 @@ Skip:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GUI_SelectNextDisplay(gRequestDisplayScreen);
|
GUI_SelectNextDisplay(gRequestDisplayScreen);
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_INVALID;
|
gRequestDisplayScreen = DISPLAY_INVALID;
|
||||||
|
|
||||||
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
43
app/dtmf.c
43
app/dtmf.c
@ -36,9 +36,9 @@
|
|||||||
char gDTMF_String[15];
|
char gDTMF_String[15];
|
||||||
|
|
||||||
char gDTMF_InputBox[15];
|
char gDTMF_InputBox[15];
|
||||||
uint8_t gDTMF_InputIndex = 0;
|
uint8_t gDTMF_InputBox_Index = 0;
|
||||||
bool gDTMF_InputMode = false;
|
bool gDTMF_InputMode = false;
|
||||||
uint8_t gDTMF_PreviousIndex = 0;
|
uint8_t gDTMF_PreviousIndex = 0;
|
||||||
|
|
||||||
char gDTMF_RX[17];
|
char gDTMF_RX[17];
|
||||||
uint8_t gDTMF_RX_index = 0;
|
uint8_t gDTMF_RX_index = 0;
|
||||||
@ -133,8 +133,26 @@ bool DTMF_FindContact(const char *pContact, char *pResult)
|
|||||||
|
|
||||||
char DTMF_GetCharacter(const unsigned int code)
|
char DTMF_GetCharacter(const unsigned int code)
|
||||||
{
|
{
|
||||||
const char list[] = "0123456789ABCD*#";
|
switch (code)
|
||||||
return (code < ARRAY_SIZE(list)) ? list[code] : 0xFF;
|
{
|
||||||
|
case KEY_0: return '0';
|
||||||
|
case KEY_1: return '1';
|
||||||
|
case KEY_2: return '2';
|
||||||
|
case KEY_3: return '3';
|
||||||
|
case KEY_4: return '4';
|
||||||
|
case KEY_5: return '5';
|
||||||
|
case KEY_6: return '6';
|
||||||
|
case KEY_7: return '7';
|
||||||
|
case KEY_8: return '8';
|
||||||
|
case KEY_9: return '9';
|
||||||
|
case KEY_MENU: return 'A';
|
||||||
|
case KEY_UP: return 'B';
|
||||||
|
case KEY_DOWN: return 'C';
|
||||||
|
case KEY_EXIT: return 'D';
|
||||||
|
case KEY_STAR: return '*';
|
||||||
|
case KEY_F: return '#';
|
||||||
|
default: return 0xff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
||||||
@ -163,16 +181,23 @@ DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
|||||||
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_clear_input_box(void)
|
||||||
|
{
|
||||||
|
memset(gDTMF_InputBox, 0, sizeof(gDTMF_InputBox));
|
||||||
|
gDTMF_InputBox_Index = 0;
|
||||||
|
gDTMF_InputMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
void DTMF_Append(const char code)
|
void DTMF_Append(const char code)
|
||||||
{
|
{
|
||||||
if (gDTMF_InputIndex == 0)
|
if (gDTMF_InputBox_Index == 0)
|
||||||
{
|
{
|
||||||
memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox));
|
memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox) - 1);
|
||||||
gDTMF_InputBox[sizeof(gDTMF_InputBox) - 1] = 0;
|
gDTMF_InputBox[sizeof(gDTMF_InputBox) - 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_InputIndex < sizeof(gDTMF_InputBox))
|
if (gDTMF_InputBox_Index < (sizeof(gDTMF_InputBox) - 1))
|
||||||
gDTMF_InputBox[gDTMF_InputIndex++] = code;
|
gDTMF_InputBox[gDTMF_InputBox_Index++] = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DTMF_HandleRequest(void)
|
void DTMF_HandleRequest(void)
|
||||||
|
11
app/dtmf.h
11
app/dtmf.h
@ -33,7 +33,8 @@ typedef enum DTMF_State_t DTMF_State_t;
|
|||||||
enum DTMF_CallState_t {
|
enum DTMF_CallState_t {
|
||||||
DTMF_CALL_STATE_NONE = 0,
|
DTMF_CALL_STATE_NONE = 0,
|
||||||
DTMF_CALL_STATE_CALL_OUT,
|
DTMF_CALL_STATE_CALL_OUT,
|
||||||
DTMF_CALL_STATE_RECEIVED
|
DTMF_CALL_STATE_RECEIVED,
|
||||||
|
DTMF_CALL_STATE_RECEIVED_STAY
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DTMF_DecodeResponse_t {
|
enum DTMF_DecodeResponse_t {
|
||||||
@ -60,12 +61,17 @@ enum DTMF_CallMode_t {
|
|||||||
DTMF_CALL_MODE_DTMF
|
DTMF_CALL_MODE_DTMF
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum { // seconds
|
||||||
|
DTMF_HOLD_MIN = 5,
|
||||||
|
DTMF_HOLD_MAX = 60
|
||||||
|
};
|
||||||
|
|
||||||
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_InputBox[15];
|
||||||
extern uint8_t gDTMF_InputIndex;
|
extern uint8_t gDTMF_InputBox_Index;
|
||||||
extern bool gDTMF_InputMode;
|
extern bool gDTMF_InputMode;
|
||||||
extern uint8_t gDTMF_PreviousIndex;
|
extern uint8_t gDTMF_PreviousIndex;
|
||||||
|
|
||||||
@ -98,6 +104,7 @@ bool DTMF_FindContact(const char *pContact, char *pResult);
|
|||||||
char DTMF_GetCharacter(const unsigned int code);
|
char DTMF_GetCharacter(const unsigned int code);
|
||||||
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, const unsigned int size, const 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, const unsigned int size);
|
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
|
||||||
|
void DTMF_clear_input_box(void);
|
||||||
void DTMF_Append(const char vode);
|
void DTMF_Append(const char vode);
|
||||||
void DTMF_HandleRequest(void);
|
void DTMF_HandleRequest(void);
|
||||||
void DTMF_Reply(void);
|
void DTMF_Reply(void);
|
||||||
|
255
app/generic.c
255
app/generic.c
@ -59,13 +59,13 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
#endif
|
#endif
|
||||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
{ // toggle the keyboad lock
|
{ // toggle the keyboad lock
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
||||||
|
|
||||||
gRequestSaveSettings = true;
|
gRequestSaveSettings = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,6 +81,9 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
gWasFKeyPressed = !gWasFKeyPressed;
|
gWasFKeyPressed = !gWasFKeyPressed;
|
||||||
|
|
||||||
|
if (gWasFKeyPressed)
|
||||||
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
if (!gWasFKeyPressed)
|
if (!gWasFKeyPressed)
|
||||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||||
@ -106,6 +109,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gBeepToPlay = BEEP_440HZ_500MS;
|
gBeepToPlay = BEEP_440HZ_500MS;
|
||||||
|
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,161 +119,154 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
|
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
|
||||||
{
|
{ // PTT released
|
||||||
//if (gScreenToDisplay == DISPLAY_MAIN)
|
|
||||||
{
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
{ // we are transmitting .. stop
|
||||||
|
|
||||||
|
if (gFlagEndTransmission)
|
||||||
{
|
{
|
||||||
if (gFlagEndTransmission)
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
{
|
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
APP_EndTransmission();
|
|
||||||
|
|
||||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
|
||||||
{
|
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
gFlagEndTransmission = false;
|
|
||||||
#ifdef ENABLE_VOX
|
|
||||||
gVOX_NoiseDetected = false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
APP_EndTransmission();
|
||||||
|
|
||||||
|
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||||
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
else
|
||||||
|
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
gFlagEndTransmission = false;
|
||||||
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVOX_NoiseDetected = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScanStateDir != SCAN_OFF)
|
// PTT pressed
|
||||||
{
|
|
||||||
SCANNER_Stop();
|
|
||||||
|
|
||||||
gPttDebounceCounter = 0;
|
if (gScanStateDir != SCAN_OFF || // frequency/channel scanning
|
||||||
gPttIsPressed = false;
|
gScreenToDisplay == DISPLAY_SCANNER || // CTCSS/CDCSS scanning
|
||||||
|
gCssScanMode != CSS_SCAN_MODE_OFF) // " "
|
||||||
|
{ // we're scanning .. stop
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
{ // CTCSS/CDCSS scanning .. stop
|
||||||
|
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
if (gFM_ScanState == FM_SCAN_OFF)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
|
||||||
{
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
if (gScreenToDisplay == DISPLAY_FM)
|
|
||||||
{
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
gPttIsPressed = false;
|
|
||||||
gPttDebounceCounter = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
|
||||||
{
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0)
|
|
||||||
{
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gFlagPrepareTX = true;
|
|
||||||
|
|
||||||
if (gDTMF_InputMode)
|
|
||||||
{
|
|
||||||
if (gDTMF_InputIndex > 0 || gDTMF_PreviousIndex > 0)
|
|
||||||
{
|
|
||||||
if (gDTMF_InputIndex == 0)
|
|
||||||
gDTMF_InputIndex = gDTMF_PreviousIndex;
|
|
||||||
|
|
||||||
gDTMF_InputBox[gDTMF_InputIndex] = 0;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// append our DTMF ID to the inputted DTMF code -
|
|
||||||
// IF the user inputted code is exactly 3 digits long
|
|
||||||
if (gDTMF_InputIndex == 3)
|
|
||||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
|
||||||
else
|
|
||||||
#else
|
|
||||||
// append our DTMF ID to the inputted DTMF code -
|
|
||||||
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
|
||||||
if (gDTMF_InputIndex == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
|
||||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
|
||||||
|
|
||||||
strcpy(gDTMF_String, gDTMF_InputBox);
|
|
||||||
|
|
||||||
gDTMF_PreviousIndex = gDTMF_InputIndex;
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_ANI;
|
|
||||||
gDTMF_State = DTMF_STATE_0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
|
|
||||||
gDTMF_InputMode = false;
|
|
||||||
gDTMF_InputIndex = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
|
|
||||||
gFlagPrepareTX = true;
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
gFlagStopScan = true;
|
gFlagStopScan = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
gFlagResetVfos = true;
|
gFlagResetVfos = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
if (gScanStateDir != SCAN_OFF)
|
||||||
|
{ // frequency/channel scanning . .stop
|
||||||
|
SCANNER_Stop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
|
{ // CTCSS/CDCSS scanning .. stop
|
||||||
MENU_StopCssScan();
|
MENU_StopCssScan();
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
#ifdef ENABLE_VOICE
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goto cancel_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
else
|
if (gFM_ScanState != FM_SCAN_OFF)
|
||||||
{
|
{ // FM radio is scanning .. stop
|
||||||
FM_PlayAndUpdate();
|
FM_PlayAndUpdate();
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
|
#endif
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
|
goto cancel_tx;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_FMRADIO
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
if (gScreenToDisplay == DISPLAY_FM)
|
||||||
|
goto start_tx; // listening to the FM radio .. start TX'ing
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gPttWasPressed = true;
|
if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0)
|
||||||
|
{ // already transmitting
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
|
if (!gDTMF_InputMode && gDTMF_InputBox_Index == 0)
|
||||||
|
goto start_tx; // wasn't entering a DTMF code .. start TX'ing (maybe)
|
||||||
|
|
||||||
|
// was entering a DTMF string
|
||||||
|
|
||||||
|
if (gDTMF_InputBox_Index > 0 || gDTMF_PreviousIndex > 0)
|
||||||
|
{ // going to transmit a DTMF string
|
||||||
|
|
||||||
|
if (gDTMF_InputBox_Index == 0 && gDTMF_PreviousIndex > 0)
|
||||||
|
gDTMF_InputBox_Index = gDTMF_PreviousIndex; // use the previous DTMF string
|
||||||
|
|
||||||
|
if (gDTMF_InputBox_Index < sizeof(gDTMF_InputBox))
|
||||||
|
gDTMF_InputBox[gDTMF_InputBox_Index] = 0; // NULL term the string
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// append our DTMF ID to the inputted DTMF code -
|
||||||
|
// IF the user inputted code is exactly 3 digits long
|
||||||
|
if (gDTMF_InputBox_Index == 3)
|
||||||
|
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
||||||
|
else
|
||||||
|
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
||||||
|
#else
|
||||||
|
// append our DTMF ID to the inputted DTMF code -
|
||||||
|
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
||||||
|
if (gDTMF_InputBox_Index == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
||||||
|
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
||||||
|
else
|
||||||
|
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// remember the DTMF string
|
||||||
|
gDTMF_PreviousIndex = gDTMF_InputBox_Index;
|
||||||
|
strcpy(gDTMF_String, gDTMF_InputBox);
|
||||||
|
|
||||||
|
gDTMF_ReplyState = DTMF_REPLY_ANI;
|
||||||
|
gDTMF_State = DTMF_STATE_0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DTMF_clear_input_box();
|
||||||
|
|
||||||
|
start_tx:
|
||||||
|
// request start TX
|
||||||
|
gFlagPrepareTX = true;
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
cancel_tx:
|
||||||
|
if (gPttIsPressed)
|
||||||
|
{
|
||||||
|
gPttIsPressed = false;
|
||||||
|
gPttWasPressed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
gPttDebounceCounter = 0;
|
||||||
|
if (gScreenToDisplay != DISPLAY_MENU && gRequestDisplayScreen != DISPLAY_FM) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
124
app/main.c
124
app/main.c
@ -198,7 +198,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gFlagStartScan = true;
|
gFlagStartScan = true;
|
||||||
gScanSingleFrequency = false;
|
gScanSingleFrequency = false;
|
||||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
@ -534,10 +534,10 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (bKeyHeld && bKeyPressed)
|
if (bKeyHeld && bKeyPressed)
|
||||||
{ // exit key held down
|
{ // exit key held down
|
||||||
|
|
||||||
if (gInputBoxIndex > 0)
|
if (gInputBoxIndex > 0 || gDTMF_InputBox_Index > 0 || gDTMF_InputMode)
|
||||||
{ // cancel key input mode (channel/frequency entry)
|
{ // cancel key input mode (channel/frequency entry)
|
||||||
gDTMF_InputMode = false;
|
gDTMF_InputMode = false;
|
||||||
gDTMF_InputIndex = 0;
|
gDTMF_InputBox_Index = 0;
|
||||||
memset(gDTMF_String, 0, sizeof(gDTMF_String));
|
memset(gDTMF_String, 0, sizeof(gDTMF_String));
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
@ -558,6 +558,8 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
if (bKeyPressed)
|
if (bKeyPressed)
|
||||||
{ // long press MENU key
|
{ // long press MENU key
|
||||||
|
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex > 0)
|
if (gInputBoxIndex > 0)
|
||||||
@ -642,6 +644,9 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
|
|
||||||
static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||||
{
|
{
|
||||||
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
|
return;
|
||||||
|
|
||||||
if (gInputBoxIndex)
|
if (gInputBoxIndex)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed)
|
||||||
@ -649,70 +654,67 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bKeyHeld || !bKeyPressed)
|
if (bKeyHeld && !gWasFKeyPressed)
|
||||||
{ // long press
|
{ // long press .. toggle scanning
|
||||||
|
if (!bKeyPressed)
|
||||||
|
return; // released
|
||||||
|
|
||||||
if (bKeyHeld || bKeyPressed)
|
ACTION_Scan(false);
|
||||||
{
|
|
||||||
if (!bKeyHeld)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!bKeyPressed)
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ACTION_Scan(false);
|
if (bKeyPressed)
|
||||||
|
{ // just pressed
|
||||||
return;
|
// gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
}
|
gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// just released
|
||||||
|
|
||||||
|
if (!gWasFKeyPressed)
|
||||||
|
{ // pressed without the F-key
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
#else
|
#else
|
||||||
if (gScanStateDir == SCAN_OFF)
|
if (gScanStateDir == SCAN_OFF)
|
||||||
#endif
|
#endif
|
||||||
{
|
{ // start entering a DTMF string
|
||||||
gKeyInputCountdown = key_input_timeout_500ms;
|
|
||||||
|
memmove(gDTMF_InputBox, gDTMF_String, MIN(sizeof(gDTMF_InputBox), sizeof(gDTMF_String) - 1));
|
||||||
|
gDTMF_InputBox_Index = 0;
|
||||||
gDTMF_InputMode = true;
|
gDTMF_InputMode = true;
|
||||||
memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox));
|
|
||||||
gDTMF_InputIndex = 0;
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // with the F-key
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
if (!gWasFKeyPressed)
|
|
||||||
{
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{
|
|
||||||
gFlagStartScan = true;
|
|
||||||
gScanSingleFrequency = true;
|
|
||||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
}
|
return;
|
||||||
#else
|
}
|
||||||
gFlagStartScan = true;
|
|
||||||
gScanSingleFrequency = true;
|
|
||||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gPttWasReleased = true;
|
// scan the CTCSS/DCS code
|
||||||
|
gFlagStartScan = true;
|
||||||
|
gScanSingleFrequency = true;
|
||||||
|
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||||
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gPttWasReleased = true;
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||||
@ -826,31 +828,25 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gDTMF_InputMode && bKeyPressed)
|
if (gDTMF_InputMode && bKeyPressed && !bKeyHeld)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld)
|
const char Character = DTMF_GetCharacter(Key);
|
||||||
{
|
if (Character != 0xFF)
|
||||||
const char Character = DTMF_GetCharacter(Key - KEY_0);
|
{ // add key to DTMF string
|
||||||
if (Character != 0xFF)
|
DTMF_Append(Character);
|
||||||
{ // add key to DTMF string
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
DTMF_Append(Character);
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
gPttWasReleased = true;
|
||||||
gKeyInputCountdown = key_input_timeout_500ms;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
return;
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
|
|
||||||
gPttWasReleased = true;
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: ???
|
// TODO: ???
|
||||||
if (Key > KEY_PTT)
|
// if (Key > KEY_PTT)
|
||||||
{
|
// {
|
||||||
Key = KEY_SIDE2; // what's this doing ???
|
// Key = KEY_SIDE2; // what's this doing ???
|
||||||
}
|
// }
|
||||||
|
|
||||||
switch (Key)
|
switch (Key)
|
||||||
{
|
{
|
||||||
|
@ -674,7 +674,7 @@ void MENU_AcceptSetting(void)
|
|||||||
{
|
{
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
gDTMF_InputMode = true;
|
gDTMF_InputMode = true;
|
||||||
gDTMF_InputIndex = 3;
|
gDTMF_InputBox_Index = 3;
|
||||||
memmove(gDTMF_InputBox, gDTMF_ID, 4);
|
memmove(gDTMF_InputBox, gDTMF_ID, 4);
|
||||||
gRequestDisplayScreen = DISPLAY_INVALID;
|
gRequestDisplayScreen = DISPLAY_INVALID;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
case 0:
|
case 0:
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
gFlagStopScan = true;
|
gFlagStopScan = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
|
@ -36,8 +36,8 @@ static const struct {
|
|||||||
// We are very fortunate.
|
// We are very fortunate.
|
||||||
// The key and pin defines fit together in a single u8, making this very efficient
|
// The key and pin defines fit together in a single u8, making this very efficient
|
||||||
struct {
|
struct {
|
||||||
uint8_t key : 5; // Key 23 is highest
|
KEY_Code_t key : 5;
|
||||||
uint8_t pin : 3; // Pin 6 is highest
|
uint8_t pin : 3; // Pin 6 is highest
|
||||||
} pins[4];
|
} pins[4];
|
||||||
|
|
||||||
} keyboard[] = {
|
} keyboard[] = {
|
||||||
@ -104,6 +104,8 @@ KEY_Code_t KEYBOARD_Poll(void)
|
|||||||
for (unsigned int j = 0; j < ARRAY_SIZE(keyboard); j++)
|
for (unsigned int j = 0; j < ARRAY_SIZE(keyboard); j++)
|
||||||
{
|
{
|
||||||
uint16_t reg;
|
uint16_t reg;
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int k;
|
||||||
|
|
||||||
// Set all high
|
// Set all high
|
||||||
GPIOA->DATA |= 1u << GPIOA_PIN_KEYBOARD_4 |
|
GPIOA->DATA |= 1u << GPIOA_PIN_KEYBOARD_4 |
|
||||||
@ -114,11 +116,22 @@ KEY_Code_t KEYBOARD_Poll(void)
|
|||||||
// Clear the pin we are selecting
|
// Clear the pin we are selecting
|
||||||
GPIOA->DATA &= keyboard[j].set_to_zero_mask;
|
GPIOA->DATA &= keyboard[j].set_to_zero_mask;
|
||||||
|
|
||||||
// Wait for the pins to stabilize
|
// Read all 4 GPIO pins at once .. with de-noise, max of 8 sample loops
|
||||||
SYSTICK_DelayUs(1);
|
for (i = 0, k = 0, reg = 0; i < 3 && k < 8; i++, k++)
|
||||||
|
{
|
||||||
|
uint16_t reg2;
|
||||||
|
|
||||||
// Read all 4 GPIO pins at once
|
SYSTICK_DelayUs(1);
|
||||||
reg = GPIOA->DATA;
|
|
||||||
|
reg2 = GPIOA->DATA;
|
||||||
|
if (reg != reg2)
|
||||||
|
{ // noise
|
||||||
|
reg = reg2;
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i < 3)
|
||||||
|
break; // noise is too bad
|
||||||
|
|
||||||
for (unsigned int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++)
|
for (unsigned int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++)
|
||||||
{
|
{
|
||||||
|
@ -21,28 +21,29 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef enum {
|
enum KEY_Code_e {
|
||||||
KEY_INVALID = 0,
|
KEY_0 = 0, // 0
|
||||||
KEY_0,
|
KEY_1, // 1
|
||||||
KEY_1,
|
KEY_2, // 2
|
||||||
KEY_2,
|
KEY_3, // 3
|
||||||
KEY_3,
|
KEY_4, // 4
|
||||||
KEY_4,
|
KEY_5, // 5
|
||||||
KEY_5,
|
KEY_6, // 6
|
||||||
KEY_6,
|
KEY_7, // 7
|
||||||
KEY_7,
|
KEY_8, // 8
|
||||||
KEY_8,
|
KEY_9, // 9
|
||||||
KEY_9,
|
KEY_MENU, // A
|
||||||
KEY_MENU,
|
KEY_UP, // B
|
||||||
KEY_UP,
|
KEY_DOWN, // C
|
||||||
KEY_DOWN,
|
KEY_EXIT, // D
|
||||||
KEY_EXIT,
|
KEY_STAR, // *
|
||||||
KEY_STAR,
|
KEY_F, // #
|
||||||
KEY_F,
|
KEY_PTT, //
|
||||||
KEY_PTT,
|
KEY_SIDE2, //
|
||||||
KEY_SIDE2,
|
KEY_SIDE1, //
|
||||||
KEY_SIDE1
|
KEY_INVALID //
|
||||||
} KEY_Code_t;
|
};
|
||||||
|
typedef enum KEY_Code_e KEY_Code_t;
|
||||||
|
|
||||||
extern KEY_Code_t gKeyReading0;
|
extern KEY_Code_t gKeyReading0;
|
||||||
extern KEY_Code_t gKeyReading1;
|
extern KEY_Code_t gKeyReading1;
|
||||||
|
@ -146,7 +146,7 @@ void ST7565_Init(const bool full)
|
|||||||
{
|
{
|
||||||
SPI0_Init();
|
SPI0_Init();
|
||||||
|
|
||||||
ST7565_Configure_GPIO_B11();
|
ST7565_HardwareReset();
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ void ST7565_Init(const bool full)
|
|||||||
ST7565_FillScreen(0x00);
|
ST7565_FillScreen(0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ST7565_Configure_GPIO_B11(void)
|
void ST7565_HardwareReset(void)
|
||||||
{
|
{
|
||||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_RES);
|
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_RES);
|
||||||
SYSTEM_DelayMs(1);
|
SYSTEM_DelayMs(1);
|
||||||
|
@ -31,7 +31,7 @@ void ST7565_BlitFullScreen(void);
|
|||||||
void ST7565_BlitStatusLine(void);
|
void ST7565_BlitStatusLine(void);
|
||||||
void ST7565_FillScreen(uint8_t Value);
|
void ST7565_FillScreen(uint8_t Value);
|
||||||
void ST7565_Init(const bool full);
|
void ST7565_Init(const bool full);
|
||||||
void ST7565_Configure_GPIO_B11(void);
|
void ST7565_HardwareReset(void);
|
||||||
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
||||||
void ST7565_WriteByte(uint8_t Value);
|
void ST7565_WriteByte(uint8_t Value);
|
||||||
|
|
||||||
|
@ -29,26 +29,17 @@ void SYSTICK_Init(void)
|
|||||||
|
|
||||||
void SYSTICK_DelayUs(uint32_t Delay)
|
void SYSTICK_DelayUs(uint32_t Delay)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
const uint32_t ticks = Delay * gTickMultiplier;
|
||||||
uint32_t Start;
|
uint32_t i = 0;
|
||||||
uint32_t Previous;
|
uint32_t Start = SysTick->LOAD;
|
||||||
uint32_t Current;
|
uint32_t Previous = SysTick->VAL;
|
||||||
uint32_t Delta;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
Start = SysTick->LOAD;
|
|
||||||
Previous = SysTick->VAL;
|
|
||||||
do {
|
do {
|
||||||
do {
|
uint32_t Current;
|
||||||
Current = SysTick->VAL;
|
uint32_t Delta;
|
||||||
} while (Current == Previous);
|
while ((Current = SysTick->VAL) == Previous) {}
|
||||||
if (Current < Previous) {
|
Delta = (Current < Previous) ? -Current : Start - Current;
|
||||||
Delta = -Current;
|
i += Delta + Previous;
|
||||||
} else {
|
|
||||||
Delta = Start - Current;
|
|
||||||
}
|
|
||||||
i += Delta + Previous;
|
|
||||||
Previous = Current;
|
Previous = Current;
|
||||||
} while (i < Delay * gTickMultiplier);
|
} while (i < ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,8 +116,12 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT ||
|
||||||
gDTMF_auto_reset_time_500ms = 1 + (gEeprom.DTMF_auto_reset_time * 2);
|
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
||||||
|
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||||
|
{
|
||||||
|
gDTMF_auto_reset_time_500ms = gEeprom.DTMF_auto_reset_time * 2;
|
||||||
|
}
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
return;
|
return;
|
||||||
|
2
misc.c
2
misc.c
@ -220,7 +220,7 @@ bool gKeyBeingHeld;
|
|||||||
bool gPttIsPressed;
|
bool gPttIsPressed;
|
||||||
uint8_t gPttDebounceCounter;
|
uint8_t gPttDebounceCounter;
|
||||||
uint8_t gMenuListCount;
|
uint8_t gMenuListCount;
|
||||||
uint8_t gBackupCROSS_BAND_RX_TX;
|
uint8_t gBackup_CROSS_BAND_RX_TX;
|
||||||
uint8_t gScanDelay_10ms;
|
uint8_t gScanDelay_10ms;
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
uint8_t gAircopySendCountdown;
|
uint8_t gAircopySendCountdown;
|
||||||
|
10
misc.h
10
misc.h
@ -24,6 +24,14 @@
|
|||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX
|
||||||
|
#define MAX(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
|
||||||
|
#endif
|
||||||
|
|
||||||
#define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST)
|
#define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST)
|
||||||
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
||||||
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
|
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
|
||||||
@ -283,7 +291,7 @@ extern bool gKeyBeingHeld;
|
|||||||
extern bool gPttIsPressed;
|
extern bool gPttIsPressed;
|
||||||
extern uint8_t gPttDebounceCounter;
|
extern uint8_t gPttDebounceCounter;
|
||||||
extern uint8_t gMenuListCount;
|
extern uint8_t gMenuListCount;
|
||||||
extern uint8_t gBackupCROSS_BAND_RX_TX;
|
extern uint8_t gBackup_CROSS_BAND_RX_TX;
|
||||||
extern uint8_t gScanDelay_10ms;
|
extern uint8_t gScanDelay_10ms;
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
extern uint8_t gAircopySendCountdown;
|
extern uint8_t gAircopySendCountdown;
|
||||||
|
12
ui/main.c
12
ui/main.c
@ -350,7 +350,7 @@ void UI_DisplayMain(void)
|
|||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
||||||
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 || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||||
sprintf(String, "CALL FRM:%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)
|
||||||
@ -359,10 +359,8 @@ void UI_DisplayMain(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(String, ">%s", gDTMF_InputBox);
|
sprintf(String, ">%s", gDTMF_InputBox);
|
||||||
|
|
||||||
center_line = CENTER_LINE_IN_USE;
|
|
||||||
}
|
}
|
||||||
UI_PrintString(String, 2, 0, vfo_num * 3, 8);
|
UI_PrintString(String, 2, 0, 0 + (vfo_num * 3), 8);
|
||||||
|
|
||||||
memset(String, 0, sizeof(String));
|
memset(String, 0, sizeof(String));
|
||||||
if (!gDTMF_InputMode)
|
if (!gDTMF_InputMode)
|
||||||
@ -371,16 +369,12 @@ void UI_DisplayMain(void)
|
|||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
||||||
sprintf(String, ">%s", (DTMF_FindContact(gDTMF_String, Contact)) ? Contact : gDTMF_String);
|
sprintf(String, ">%s", (DTMF_FindContact(gDTMF_String, Contact)) ? Contact : gDTMF_String);
|
||||||
else
|
else
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||||
sprintf(String, ">%s", (DTMF_FindContact(gDTMF_Callee, Contact)) ? Contact : gDTMF_Callee);
|
sprintf(String, ">%s", (DTMF_FindContact(gDTMF_Callee, Contact)) ? Contact : gDTMF_Callee);
|
||||||
else
|
else
|
||||||
if (gDTMF_IsTx)
|
if (gDTMF_IsTx)
|
||||||
sprintf(String, ">%s", gDTMF_String);
|
sprintf(String, ">%s", gDTMF_String);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
center_line = CENTER_LINE_IN_USE;
|
|
||||||
}
|
|
||||||
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
||||||
|
|
||||||
center_line = CENTER_LINE_IN_USE;
|
center_line = CENTER_LINE_IN_USE;
|
||||||
|
45
ui/ui.c
45
ui/ui.c
@ -77,33 +77,28 @@ void GUI_DisplayScreen(void)
|
|||||||
|
|
||||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||||
{
|
{
|
||||||
if (Display != DISPLAY_INVALID)
|
if (Display == DISPLAY_INVALID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gScreenToDisplay != Display)
|
||||||
{
|
{
|
||||||
if (gScreenToDisplay != Display)
|
DTMF_clear_input_box();
|
||||||
{
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
gIsInSubMenu = false;
|
|
||||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
|
||||||
gScanStateDir = SCAN_OFF;
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
gFM_ScanState = FM_SCAN_OFF;
|
|
||||||
#endif
|
|
||||||
gAskForConfirmation = 0;
|
|
||||||
gDTMF_InputMode = false;
|
|
||||||
gDTMF_InputIndex = 0;
|
|
||||||
gAskToSave = false;
|
|
||||||
gAskToDelete = false;
|
|
||||||
|
|
||||||
if (gWasFKeyPressed)
|
gInputBoxIndex = 0;
|
||||||
{
|
gIsInSubMenu = false;
|
||||||
gWasFKeyPressed = false;
|
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||||
gUpdateStatus = true;
|
gScanStateDir = SCAN_OFF;
|
||||||
}
|
#ifdef ENABLE_FMRADIO
|
||||||
|
gFM_ScanState = FM_SCAN_OFF;
|
||||||
|
#endif
|
||||||
|
gAskForConfirmation = 0;
|
||||||
|
gAskToSave = false;
|
||||||
|
gAskToDelete = false;
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
gScreenToDisplay = Display;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gScreenToDisplay = Display;
|
||||||
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user