From bc10f1ed6b16205ecef8567b2da4c27b02d26307 Mon Sep 17 00:00:00 2001 From: Dual Tachyon Date: Mon, 4 Sep 2023 15:26:28 +0100 Subject: [PATCH] More scan renames. --- app/action.c | 6 +++--- app/app.c | 40 ++++++++++++++++++++-------------------- app/dtmf.c | 3 ++- app/fm.c | 22 +++++++++++----------- app/fm.h | 6 +++++- app/generic.c | 6 +++--- app/main.c | 6 +++--- app/scanner.c | 1 + app/scanner.h | 5 +++++ misc.c | 2 -- misc.h | 3 --- scheduler.c | 9 +++++---- ui/fmradio.c | 2 +- ui/ui.c | 6 ++++-- 14 files changed, 63 insertions(+), 54 deletions(-) diff --git a/app/action.c b/app/action.c index 005a3a1..4011710 100644 --- a/app/action.c +++ b/app/action.c @@ -68,7 +68,7 @@ static void ACTION_Monitor(void) APP_StartListening(FUNCTION_MONITOR); return; } - if (gStepDirection) { + if (gScanState != SCAN_OFF) { ScanPauseDelayIn10msec = 500; gScheduleScanListen = false; gScanPauseMode = true; @@ -93,7 +93,7 @@ void ACTION_Scan(bool bRestart) uint16_t Frequency; GUI_SelectNextDisplay(DISPLAY_FM); - if (gFM_Step) { + if (gFM_ScanState != FM_SCAN_OFF) { FM_PlayAndUpdate(); gAnotherVoiceID = VOICE_ID_SCANNING_STOP; } else { @@ -116,7 +116,7 @@ void ACTION_Scan(bool bRestart) RADIO_SelectVfos(); if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) { GUI_SelectNextDisplay(DISPLAY_MAIN); - if (gStepDirection) { + if (gScanState != SCAN_OFF) { FUN_0000773c(); gAnotherVoiceID = VOICE_ID_SCANNING_STOP; } else { diff --git a/app/app.c b/app/app.c index f5b8f1c..78bf88d 100644 --- a/app/app.c +++ b/app/app.c @@ -59,7 +59,7 @@ static void FUN_00005144(void) if (!g_SquelchLost) { return; } - if (gStepDirection == 0) { + if (gScanState == SCAN_OFF) { if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE) { ScanPauseDelayIn10msec = 100; gScheduleScanListen = false; @@ -101,7 +101,7 @@ void FUN_000051e8(void) return; } - bFlag = (gStepDirection == 0 && gCopyOfCodeType == CODE_TYPE_OFF); + bFlag = (gScanState == SCAN_OFF && gCopyOfCodeType == CODE_TYPE_OFF); if (gRxVfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST && gSystickCountdown2) { bFlag = true; gSystickCountdown2 = 0; @@ -118,7 +118,7 @@ void FUN_000051e8(void) DTMF_HandleRequest(); - if (gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) { + if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF) { if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED) { if (gDTMF_CallState == DTMF_CALL_STATE_NONE) { if (gRxReceptionMode == RX_MODE_DETECTED) { @@ -139,7 +139,7 @@ void FUN_0000773c(void) uint8_t Previous; Previous = gRestoreMrChannel; - gStepDirection = 0; + gScanState = SCAN_OFF; if (!g_20000413) { if (IS_MR_CHANNEL(gNextMrChannel)) { @@ -175,7 +175,7 @@ void FUN_000052f0(void) if (gSystickFlag10) { Value = 1; goto Skip; - } else if (gStepDirection && IS_FREQ_CHANNEL(gNextMrChannel)) { + } else if (gScanState != SCAN_OFF && IS_FREQ_CHANNEL(gNextMrChannel)) { if (g_SquelchLost) { return; } @@ -267,7 +267,7 @@ Skip: gSystickCountdown2 = 300; } gUpdateDisplay = true; - if (gStepDirection) { + if (gScanState != SCAN_OFF) { switch (gEeprom.SCAN_RESUME_MODE) { case SCAN_RESUME_CO: ScanPauseDelayIn10msec = 360; @@ -323,7 +323,7 @@ void APP_StartListening(FUNCTION_Type_t Function) GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); gEnableSpeaker = true; BACKLIGHT_TurnOn(); - if (gStepDirection) { + if (gScanState != SCAN_OFF) { switch (gEeprom.SCAN_RESUME_MODE) { case SCAN_RESUME_TO: if (!gScanPauseMode) { @@ -351,7 +351,7 @@ void APP_StartListening(FUNCTION_Type_t Function) if (gCssScanMode != CSS_SCAN_MODE_OFF) { gCssScanMode = CSS_SCAN_MODE_FOUND; } - if ((gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { + if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { g_2000041F = 1; gDualWatchCountdown = 360; gScheduleDualWatch = false; @@ -397,7 +397,7 @@ void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step) void APP_MoreRadioStuff(void) { - APP_SetFrequencyByStep(gRxVfo, gStepDirection); + APP_SetFrequencyByStep(gRxVfo, gScanState); RADIO_ApplyOffset(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo); RADIO_SetupRegisters(true); @@ -438,7 +438,7 @@ void FUN_00007dd4(void) } } - Ch = RADIO_FindNextChannel(gNextMrChannel + gStepDirection, gStepDirection, true, gEeprom.SCAN_LIST_DEFAULT); + Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT); if (Ch == 0xFF) { return; } @@ -592,7 +592,7 @@ static void FUN_00008334(void) g_VOX_Lost = false; gVoxPauseCountdown = 0; } - if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF && !gFmRadioMode) { + if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && !gFmRadioMode) { if (gVOX_NoiseDetected) { if (g_VOX_Lost) { gVoxStopCountdown = 100; @@ -655,7 +655,7 @@ void APP_Update(void) return; } - if (gScreenToDisplay != DISPLAY_SCANNER && gStepDirection && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0) { + if (gScreenToDisplay != DISPLAY_SCANNER && gScanState != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0) { if (IS_FREQ_CHANNEL(gNextMrChannel)) { if (gCurrentFunction == FUNCTION_3) { APP_StartListening(FUNCTION_RECEIVE); @@ -688,7 +688,7 @@ void APP_Update(void) if (gScreenToDisplay != DISPLAY_SCANNER && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { if (gScheduleDualWatch && gVoiceWriteIndex == 0) { - if (gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) { + if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF) { if (!gPttIsPressed && !gFmRadioMode && gDTMF_CallState == DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_POWER_SAVE) { DUALWATCH_Alternate(); if (g_2000041F == 1 && gScreenToDisplay == DISPLAY_MAIN) { @@ -703,7 +703,7 @@ void APP_Update(void) } } - if (gFM_Step && gScheduleFM && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_TRANSMIT) { + if (gFM_ScanState != FM_SCAN_OFF && gScheduleFM && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_TRANSMIT) { FM_Play(); gScheduleFM = false; } @@ -713,7 +713,7 @@ void APP_Update(void) } if (gSchedulePowerSave) { - if (gEeprom.BATTERY_SAVE == 0 || gStepDirection || gCssScanMode != CSS_SCAN_MODE_OFF || gFmRadioMode || gPttIsPressed || gScreenToDisplay != DISPLAY_MAIN || gKeyBeingHeld || gDTMF_CallState != DTMF_CALL_STATE_NONE) { + if (gEeprom.BATTERY_SAVE == 0 || gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gFmRadioMode || gPttIsPressed || gScreenToDisplay != DISPLAY_MAIN || gKeyBeingHeld || gDTMF_CallState != DTMF_CALL_STATE_NONE) { gBatterySaveCountdown = 1000; } else { if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode) { @@ -731,14 +731,14 @@ void APP_Update(void) if (gEeprom.VOX_SWITCH) { BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD); } - if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) { + if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF) { DUALWATCH_Alternate(); g_20000382 = false; } FUNCTION_Init(); gBatterySave = 10; gRxIdleMode = false; - } else if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gStepDirection || gCssScanMode != CSS_SCAN_MODE_OFF || g_20000382) { + } else if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || g_20000382) { gCurrentRSSI = BK4819_GetRSSI(); UI_UpdateRSSI(gCurrentRSSI); gBatterySave = gEeprom.BATTERY_SAVE * 10; @@ -1072,7 +1072,7 @@ void APP_TimeSlice500ms(void) goto LAB_00004b08; } } - if ((gFM_Step == 0 || gAskToSave) && gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) { + if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF) { if (gBacklightCountdown) { gBacklightCountdown--; if (gBacklightCountdown == 0) { @@ -1272,7 +1272,7 @@ void APP_SetStepDirection(bool bFlag, int8_t Direction) RADIO_SelectVfos(); gNextMrChannel = gRxVfo->CHANNEL_SAVE; gCurrentScanList = 0; - gStepDirection = Direction; + gScanState = Direction; if (IS_MR_CHANNEL(gNextMrChannel)) { if (bFlag) { gRestoreMrChannel = gNextMrChannel; @@ -1372,7 +1372,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } } - if ((gStepDirection && Key != KEY_PTT && Key != KEY_UP && Key != KEY_DOWN && Key != KEY_EXIT && Key != KEY_STAR) || + if ((gScanState != SCAN_OFF && Key != KEY_PTT && Key != KEY_UP && Key != KEY_DOWN && Key != KEY_EXIT && Key != KEY_STAR) || (gCssScanMode != CSS_SCAN_MODE_OFF && Key != KEY_PTT && Key != KEY_UP && Key != KEY_DOWN && Key != KEY_EXIT && Key != KEY_STAR && Key != KEY_MENU)) { if (!bKeyPressed || bKeyHeld) { return; diff --git a/app/dtmf.c b/app/dtmf.c index 15a298c..e08fbf2 100644 --- a/app/dtmf.c +++ b/app/dtmf.c @@ -16,6 +16,7 @@ #include #include "app/fm.h" +#include "app/scanner.h" #include "bsp/dp32g030/gpio.h" #include "driver/bk4819.h" #include "driver/eeprom.h" @@ -183,7 +184,7 @@ void DTMF_HandleRequest(void) gDTMF_RequestPending = false; - if (gStepDirection || gCssScanMode != CSS_SCAN_MODE_OFF) { + if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF) { return; } diff --git a/app/fm.c b/app/fm.c index 904474e..6ca8525 100644 --- a/app/fm.c +++ b/app/fm.c @@ -33,7 +33,7 @@ uint16_t gFM_Channels[20]; bool gFmRadioMode; uint8_t gFmRadioCountdown; volatile uint16_t gFmPlayCountdown; -volatile int8_t gFM_Step; +volatile int8_t gFM_ScanState; bool gFM_AutoScan; uint8_t gFM_ChannelPosition; bool gFM_FoundFrequency; @@ -85,7 +85,7 @@ int FM_ConfigureChannelState(void) void FM_TurnOff(void) { gFmRadioMode = false; - gFM_Step = 0; + gFM_ScanState = FM_SCAN_OFF; g_2000038E = 0; GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); gEnableSpeaker = false; @@ -110,7 +110,7 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag) { GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); gEnableSpeaker = false; - if (gFM_Step == 0) { + if (gFM_ScanState == FM_SCAN_OFF) { gFmPlayCountdown = 120; } else { gFmPlayCountdown = 10; @@ -130,13 +130,13 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag) gEeprom.FM_FrequencyPlaying = Frequency; } - gFM_Step = Step; + gFM_ScanState = Step; BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying); } void FM_PlayAndUpdate(void) { - gFM_Step = 0; + gFM_ScanState = FM_SCAN_OFF; if (gFM_AutoScan) { gEeprom.FM_IsMrMode = true; gEeprom.FM_SelectedChannel = 0; @@ -214,7 +214,7 @@ static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) if (gAskToSave) { State = STATE_SAVE; } else { - if (gFM_Step) { + if (gFM_ScanState != FM_SCAN_OFF) { gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; return; } @@ -321,7 +321,7 @@ static void FM_Key_EXIT(bool bKeyPressed, bool bKeyHeld) return; } gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; - if (gFM_Step == 0) { + if (gFM_ScanState == FM_SCAN_OFF) { if (gInputBoxIndex == 0) { if (!gAskToSave && !gAskToDelete) { ACTION_FM(); @@ -364,7 +364,7 @@ static void FM_Key_MENU(bool bKeyPressed, bool bKeyHeld) gRequestDisplayScreen = DISPLAY_FM; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; - if (gFM_Step == 0) { + if (gFM_ScanState == FM_SCAN_OFF) { if (!gEeprom.FM_IsMrMode) { if (gAskToSave) { gFM_Channels[gFM_ChannelPosition] = gEeprom.FM_FrequencyPlaying; @@ -420,7 +420,7 @@ static void FM_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Step) gFM_ChannelPosition = NUMBER_AddWithWraparound(gFM_ChannelPosition, Step, 0, 19); return; } - if (gFM_Step) { + if (gFM_ScanState != FM_SCAN_OFF) { if (gFM_AutoScan) { gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; return; @@ -518,7 +518,7 @@ void FM_Play(void) if (gFM_AutoScan && gEeprom.FM_FrequencyPlaying >= gEeprom.FM_UpperLimit) { FM_PlayAndUpdate(); } else { - FM_Tune(gEeprom.FM_FrequencyPlaying, gFM_Step, false); + FM_Tune(gEeprom.FM_FrequencyPlaying, gFM_ScanState, false); } GUI_SelectNextDisplay(DISPLAY_FM); @@ -527,7 +527,7 @@ void FM_Play(void) void FM_Start(void) { gFmRadioMode = true; - gFM_Step = 0; + gFM_ScanState = FM_SCAN_OFF; g_2000038E = 0; BK1080_Init(gEeprom.FM_FrequencyPlaying, true); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); diff --git a/app/fm.h b/app/fm.h index 28c7bb6..a87d7d8 100644 --- a/app/fm.h +++ b/app/fm.h @@ -22,11 +22,15 @@ #define FM_CHANNEL_UP 0x01 #define FM_CHANNEL_DOWN 0xFF +enum { + FM_SCAN_OFF = 0U, +}; + extern uint16_t gFM_Channels[20]; extern bool gFmRadioMode; extern uint8_t gFmRadioCountdown; extern volatile uint16_t gFmPlayCountdown; -extern volatile int8_t gFM_Step; +extern volatile int8_t gFM_ScanState; extern bool gFM_AutoScan; extern uint8_t gFM_ChannelPosition; // Doubts about whether this should be signed or not. diff --git a/app/generic.c b/app/generic.c index f57bbbe..838056f 100644 --- a/app/generic.c +++ b/app/generic.c @@ -69,7 +69,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld) gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; return; } - if (gFM_Step == 0) { + if (gFM_ScanState == FM_SCAN_OFF) { gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; return; } @@ -105,7 +105,7 @@ void GENERIC_Key_PTT(bool bKeyPressed) return; } - if (gStepDirection) { + if (gScanState != SCAN_OFF) { FUN_0000773c(); gPttDebounceCounter = 0; gPttIsPressed = false; @@ -113,7 +113,7 @@ void GENERIC_Key_PTT(bool bKeyPressed) return; } - if (gFM_Step == 0) { + if (gFM_ScanState == FM_SCAN_OFF) { if (gCssScanMode == CSS_SCAN_MODE_OFF) { if (gScreenToDisplay == DISPLAY_MENU || gScreenToDisplay == DISPLAY_FM) { gRequestDisplayScreen = DISPLAY_MAIN; diff --git a/app/main.c b/app/main.c index 964001f..3955cca 100644 --- a/app/main.c +++ b/app/main.c @@ -264,7 +264,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) if (!bKeyHeld && bKeyPressed) { gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; if (!gFmRadioMode) { - if (gStepDirection == 0) { + if (gScanState == SCAN_OFF) { if (gInputBoxIndex == 0) { return; } @@ -321,7 +321,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) ACTION_Scan(false); return; } - if (gStepDirection == 0 && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) { + if (gScanState == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) { gDTMF_InputMode = true; memcpy(gDTMF_InputBox, gDTMF_String, 15); gDTMF_InputIndex = 0; @@ -376,7 +376,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; } - if (gStepDirection == 0) { + if (gScanState == SCAN_OFF) { if (IS_NOT_NOAA_CHANNEL(Channel)) { uint8_t Next; diff --git a/app/scanner.c b/app/scanner.c index f9bfa66..5405bb6 100644 --- a/app/scanner.c +++ b/app/scanner.c @@ -39,6 +39,7 @@ volatile uint16_t ScanPauseDelayIn10msec; uint8_t gScanProgressIndicator; uint8_t gScanHitCount; bool gScanUseCssResult; +uint8_t gScanState; static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { diff --git a/app/scanner.h b/app/scanner.h index cc448eb..1bf2552 100644 --- a/app/scanner.h +++ b/app/scanner.h @@ -29,6 +29,10 @@ enum SCAN_CssState_t { typedef enum SCAN_CssState_t SCAN_CssState_t; +enum { + SCAN_OFF = 0U, +}; + extern DCS_CodeType_t gScanCssResultType; extern uint8_t gScanCssResultIndex; extern bool gFlagStartScan; @@ -44,6 +48,7 @@ extern volatile uint16_t ScanPauseDelayIn10msec; extern uint8_t gScanProgressIndicator; extern uint8_t gScanHitCount; extern bool gScanUseCssResult; +extern uint8_t gScanState; void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); diff --git a/misc.c b/misc.c index 7a208eb..a09d965 100644 --- a/misc.c +++ b/misc.c @@ -147,8 +147,6 @@ volatile bool gScheduleFM; uint16_t gCurrentRSSI; -volatile int8_t gStepDirection; - uint8_t gIsLocked = 0xFF; // -------- diff --git a/misc.h b/misc.h index 4940405..b2d72bc 100644 --- a/misc.h +++ b/misc.h @@ -124,7 +124,6 @@ extern CssScanMode_t gCssScanMode; extern bool g_20000382; extern AlarmState_t gAlarmState; extern uint16_t g_2000038E; -extern volatile int8_t gFM_Step; extern uint8_t g_20000393; extern bool gPttWasReleased; extern bool gPttWasPressed; @@ -200,8 +199,6 @@ extern volatile bool gScheduleFM; extern uint16_t gCurrentRSSI; -extern volatile int8_t gStepDirection; - extern uint8_t gIsLocked; // -------- diff --git a/scheduler.c b/scheduler.c index 219beaf..1987087 100644 --- a/scheduler.c +++ b/scheduler.c @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "app/fm.h" #include "app/scanner.h" #include "audio.h" #include "functions.h" @@ -61,7 +62,7 @@ void SystickHandler(void) DECREMENT_AND_TRIGGER(gBatterySave, gBatterySaveCountdownExpired); } - if (gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { + if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT) { if (gCurrentFunction != FUNCTION_RECEIVE) { DECREMENT_AND_TRIGGER(gDualWatchCountdown, gScheduleDualWatch); @@ -69,7 +70,7 @@ void SystickHandler(void) } } - if (gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) { + if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) { if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT) { if (gCurrentFunction != FUNCTION_RECEIVE) { DECREMENT_AND_TRIGGER(gNOAA_Countdown, gScheduleNOAA); @@ -77,7 +78,7 @@ void SystickHandler(void) } } - if (gStepDirection || gCssScanMode == CSS_SCAN_MODE_SCANNING) { + if (gScanState != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING) { if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT) { DECREMENT_AND_TRIGGER(ScanPauseDelayIn10msec, gScheduleScanListen); } @@ -87,7 +88,7 @@ void SystickHandler(void) DECREMENT_AND_TRIGGER(gCountdownToPlayNextVoice, gFlagPlayQueuedVoice); - if (gFM_Step && gCurrentFunction != FUNCTION_MONITOR) { + if (gFM_ScanState != FM_SCAN_OFF && gCurrentFunction != FUNCTION_MONITOR) { if (gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE) { DECREMENT_AND_TRIGGER(gFmPlayCountdown, gScheduleFM); } diff --git a/ui/fmradio.c b/ui/fmradio.c index 1f0a006..851a010 100644 --- a/ui/fmradio.c +++ b/ui/fmradio.c @@ -43,7 +43,7 @@ void UI_DisplayFM(void) } else if (gAskToDelete) { strcpy(String, "DEL?"); } else { - if (gFM_Step == 0) { + if (gFM_ScanState == FM_SCAN_OFF) { if (!gEeprom.FM_IsMrMode) { for (i = 0; i < 20; i++) { if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) { diff --git a/ui/ui.c b/ui/ui.c index 4d245ba..a174826 100644 --- a/ui/ui.c +++ b/ui/ui.c @@ -16,6 +16,8 @@ #include #include "app/dtmf.h" +#include "app/fm.h" +#include "app/scanner.h" #include "driver/keyboard.h" #include "misc.h" #include "ui/aircopy.h" @@ -63,8 +65,8 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display) gInputBoxIndex = 0; gIsInSubMenu = false; gCssScanMode = CSS_SCAN_MODE_OFF; - gStepDirection = 0; - gFM_Step = 0; + gScanState = SCAN_OFF; + gFM_ScanState = FM_SCAN_OFF; gAskForConfirmation = 0; gDTMF_InputMode = false; gDTMF_InputIndex = 0;