Menu remains on screen whilst TX'ing

This commit is contained in:
OneOfEleven 2023-10-03 00:14:36 +01:00
parent 87d1cf7c86
commit 2551077cef
13 changed files with 136 additions and 53 deletions

View File

@ -27,8 +27,8 @@ ENABLE_SHOW_CHARGE_LEVEL := 1
ENABLE_REVERSE_BAT_SYMBOL := 1
ENABLE_CODE_SCAN_TIMEOUT := 0
ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 1
ENABLE_SQUELCH_LOWER := 1
ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_LOWER := 0
ENABLE_RSSI_BAR := 1
ENABLE_AUDIO_BAR := 1
#ENABLE_COPY_CHAN_TO_VFO := 1

View File

@ -109,7 +109,7 @@ void ACTION_Monitor(void)
}
else
#endif
gRequestDisplayScreen = gScreenToDisplay;
gRequestDisplayScreen = gScreenToDisplay;
}
void ACTION_Scan(bool bRestart)
@ -251,7 +251,9 @@ void ACTION_Vox(void)
#endif
gFlagPrepareTX = true;
gRequestDisplayScreen = DISPLAY_MAIN;
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN;
}
#endif
@ -268,6 +270,7 @@ void ACTION_Vox(void)
gInputBoxIndex = 0;
gVoxResumeCountdown = 80;
gFlagReconfigureVfos = true;
gRequestDisplayScreen = DISPLAY_MAIN;
return;
}
@ -279,7 +282,8 @@ void ACTION_Vox(void)
FM_Start();
gInputBoxIndex = 0;
gInputBoxIndex = 0;
gRequestDisplayScreen = DISPLAY_FM;
}
}

View File

@ -157,6 +157,7 @@ static void APP_CheckForIncoming(void)
updateRSSI(gEeprom.RX_CHANNEL);
gUpdateRSSI = true;
}
return;
}
@ -223,7 +224,7 @@ static void APP_HandleIncoming(void)
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)
{ // DTMF DCD is enabled
// DTMF_HandleRequest();
DTMF_HandleRequest();
if (gDTMF_CallState == DTMF_CALL_STATE_NONE)
{
@ -600,7 +601,10 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
if (Function == FUNCTION_MONITOR)
#endif
{ // squelch is disabled
GUI_SelectNextDisplay(DISPLAY_MAIN);
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
GUI_SelectNextDisplay(DISPLAY_MAIN);
return;
}
@ -1486,22 +1490,27 @@ void APP_TimeSlice10ms(void)
if (gAlarmState == ALARM_STATE_TXALARM)
{
gAlarmState = ALARM_STATE_ALARM;
RADIO_EnableCxCSS();
BK4819_SetupPowerAmplifier(0, 0);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
BK4819_Enable_AfDac_DiscMode_TxDsp();
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
GUI_DisplayScreen();
}
else
{
gAlarmState = ALARM_STATE_TXALARM;
GUI_DisplayScreen();
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
RADIO_SetTxParameters();
BK4819_TransmitTone(true, 500);
SYSTEM_DelayMs(2);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = true;
gAlarmToneCounter = 0;
}
@ -1588,7 +1597,9 @@ void APP_TimeSlice10ms(void)
gScanUseCssResult = false;
gScanProgressIndicator = 0;
gScanCssState = SCAN_CSS_STATE_SCANNING;
GUI_SelectNextDisplay(DISPLAY_SCANNER);
gUpdateStatus = true;
}
@ -1679,7 +1690,9 @@ void cancelUserInputModes(void)
gDTMF_InputMode = false;
gDTMF_InputIndex = 0;
gInputBoxIndex = 0;
gRequestDisplayScreen = DISPLAY_MAIN;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
}
}
@ -2008,7 +2021,8 @@ void APP_TimeSlice500ms(void)
RADIO_SetupRegisters(true);
gRequestDisplayScreen = DISPLAY_MAIN;
// if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN;
}
#endif
@ -2098,17 +2112,17 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gFlagSaveChannel);
gFlagSaveChannel = false;
RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, VFO_CONFIGURE);
RADIO_SetupRegisters(true);
GUI_SelectNextDisplay(DISPLAY_MAIN);
}
}
else
{
if (Key != KEY_PTT)
{
if (gScreenToDisplay == DISPLAY_MENU) // 1of11
gMenuCountdown = menu_timeout_500ms;
}
BACKLIGHT_TurnOn();
@ -2293,9 +2307,11 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{
case DISPLAY_MAIN:
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
#ifdef ENABLE_MAIN_KEY_HOLD
bKeyHeld = false; // allow the channel setting to be saved
#endif
break;
#ifdef ENABLE_FMRADIO
@ -2401,6 +2417,7 @@ Skip:
if (!bKeyHeld)
{
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gRequestSaveChannel);
if (gScreenToDisplay != DISPLAY_SCANNER)
if (gVfoConfigureMode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere
gVfoConfigureMode = VFO_CONFIGURE;
@ -2408,6 +2425,7 @@ Skip:
else
{
gFlagSaveChannel = gRequestSaveChannel;
if (gRequestDisplayScreen == DISPLAY_INVALID)
gRequestDisplayScreen = DISPLAY_MAIN;
}

View File

@ -86,7 +86,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
return;
}
#ifdef ENABLE_FMRADIO
if (gFM_ScanState == FM_SCAN_OFF)
{
@ -106,7 +106,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
if (!bKeyPressed)
{
if (gScreenToDisplay == DISPLAY_MAIN)
//if (gScreenToDisplay == DISPLAY_MAIN)
{
if (gCurrentFunction == FUNCTION_TRANSMIT)
{
@ -132,10 +132,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
RADIO_SetVfoState(VFO_STATE_NORMAL);
// beep when you release the PTT
//gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL; // 1of11
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN;
gRequestDisplayScreen = DISPLAY_MAIN;
return;
}
@ -149,7 +148,10 @@ void GENERIC_Key_PTT(bool bKeyPressed)
gPttDebounceCounter = 0;
gPttIsPressed = false;
gRequestDisplayScreen = DISPLAY_MAIN;
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN;
return;
}
@ -160,17 +162,15 @@ void GENERIC_Key_PTT(bool bKeyPressed)
if (gCssScanMode == CSS_SCAN_MODE_OFF)
{
#ifdef ENABLE_FMRADIO
if (gScreenToDisplay == DISPLAY_MENU || gScreenToDisplay == DISPLAY_FM)
#else
if (gScreenToDisplay == DISPLAY_MENU)
if (gScreenToDisplay == DISPLAY_FM)
{
gRequestDisplayScreen = DISPLAY_MAIN;
gInputBoxIndex = 0;
gPttIsPressed = false;
gPttDebounceCounter = 0;
return;
}
#endif
{
gRequestDisplayScreen = DISPLAY_MAIN;
gInputBoxIndex = 0;
gPttIsPressed = false;
gPttDebounceCounter = 0;
return;
}
if (gScreenToDisplay != DISPLAY_SCANNER)
{
@ -213,21 +213,26 @@ void GENERIC_Key_PTT(bool bKeyPressed)
gDTMF_State = DTMF_STATE_0;
}
gRequestDisplayScreen = DISPLAY_MAIN;
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN;
gDTMF_InputMode = false;
gDTMF_InputIndex = 0;
return;
}
gRequestDisplayScreen = DISPLAY_MAIN;
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN;
gFlagPrepareTX = true;
gInputBoxIndex = 0;
return;
}
gRequestDisplayScreen = DISPLAY_MAIN;
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;
@ -237,7 +242,9 @@ void GENERIC_Key_PTT(bool bKeyPressed)
else
{
MENU_StopCssScan();
gRequestDisplayScreen = DISPLAY_MENU;
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MENU;
}
}
#ifdef ENABLE_FMRADIO
@ -247,11 +254,10 @@ void GENERIC_Key_PTT(bool bKeyPressed)
gRequestDisplayScreen = DISPLAY_FM;
}
#endif
#ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
#endif
gPttWasPressed = true;
}

View File

@ -77,6 +77,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
gRequestSaveVFO = true;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
gRequestDisplayScreen = DISPLAY_MAIN;
if (beep)
@ -101,6 +102,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
gRequestSaveSettings = 1;
gFlagReconfigureVfos = true;
gRequestDisplayScreen = DISPLAY_MAIN;
if (beep)
@ -644,6 +646,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
gDTMF_InputMode = true;
memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox));
gDTMF_InputIndex = 0;
gRequestDisplayScreen = DISPLAY_MAIN;
return;
}
@ -801,7 +804,9 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
DTMF_Append(Character);
gKeyInputCountdown = key_input_timeout_500ms;
gRequestDisplayScreen = DISPLAY_MAIN;
gPttWasReleased = true;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
return;

View File

@ -401,9 +401,6 @@ void MENU_AcceptSetting(void)
case MENU_T_CTCS:
pConfig = &gTxVfo->freq_config_TX;
// Fallthrough
case MENU_R_CTCS:
if (gSubMenuSelection == 0)
{
@ -413,14 +410,20 @@ void MENU_AcceptSetting(void)
return;
}
Code = 0;
pConfig->Code = Code;
pConfig->CodeType = CODE_TYPE_OFF;
BK4819_ExitSubAu();
}
else
{
{
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
Code = gSubMenuSelection - 1;
pConfig->Code = Code;
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
}
pConfig->Code = Code;
gRequestSaveChannel = 1;
return;
@ -441,6 +444,12 @@ void MENU_AcceptSetting(void)
case MENU_SCR:
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
#if 0
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
BK4819_EnableScramble(gSubMenuSelection - 1);
else
BK4819_DisableScramble();
#endif
gRequestSaveChannel = 1;
return;

View File

@ -92,6 +92,7 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
{
case 0:
gRequestDisplayScreen = DISPLAY_MAIN;
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
gUpdateStatus = true;
gFlagStopScan = true;

Binary file not shown.

Binary file not shown.

View File

@ -138,7 +138,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
gUpdateStatus = true;
GUI_SelectNextDisplay(DISPLAY_MAIN);
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
GUI_SelectNextDisplay(DISPLAY_MAIN);
return;
case FUNCTION_TRANSMIT:

View File

@ -218,7 +218,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (Band > BAND7_470MHz)
{
Band = BAND6_400MHz;
// Band = FREQUENCY_GetBand(gEeprom.ScreenChannel[VFO]); // 1of11 bug fix, or have I broke it ?
}
if (IS_MR_CHANNEL(Channel))
@ -548,7 +547,7 @@ void RADIO_SelectVfos(void)
void RADIO_SetupRegisters(bool bSwitchToFunction0)
{
BK4819_FilterBandwidth_t Bandwidth;
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
uint16_t InterruptMask;
uint32_t Frequency;
@ -558,7 +557,6 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
switch (Bandwidth)
{
default:
@ -611,6 +609,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
// what does this in do ?
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
// AF RX Gain and DAC

View File

@ -80,6 +80,9 @@ center_line_t center_line = CENTER_LINE_NONE;
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
unsigned int i;
if (gScreenToDisplay != DISPLAY_MAIN)
return;
#if 1
// TX audio level
@ -713,8 +716,8 @@ void UI_DisplayMain(void)
#ifdef ENABLE_AUDIO_BAR
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT)
{
UI_DisplayAudioBar();
center_line = CENTER_LINE_AUDIO_BAR;
UI_DisplayAudioBar();
}
else
#endif
@ -722,9 +725,9 @@ void UI_DisplayMain(void)
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
{
center_line = CENTER_LINE_AM_FIX_DATA;
AM_fix_print_data(gEeprom.RX_CHANNEL, String);
UI_PrintStringSmall(String, 2, 0, 3);
center_line = CENTER_LINE_AM_FIX_DATA;
}
else
#endif
@ -732,8 +735,8 @@ void UI_DisplayMain(void)
#ifdef ENABLE_RSSI_BAR
if (rx)
{
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
center_line = CENTER_LINE_RSSI;
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
}
else
#endif
@ -745,20 +748,20 @@ void UI_DisplayMain(void)
{ // show live DTMF decode
const unsigned int len = strlen(gDTMF_RX_live);
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
center_line = CENTER_LINE_DTMF_DEC;
strcpy(String, "DTMF ");
strcat(String, gDTMF_RX_live + idx);
UI_PrintStringSmall(String, 2, 0, 3);
center_line = CENTER_LINE_DTMF_DEC;
}
#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
center_line = CENTER_LINE_DTMF_DEC;
strcpy(String, "DTMF ");
strcat(String, gDTMF_RX + idx);
UI_PrintStringSmall(String, 2, 0, 3);
center_line = CENTER_LINE_DTMF_DEC;
}
#endif
@ -766,11 +769,11 @@ void UI_DisplayMain(void)
else
if (gChargingWithTypeC)
{ // charging .. show the battery state
center_line = CENTER_LINE_CHARGE_DATA;
sprintf(String, "Charge %u.%02uV %u%%",
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
UI_PrintStringSmall(String, 2, 0, 3);
center_line = CENTER_LINE_CHARGE_DATA;
}
#endif
}

View File

@ -476,12 +476,42 @@ void UI_DisplayMenu(void)
case MENU_R_CTCS:
case MENU_T_CTCS:
if (gSubMenuSelection == 0)
strcpy(String, "OFF");
else
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
break;
{
#if 1
unsigned int Code;
FREQ_Config_t *pConfig = (gMenuCursor == MENU_R_CTCS) ? &gTxVfo->freq_config_RX : &gTxVfo->freq_config_TX;
if (gSubMenuSelection == 0)
{
strcpy(String, "OFF");
if (pConfig->CodeType != CODE_TYPE_CONTINUOUS_TONE)
break;
Code = 0;
pConfig->CodeType = CODE_TYPE_OFF;
pConfig->Code = Code;
BK4819_ExitSubAu();
}
else
{
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
Code = gSubMenuSelection - 1;
pConfig->Code = Code;
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
}
#else
if (gSubMenuSelection == 0)
strcpy(String, "OFF");
else
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
#endif
break;
}
case MENU_SFT_D:
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
break;
@ -518,6 +548,12 @@ void UI_DisplayMenu(void)
case MENU_SCR:
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
#if 1
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
BK4819_EnableScramble(gSubMenuSelection - 1);
else
BK4819_DisableScramble();
#endif
break;
case MENU_VOX: