Reduce nesting
This commit is contained in:
committed by
Krzysiek Egzmont
parent
8f6e1be5e0
commit
36ecde86e9
198
app/app.c
198
app/app.c
@@ -203,26 +203,25 @@ static void HandleIncoming(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
#ifdef ENABLE_DTMF_CALLING
|
||||||
if (gScanStateDir == SCAN_OFF) { // not scanning
|
if (gScanStateDir == SCAN_OFF && (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED)) {
|
||||||
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED) { // DTMF DCD is enabled
|
|
||||||
|
|
||||||
DTMF_HandleRequest();
|
// 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) {
|
||||||
gDualWatchCountdown_10ms = dual_watch_count_after_1_10ms;
|
|
||||||
gScheduleDualWatch = false;
|
|
||||||
|
|
||||||
gRxReceptionMode = RX_MODE_LISTENING;
|
|
||||||
|
|
||||||
// let the user see DW is not active
|
|
||||||
gDualWatchActive = false;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
gDualWatchCountdown_10ms = dual_watch_count_after_1_10ms;
|
||||||
|
gScheduleDualWatch = false;
|
||||||
|
|
||||||
|
gRxReceptionMode = RX_MODE_LISTENING;
|
||||||
|
|
||||||
|
// let the user see DW is not active
|
||||||
|
gDualWatchActive = false;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -727,6 +726,8 @@ void APP_EndTransmission(void)
|
|||||||
// back to RX mode
|
// back to RX mode
|
||||||
RADIO_SendEndOfTransmission();
|
RADIO_SendEndOfTransmission();
|
||||||
|
|
||||||
|
gFlagEndTransmission = true;
|
||||||
|
|
||||||
if (gMonitor) {
|
if (gMonitor) {
|
||||||
//turn the monitor back on
|
//turn the monitor back on
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
@@ -829,7 +830,6 @@ void APP_Update(void)
|
|||||||
{ // transmitter timed out or must de-key
|
{ // transmitter timed out or must de-key
|
||||||
gTxTimeoutReached = false;
|
gTxTimeoutReached = false;
|
||||||
|
|
||||||
gFlagEndTransmission = true;
|
|
||||||
APP_EndTransmission();
|
APP_EndTransmission();
|
||||||
|
|
||||||
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
|
||||||
@@ -1356,16 +1356,13 @@ void APP_TimeSlice500ms(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gBacklightCountdown_500ms > 0 && !gAskToSave && !gCssBackgroundScan &&
|
if (gBacklightCountdown_500ms > 0 && !gAskToSave && !gCssBackgroundScan
|
||||||
// don't turn off backlight if user is in backlight menu option
|
// don't turn off backlight if user is in backlight menu option
|
||||||
!(gScreenToDisplay == DISPLAY_MENU && (UI_MENU_GetCurrentMenuId() == MENU_ABR || UI_MENU_GetCurrentMenuId() == MENU_ABR_MAX)))
|
&& !(gScreenToDisplay == DISPLAY_MENU && (UI_MENU_GetCurrentMenuId() == MENU_ABR || UI_MENU_GetCurrentMenuId() == MENU_ABR_MAX))
|
||||||
{
|
&& --gBacklightCountdown_500ms == 0
|
||||||
if (--gBacklightCountdown_500ms == 0) {
|
&& gEeprom.BACKLIGHT_TIME < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)
|
||||||
if (gEeprom.BACKLIGHT_TIME < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) {
|
) {
|
||||||
// backlight is not set to be always on
|
BACKLIGHT_TurnOff();
|
||||||
BACKLIGHT_TurnOff();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gReducedService)
|
if (gReducedService)
|
||||||
@@ -1411,94 +1408,83 @@ void APP_TimeSlice500ms(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gCssBackgroundScan
|
if (!gCssBackgroundScan && gScanStateDir == SCAN_OFF && !SCANNER_IsScanning()
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
&& (gFM_ScanState == FM_SCAN_OFF || gAskToSave)
|
&& (gFM_ScanState == FM_SCAN_OFF || gAskToSave)
|
||||||
#endif
|
#endif
|
||||||
) {
|
|
||||||
if (gScanStateDir == SCAN_OFF && !SCANNER_IsScanning()
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
&& gScreenToDisplay != DISPLAY_AIRCOPY
|
&& gScreenToDisplay != DISPLAY_AIRCOPY
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode && gScreenToDisplay != DISPLAY_MENU) {
|
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode
|
||||||
if (--gKeyLockCountdown == 0) {
|
&& gScreenToDisplay != DISPLAY_MENU && --gKeyLockCountdown == 0)
|
||||||
gEeprom.KEY_LOCK = true; // lock the keyboard
|
{
|
||||||
gUpdateStatus = true; // lock symbol needs showing
|
gEeprom.KEY_LOCK = true; // lock the keyboard
|
||||||
}
|
gUpdateStatus = true; // lock symbol needs showing
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exit_menu) {
|
||||||
|
gMenuCountdown = 0;
|
||||||
|
|
||||||
|
if (gEeprom.BACKLIGHT_TIME == 0) {
|
||||||
|
BACKLIGHT_TurnOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exit_menu)
|
if (gInputBoxIndex > 0 || gDTMF_InputMode) {
|
||||||
{
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
gMenuCountdown = 0;
|
}
|
||||||
|
|
||||||
if (gEeprom.BACKLIGHT_TIME == 0) // backlight always off
|
|
||||||
{
|
|
||||||
BACKLIGHT_TurnOff(); // turn the backlight OFF
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gInputBoxIndex > 0 || gDTMF_InputMode)
|
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
|
||||||
/*
|
/*
|
||||||
if (SCANNER_IsScanning())
|
if (SCANNER_IsScanning()) {
|
||||||
{
|
BK4819_StopScan();
|
||||||
BK4819_StopScan();
|
|
||||||
|
|
||||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
DTMF_clear_input_box();
|
DTMF_clear_input_box();
|
||||||
|
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
gAskToSave = false;
|
gAskToSave = false;
|
||||||
gAskToDelete = false;
|
gAskToDelete = false;
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
|
|
||||||
GUI_DisplayType_t disp = DISPLAY_INVALID;
|
GUI_DisplayType_t disp = DISPLAY_INVALID;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode && ! FUNCTION_IsRx()) {
|
if (gFmRadioMode && ! FUNCTION_IsRx()) {
|
||||||
disp = DISPLAY_FM;
|
disp = DISPLAY_FM;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (disp == DISPLAY_INVALID) {
|
if (disp == DISPLAY_INVALID
|
||||||
#ifndef ENABLE_NO_CODE_SCAN_TIMEOUT
|
#ifndef ENABLE_NO_CODE_SCAN_TIMEOUT
|
||||||
if (!SCANNER_IsScanning())
|
&& !SCANNER_IsScanning()
|
||||||
#endif
|
#endif
|
||||||
{
|
) {
|
||||||
disp = DISPLAY_MAIN;
|
disp = DISPLAY_MAIN;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (disp != DISPLAY_INVALID) {
|
if (disp != DISPLAY_INVALID) {
|
||||||
GUI_SelectNextDisplay(disp);
|
GUI_SelectNextDisplay(disp);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gPttIsPressed && gVFOStateResumeCountdown_500ms > 0)
|
if (!gPttIsPressed && gVFOStateResumeCountdown_500ms > 0 && --gVFOStateResumeCountdown_500ms == 0) {
|
||||||
{
|
|
||||||
if (--gVFOStateResumeCountdown_500ms == 0)
|
|
||||||
{
|
|
||||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode && !FUNCTION_IsRx()) {
|
if (gFmRadioMode && !FUNCTION_IsRx()) {
|
||||||
// switch back to FM radio mode
|
// switch back to FM radio mode
|
||||||
FM_Start();
|
FM_Start();
|
||||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
BATTERY_TimeSlice500ms();
|
BATTERY_TimeSlice500ms();
|
||||||
@@ -1506,41 +1492,31 @@ void APP_TimeSlice500ms(void)
|
|||||||
UI_MAIN_TimeSlice500ms();
|
UI_MAIN_TimeSlice500ms();
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
#ifdef ENABLE_DTMF_CALLING
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||||
{
|
if (gDTMF_DecodeRingCountdown_500ms > 0) {
|
||||||
if (gDTMF_DecodeRingCountdown_500ms > 0)
|
// make "ring-ring" sound
|
||||||
{ // make "ring-ring" sound
|
|
||||||
gDTMF_DecodeRingCountdown_500ms--;
|
gDTMF_DecodeRingCountdown_500ms--;
|
||||||
AUDIO_PlayBeep(BEEP_880HZ_200MS);
|
AUDIO_PlayBeep(BEEP_880HZ_200MS);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE &&
|
if (gDTMF_CallState != DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_TRANSMIT
|
||||||
gCurrentFunction != FUNCTION_TRANSMIT &&
|
&& gCurrentFunction != FUNCTION_RECEIVE && gDTMF_auto_reset_time_500ms > 0
|
||||||
gCurrentFunction != FUNCTION_RECEIVE)
|
&& --gDTMF_auto_reset_time_500ms == 0)
|
||||||
{
|
{
|
||||||
if (gDTMF_auto_reset_time_500ms > 0)
|
gUpdateDisplay = true;
|
||||||
{
|
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED && gEeprom.DTMF_auto_reset_time >= DTMF_HOLD_MAX) {
|
||||||
if (--gDTMF_auto_reset_time_500ms == 0)
|
gDTMF_CallState = DTMF_CALL_STATE_RECEIVED_STAY; // keep message on-screen till a key is pressed
|
||||||
{
|
} else {
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED && gEeprom.DTMF_auto_reset_time >= DTMF_HOLD_MAX)
|
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_IsTx && gDTMF_TxStopCountdown_500ms > 0)
|
if (gDTMF_IsTx && gDTMF_TxStopCountdown_500ms > 0 && --gDTMF_TxStopCountdown_500ms == 0) {
|
||||||
{
|
gDTMF_IsTx = false;
|
||||||
if (--gDTMF_TxStopCountdown_500ms == 0)
|
gUpdateDisplay = true;
|
||||||
{
|
|
||||||
gDTMF_IsTx = false;
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user