diff --git a/app/app.c b/app/app.c index 9a44493..bac74a1 100644 --- a/app/app.c +++ b/app/app.c @@ -54,7 +54,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); -static void FUN_00005144(void) +static void APP_CheckForIncoming(void) { if (!g_SquelchLost) { return; @@ -70,33 +70,33 @@ static void FUN_00005144(void) gNOAA_Countdown = 20; gScheduleNOAA = false; } - FUNCTION_Select(FUNCTION_3); + FUNCTION_Select(FUNCTION_INCOMING); return; } if (gRxReceptionMode != RX_MODE_NONE) { - FUNCTION_Select(FUNCTION_3); + FUNCTION_Select(FUNCTION_INCOMING); return; } gDualWatchCountdown = 100; gScheduleDualWatch = false; } else { if (gRxReceptionMode != RX_MODE_NONE) { - FUNCTION_Select(FUNCTION_3); + FUNCTION_Select(FUNCTION_INCOMING); return; } ScanPauseDelayIn10msec = 20; gScheduleScanListen = false; } gRxReceptionMode = RX_MODE_DETECTED; - FUNCTION_Select(FUNCTION_3); + FUNCTION_Select(FUNCTION_INCOMING); } -void FUN_000051e8(void) +static void APP_HandleIncoming(void) { bool bFlag; if (!g_SquelchLost) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); gUpdateDisplay = true; return; } @@ -294,16 +294,16 @@ Skip: void FUN_0000510c(void) { switch (gCurrentFunction) { - case FUNCTION_0: - FUN_00005144(); + case FUNCTION_FOREGROUND: + APP_CheckForIncoming(); break; case FUNCTION_POWER_SAVE: if (!gRxIdleMode) { - FUN_00005144(); + APP_CheckForIncoming(); } break; - case FUNCTION_3: - FUN_000051e8(); + case FUNCTION_INCOMING: + APP_HandleIncoming(); break; case FUNCTION_RECEIVE: FUN_000052f0(); @@ -463,7 +463,7 @@ Skip: } } -void NOAA_IncreaseChannel(void) +static void NOAA_IncreaseChannel(void) { gNoaaChannel++; if (gNoaaChannel > 9) { @@ -581,7 +581,7 @@ void APP_EndTransmission(void) RADIO_SetupRegisters(false); } -static void FUN_00008334(void) +static void APP_HandleVox(void) { if (!gSetting_KILLED) { if (g_200003B6 == 0) { @@ -601,11 +601,11 @@ static void FUN_00008334(void) } if (gCurrentFunction == FUNCTION_TRANSMIT && !gPttIsPressed && !gVOX_NoiseDetected) { if (gFlagEndTransmission) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); } else { APP_EndTransmission(); if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); } else { gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; } @@ -617,7 +617,7 @@ static void FUN_00008334(void) } else if (g_VOX_Lost) { gVOX_NoiseDetected = true; if (gCurrentFunction == FUNCTION_POWER_SAVE) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); } if (gCurrentFunction != FUNCTION_TRANSMIT) { gDTMF_ReplyState = DTMF_REPLY_NONE; @@ -657,13 +657,13 @@ void APP_Update(void) if (gScreenToDisplay != DISPLAY_SCANNER && gScanState != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0) { if (IS_FREQ_CHANNEL(gNextMrChannel)) { - if (gCurrentFunction == FUNCTION_3) { + if (gCurrentFunction == FUNCTION_INCOMING) { APP_StartListening(FUNCTION_RECEIVE); } else { FREQ_NextChannel(); } } else { - if (gCopyOfCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_3) { + if (gCopyOfCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING) { APP_StartListening(FUNCTION_RECEIVE); } else { MR_NextChannel(); @@ -709,7 +709,7 @@ void APP_Update(void) } if (gEeprom.VOX_SWITCH) { - FUN_00008334(); + APP_HandleVox(); } if (gSchedulePowerSave) { @@ -909,7 +909,7 @@ void APP_TimeSlice10ms(void) if (gRTTECountdown) { gRTTECountdown--; if (gRTTECountdown == 0) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); gUpdateDisplay = true; } } @@ -1296,7 +1296,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) bool bFlag; if (gCurrentFunction == FUNCTION_POWER_SAVE) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); } gBatterySaveCountdown = 1000; if (gEeprom.AUTO_KEYPAD_LOCK) { @@ -1462,7 +1462,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } else if (!bKeyHeld && bKeyPressed) { FUN_00001150(); if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); } else { gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; } diff --git a/app/app.h b/app/app.h index fc42d94..e8e1979 100644 --- a/app/app.h +++ b/app/app.h @@ -19,11 +19,13 @@ #include #include "functions.h" +#include "radio.h" void FUN_0000773c(void); void APP_EndTransmission(void); void CHANNEL_Next(bool bFlag, int8_t Direction); void APP_StartListening(FUNCTION_Type_t Function); +void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step); void APP_Update(void); void APP_TimeSlice10ms(void); diff --git a/app/generic.c b/app/generic.c index 6267fc1..9e7f809 100644 --- a/app/generic.c +++ b/app/generic.c @@ -82,11 +82,11 @@ void GENERIC_Key_PTT(bool bKeyPressed) if (gScreenToDisplay == DISPLAY_MAIN) { if (gCurrentFunction == FUNCTION_TRANSMIT) { if (gFlagEndTransmission) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); } else { APP_EndTransmission(); if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); } else { gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; } diff --git a/app/main.c b/app/main.c index 7b8e761..c3b46e4 100644 --- a/app/main.c +++ b/app/main.c @@ -30,8 +30,6 @@ #include "ui/inputbox.h" #include "ui/ui.h" -extern void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step); - static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { uint8_t Vfo; diff --git a/app/uart.c b/app/uart.c index 0364950..c78b0bd 100644 --- a/app/uart.c +++ b/app/uart.c @@ -369,7 +369,7 @@ static void CMD_052F(const uint8_t *pBuffer) gEeprom.VfoInfo[0].DTMF_DECODING_ENABLE = false; gIsNoaaMode = false; if (gCurrentFunction == FUNCTION_POWER_SAVE) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); } Timestamp = pCmd->Timestamp; GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); diff --git a/functions.c b/functions.c index 936e0ea..0bbe1b1 100644 --- a/functions.c +++ b/functions.c @@ -83,7 +83,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function) } switch (Function) { - case FUNCTION_0: + case FUNCTION_FOREGROUND: if (gDTMF_ReplyState != DTMF_REPLY_NONE) { RADIO_PrepareCssTX(); } @@ -103,7 +103,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function) break; case FUNCTION_MONITOR: - case FUNCTION_3: + case FUNCTION_INCOMING: case FUNCTION_RECEIVE: gBatterySaveCountdown = 1000; gSchedulePowerSave = false; diff --git a/functions.h b/functions.h index e1427a2..1cc836f 100644 --- a/functions.h +++ b/functions.h @@ -20,11 +20,11 @@ #include enum FUNCTION_Type_t { - FUNCTION_0 = 0U, - FUNCTION_TRANSMIT = 1U, - FUNCTION_MONITOR = 2U, - FUNCTION_3 = 3U, - FUNCTION_RECEIVE = 4U, + FUNCTION_FOREGROUND = 0U, + FUNCTION_TRANSMIT = 1U, + FUNCTION_MONITOR = 2U, + FUNCTION_INCOMING = 3U, + FUNCTION_RECEIVE = 4U, FUNCTION_POWER_SAVE = 5U, }; diff --git a/radio.c b/radio.c index d758ffc..31a900f 100644 --- a/radio.c +++ b/radio.c @@ -602,7 +602,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0) FUNCTION_Init(); if (bSwitchToFunction0) { - FUNCTION_Select(FUNCTION_0); + FUNCTION_Select(FUNCTION_FOREGROUND); } } diff --git a/scheduler.c b/scheduler.c index 1987087..919e38a 100644 --- a/scheduler.c +++ b/scheduler.c @@ -55,7 +55,7 @@ void SystickHandler(void) if (gFoundCTCSSCountdown) { gFoundCTCSSCountdown--; } - if (gCurrentFunction == FUNCTION_0) { + if (gCurrentFunction == FUNCTION_FOREGROUND) { DECREMENT_AND_TRIGGER(gBatterySaveCountdown, gSchedulePowerSave); } if (gCurrentFunction == FUNCTION_POWER_SAVE) {