diff --git a/App/CMakeLists.txt b/App/CMakeLists.txt index e3e5b5d8..44f71d8f 100644 --- a/App/CMakeLists.txt +++ b/App/CMakeLists.txt @@ -117,16 +117,15 @@ endif() # ---- STOCK QUANSHENG FEATURES ---- -# ENABLE_FMRADIO compiles the BK1080 driver and the FM logic/helpers (fm.c). -# The resident FM *screen* (ui/fmradio.c) is redundant with the FM overlay app, -# so it is dropped when OVERLAY_APPS is on - the overlay app reaches the driver -# and the fm.c helpers through the ABI instead, and ACTION_FM's launcher body is -# neutralised in action.c so the resident screen can never open. +# ENABLE_FMRADIO keeps the BK1080 driver and the FM data/helpers shared with the +# overlay. ENABLE_FMRADIO_EMBEDDED additionally selects the legacy resident +# state machine and its integration with the main scheduler. enable_feature(ENABLE_FMRADIO driver/bk1080.c app/fm.c ) if(ENABLE_FMRADIO AND NOT ENABLE_FEAT_F4HWN_OVERLAY_APPS) + target_compile_definitions(App INTERFACE ENABLE_FMRADIO_EMBEDDED) target_sources(App INTERFACE ui/fmradio.c) endif() enable_feature(ENABLE_AIRCOPY diff --git a/App/app/action.c b/App/app/action.c index 3e2f25a4..48c142e9 100644 --- a/App/app/action.c +++ b/App/app/action.c @@ -25,7 +25,7 @@ #ifdef ENABLE_FLASHLIGHT #include "app/flashlight.h" #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #ifdef ENABLE_FEAT_F4HWN_OVERLAY_APPS @@ -33,7 +33,7 @@ #endif #include "app/scanner.h" #include "audio.h" -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "driver/bk1080.h" #endif #include "driver/bk4819.h" @@ -62,7 +62,7 @@ static void ACTION_Beam(void); #endif -#if defined(ENABLE_FMRADIO) +#if defined(ENABLE_FMRADIO_EMBEDDED) static void ACTION_Scan_FM(bool bRestart); #endif @@ -215,7 +215,7 @@ void ACTION_Monitor(void) RADIO_SetupRegisters(true); -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode) { FM_Start(); gRequestDisplayScreen = DISPLAY_FM; @@ -229,7 +229,7 @@ void ACTION_Scan(bool bRestart) { (void)bRestart; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode) { ACTION_Scan_FM(bRestart); return; @@ -322,7 +322,7 @@ void ACTION_SwitchDemodul(void) } -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED inline static bool ACTION_IsBlockedInFM(uint8_t action) { switch (action) { @@ -370,7 +370,7 @@ static void ACTION_Execute(uint8_t action) return; } -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode && ACTION_IsBlockedInFM(action)) { gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; return; @@ -587,6 +587,7 @@ void ACTION_FM(void) #endif /* !ENABLE_FEAT_F4HWN_OVERLAY_APPS */ } +#ifdef ENABLE_FMRADIO_EMBEDDED static void ACTION_Scan_FM(bool bRestart) { if (FUNCTION_IsRx()) @@ -626,6 +627,7 @@ static void ACTION_Scan_FM(bool bRestart) #endif } +#endif #endif @@ -785,7 +787,7 @@ void ACTION_Mute(void) gMute = !gMute; // Update the registers - #ifdef ENABLE_FMRADIO + #ifdef ENABLE_FMRADIO_EMBEDDED BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, gMute ? 0x0A10 : 0x0A1F); #endif gEeprom.VOLUME_GAIN = gMute ? 0 : gEeprom.VOLUME_GAIN_BACKUP; diff --git a/App/app/app.c b/App/app/app.c index a6946c0e..2853169e 100644 --- a/App/app/app.c +++ b/App/app/app.c @@ -32,7 +32,7 @@ #ifdef ENABLE_FLASHLIGHT #include "app/flashlight.h" #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #include "app/generic.h" @@ -53,7 +53,7 @@ // #include "bsp/dp32g030/pwmplus.h" #endif #include "driver/backlight.h" -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "driver/bk1080.h" #endif #include "driver/bk4819.h" @@ -111,8 +111,12 @@ void (*const ProcessKeysFunctions[])(KEY_Code_t Key, bool bKeyPressed, bool bKey [DISPLAY_MENU] = &MENU_ProcessKeys, [DISPLAY_SCANNER] = &SCANNER_ProcessKeys, -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED [DISPLAY_FM] = &FM_ProcessKeys, +#elif defined(ENABLE_FMRADIO) + /* The modal FM overlay handles its own keys. Keep the enum slot populated + for configurations where DISPLAY_FM is the final display entry. */ + [DISPLAY_FM] = &MAIN_ProcessKeys, #endif #ifdef ENABLE_AIRCOPY @@ -246,7 +250,7 @@ static bool ScreenSaverCanDisplay(bool modal) gCurrentFunction == FUNCTION_TRANSMIT || FUNCTION_IsRx() || gPttIsPressed -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED || (gFM_ScanState != FM_SCAN_OFF && !gFM_FoundFrequency) #endif #ifdef ENABLE_FEAT_F4HWN_BEAM @@ -260,7 +264,7 @@ static bool ScreenSaverCanDisplay(bool modal) if (modal || gScreenToDisplay == DISPLAY_MAIN) return true; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gScreenToDisplay == DISPLAY_FM) return true; #endif @@ -374,7 +378,7 @@ static void CheckForIncoming(void) if (!g_SquelchLost) return; // squelch is closed -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED // FM scan in progress: ignore main-channel RX so scanning is not interrupted. // Normal FM listening (FM_SCAN_OFF) still yields to channel signals as before. if (gFmRadioMode && gFM_ScanState != FM_SCAN_OFF) @@ -513,7 +517,7 @@ static void HandleIncoming(void) } #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED // Defensive: do not leave FM scan for a main-channel signal. if (gFmRadioMode && gFM_ScanState != FM_SCAN_OFF) return; @@ -784,7 +788,7 @@ void APP_StartListening(FUNCTION_Type_t function) return; #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode) BK1080_Init0(); #endif @@ -853,7 +857,7 @@ void APP_StartListening(FUNCTION_Type_t function) RXTX_LOG_BeginRx(gRxVfo, function); #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (function == FUNCTION_MONITOR || gFmRadioMode) #else if (function == FUNCTION_MONITOR) @@ -1159,7 +1163,7 @@ static void HandleVox(void) gVoxPauseCountdown = 0; } -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode) return; #endif @@ -1321,7 +1325,7 @@ void APP_Update(void) if (gCurrentFunction != FUNCTION_TRANSMIT) HandleFunction(); -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED // if (gFmRadioCountdown_500ms > 0) if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11 return; @@ -1366,7 +1370,7 @@ void APP_Update(void) #ifdef ENABLE_VOICE && gVoiceWriteIndex == 0 #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED && !gFmRadioMode #endif #ifdef ENABLE_DTMF_CALLING @@ -1385,7 +1389,7 @@ void APP_Update(void) gScheduleDualWatch = false; } -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gScheduleFM && gFM_ScanState != FM_SCAN_OFF && !FUNCTION_IsRx()) { // switch to FM radio mode FM_Play(); @@ -1405,7 +1409,7 @@ void APP_Update(void) || gScanStateDir != SCAN_OFF || gCssBackgroundScan || gScreenToDisplay != DISPLAY_MAIN -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED || gFmRadioMode #endif #ifdef ENABLE_DTMF_CALLING @@ -1760,7 +1764,7 @@ void APP_TimeSlice10ms(void) // Skipping authentic device checks -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11 return; #endif @@ -1792,7 +1796,7 @@ void APP_TimeSlice10ms(void) } } -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode && gFM_RestoreCountdown_10ms > 0) { if (--gFM_RestoreCountdown_10ms == 0) { FM_Start(); // switch back to FM radio mode @@ -1880,7 +1884,7 @@ void APP_TimeSlice500ms(void) { if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE) && (gInputBoxIndex > 0 && gInputBoxIndex < 4) -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED && (!gFmRadioMode) #endif ) @@ -1927,7 +1931,7 @@ void APP_TimeSlice500ms(void) // Skipped authentic device check -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioCountdown_500ms > 0) { gFmRadioCountdown_500ms--; @@ -2059,7 +2063,7 @@ void APP_TimeSlice500ms(void) } if (!gCssBackgroundScan && gScanStateDir == SCAN_OFF && !SCANNER_IsScanning() -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED && (gFM_ScanState == FM_SCAN_OFF || gAskToSave) #endif #ifdef ENABLE_AIRCOPY @@ -2114,7 +2118,7 @@ void APP_TimeSlice500ms(void) GUI_DisplayType_t disp = DISPLAY_INVALID; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode && ! FUNCTION_IsRx()) { disp = DISPLAY_FM; } @@ -2136,7 +2140,7 @@ void APP_TimeSlice500ms(void) if (!gPttIsPressed && gVFOStateResumeCountdown_500ms > 0 && --gVFOStateResumeCountdown_500ms == 0) { RADIO_SetVfoState(VFO_STATE_NORMAL); -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode && !FUNCTION_IsRx()) { // switch back to FM radio mode FM_Start(); @@ -2289,7 +2293,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) flagSaveSettings = false; } -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFlagSaveFM) { SETTINGS_SaveFM(); gFlagSaveFM = false; @@ -2583,7 +2587,7 @@ Skip: gUpdateStatus = true; } -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gRequestSaveFM) { gRequestSaveFM = false; if (!bKeyHeld) diff --git a/App/app/dtmf.c b/App/app/dtmf.c index 64dd0477..138103af 100644 --- a/App/app/dtmf.c +++ b/App/app/dtmf.c @@ -18,7 +18,7 @@ #include // NULL #include "app/chFrScanner.h" -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #include "app/scanner.h" @@ -279,7 +279,7 @@ void DTMF_HandleRequest(void) gDTMF_ReplyState = DTMF_REPLY_AB; - #ifdef ENABLE_FMRADIO + #ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode) { FM_TurnOff(); diff --git a/App/app/fm.c b/App/app/fm.c index 0d31fbf1..442f05ea 100644 --- a/App/app/fm.c +++ b/App/app/fm.c @@ -33,6 +33,7 @@ #include "ui/ui.h" uint16_t gFM_Channels[FM_CHANNELS_MAX]; +#ifdef ENABLE_FMRADIO_EMBEDDED bool gFmRadioMode; uint8_t gFmRadioCountdown_500ms; volatile uint16_t gFmPlayCountdown_10ms; @@ -52,7 +53,6 @@ const uint8_t BUTTON_EVENT_HELD = BUTTON_STATE_PRESSED | BUTTON_STATE_HELD; const uint8_t BUTTON_EVENT_SHORT = 0; const uint8_t BUTTON_EVENT_LONG = BUTTON_STATE_HELD; -#ifndef ENABLE_FEAT_F4HWN_OVERLAY_APPS static void Key_FUNC(KEY_Code_t Key, uint8_t state); #endif @@ -95,7 +95,7 @@ int FM_ConfigureChannelState(void) return 0; } -#ifndef ENABLE_FEAT_F4HWN_OVERLAY_APPS +#ifdef ENABLE_FMRADIO_EMBEDDED void FM_SetFrequency(void) { BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/); @@ -243,7 +243,7 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit) return 0; } -#ifndef ENABLE_FEAT_F4HWN_OVERLAY_APPS +#ifdef ENABLE_FMRADIO_EMBEDDED static void Key_DIGITS(KEY_Code_t Key, uint8_t state) { enum { STATE_FREQ_MODE, STATE_MR_MODE, STATE_SAVE }; @@ -666,31 +666,6 @@ void FM_Start(void) SETTINGS_WriteCurrentState(); #endif } -#else -/* - * Broadcast FM is sovereign in Overlay builds: its app owns tuning, scanning, - * audio and persistence through app_api. Keep only the shared channel/state - * loader and FM_CheckFrequencyLock above; these tiny compatibility entry points - * satisfy generic firmware paths which cannot become active because Overlay - * builds never set gFmRadioMode or gFM_ScanState. - */ -void FM_TurnOff(void) {} -void FM_EraseChannels(void) {} -void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag) -{ - (void)Frequency; - (void)Step; - (void)bFlag; -} -void FM_PlayAndUpdate(void) {} -void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) -{ - (void)Key; - (void)bKeyPressed; - (void)bKeyHeld; -} -void FM_Play(void) {} -void FM_Start(void) {} #endif #endif diff --git a/App/app/fm.h b/App/app/fm.h index 6a315a30..1578a2e7 100644 --- a/App/app/fm.h +++ b/App/app/fm.h @@ -19,9 +19,12 @@ #ifdef ENABLE_FMRADIO -#include "driver/keyboard.h" #include "misc.h" +#ifdef ENABLE_FMRADIO_EMBEDDED +#include "driver/keyboard.h" +#endif + #define FM_CHANNEL_UP 0x01 #define FM_CHANNEL_DOWN 0xFF @@ -30,32 +33,34 @@ enum { }; extern uint16_t gFM_Channels[FM_CHANNELS_MAX]; + +bool FM_CheckValidChannel(uint8_t Channel); +// returns first valid channel starting at Channel +uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction); +int FM_ConfigureChannelState(void); +int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit); + +#ifdef ENABLE_FMRADIO_EMBEDDED extern bool gFmRadioMode; extern uint8_t gFmRadioCountdown_500ms; extern volatile uint16_t gFmPlayCountdown_10ms; extern volatile int8_t gFM_ScanState; extern bool gFM_AutoScan; extern uint8_t gFM_ChannelPosition; -// Doubts about whether this should be signed or not -extern uint16_t gFM_FrequencyDeviation; extern bool gFM_FoundFrequency; extern uint16_t gFM_RestoreCountdown_10ms; -bool FM_CheckValidChannel(uint8_t Channel); -// returns first valid channel starting at Channel -uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction); -int FM_ConfigureChannelState(void); void FM_TurnOff(void); void FM_EraseChannels(void); void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag); void FM_PlayAndUpdate(void); -int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit); void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); void FM_Play(void); void FM_Start(void); +#endif #endif diff --git a/App/app/generic.c b/App/app/generic.c index f6c907a2..f9e3ff0f 100644 --- a/App/app/generic.c +++ b/App/app/generic.c @@ -20,7 +20,7 @@ #include "app/chFrScanner.h" #include "app/common.h" -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif @@ -56,7 +56,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld) COMMON_KeypadLockToggle(); } else { // released -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM) return; #else @@ -77,7 +77,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld) } } else { // short pressed -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gScreenToDisplay != DISPLAY_FM) #endif { @@ -85,7 +85,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld) return; } -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFM_ScanState == FM_SCAN_OFF) { // not scanning gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; return; @@ -132,7 +132,7 @@ void GENERIC_Key_PTT(bool bKeyPressed) -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFM_ScanState != FM_SCAN_OFF) { // FM radio is scanning .. stop FM_PlayAndUpdate(); #ifdef ENABLE_VOICE @@ -143,7 +143,7 @@ void GENERIC_Key_PTT(bool bKeyPressed) } #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gScreenToDisplay == DISPLAY_FM) goto start_tx; // listening to the FM radio .. start TX'ing #endif @@ -200,7 +200,7 @@ cancel_tx: done: gPttDebounceCounter = 0; if (gScreenToDisplay != DISPLAY_MENU -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED && gRequestDisplayScreen != DISPLAY_FM #endif ) { diff --git a/App/app/main.c b/App/app/main.c index 6b04aba6..29fc3c5d 100644 --- a/App/app/main.c +++ b/App/app/main.c @@ -20,7 +20,7 @@ #include "app/app.h" #include "app/chFrScanner.h" #include "app/common.h" -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #include "app/generic.h" @@ -728,7 +728,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) } #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (!gFmRadioMode) #endif { @@ -763,7 +763,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) return; } -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED ACTION_FM(); #endif return; @@ -1064,7 +1064,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode && Key != KEY_PTT && Key != KEY_EXIT) { if (!bKeyHeld && bKeyPressed) gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; diff --git a/App/app/uart.c b/App/app/uart.c index 779feafd..05913893 100644 --- a/App/app/uart.c +++ b/App/app/uart.c @@ -20,7 +20,7 @@ #if !defined(ENABLE_OVERLAY) #include "py32f0xx.h" #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #include "app/uart.h" @@ -360,7 +360,7 @@ static void CMD_0514(uint32_t Port, const uint8_t *pBuffer) } #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED gFmRadioCountdown_500ms = fm_radio_countdown_500ms; #endif @@ -404,7 +404,7 @@ static void CMD_051B(uint32_t Port, const uint8_t *pBuffer) gSerialConfigCountDown_500ms = 12; // 6 sec - #ifdef ENABLE_FMRADIO + #ifdef ENABLE_FMRADIO_EMBEDDED gFmRadioCountdown_500ms = fm_radio_countdown_500ms; #endif @@ -467,7 +467,7 @@ static void CMD_051D(uint32_t Port, const uint8_t *pBuffer) bReloadEeprom = false; - #ifdef ENABLE_FMRADIO + #ifdef ENABLE_FMRADIO_EMBEDDED gFmRadioCountdown_500ms = fm_radio_countdown_500ms; #endif @@ -537,7 +537,7 @@ static void CMD_052D(uint32_t Port, const uint8_t *pBuffer) REPLY_052D_t Reply; bool bIsLocked; - #ifdef ENABLE_FMRADIO + #ifdef ENABLE_FMRADIO_EMBEDDED gFmRadioCountdown_500ms = fm_radio_countdown_500ms; #endif Reply.Header.ID = 0x052E; diff --git a/App/audio.c b/App/audio.c index 42308e96..12407f7e 100644 --- a/App/audio.c +++ b/App/audio.c @@ -15,11 +15,11 @@ * limitations under the License. */ -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #include "audio.h" -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "driver/bk1080.h" #endif #include "driver/bk4819.h" @@ -70,7 +70,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) if (Beep >= ARRAY_SIZE(BEEP_Classic_array)) return; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode) BK1080_Mute(true); #endif @@ -112,7 +112,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) SYSTEM_DelayMs(5); BK4819_WriteRegister(BK4819_REG_71, ToneConfig); -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED const bool isFmRadio = gFmRadioMode; if (isFmRadio) @@ -122,7 +122,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) if (gEnableSpeaker) AUDIO_AudioPathOn(); -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (isFmRadio) BK1080_Mute(false); #endif @@ -275,7 +275,7 @@ void AUDIO_PlaySingleVoice(bool bFlag) if (FUNCTION_IsRx()) // 1of11 BK4819_SetAF(BK4819_AF_MUTE); - #ifdef ENABLE_FMRADIO + #ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode) BK1080_Mute(true); #endif @@ -299,7 +299,7 @@ void AUDIO_PlaySingleVoice(bool bFlag) if (FUNCTION_IsRx()) // 1of11 RADIO_SetModulation(gRxVfo->Modulation); - #ifdef ENABLE_FMRADIO + #ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode) BK1080_Mute(false); #endif @@ -440,7 +440,7 @@ void AUDIO_PlayQueuedVoice(void) RADIO_SetModulation(gRxVfo->Modulation); // 1of11 } - #ifdef ENABLE_FMRADIO + #ifdef ENABLE_FMRADIO_EMBEDDED if (gFmRadioMode) BK1080_Mute(false); #endif diff --git a/App/functions.c b/App/functions.c index c416ff15..68a2bbc0 100644 --- a/App/functions.c +++ b/App/functions.c @@ -17,13 +17,13 @@ #include #include "app/dtmf.h" -#if defined(ENABLE_FMRADIO) +#if defined(ENABLE_FMRADIO_EMBEDDED) #include "app/fm.h" #endif #include "audio.h" #include "dcs.h" #include "driver/backlight.h" -#if defined(ENABLE_FMRADIO) +#if defined(ENABLE_FMRADIO_EMBEDDED) #include "driver/bk1080.h" #endif #include "driver/bk4819.h" @@ -103,7 +103,7 @@ void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction) return; } -#if defined(ENABLE_FMRADIO) +#if defined(ENABLE_FMRADIO_EMBEDDED) if (gFmRadioMode) gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms; #endif @@ -156,7 +156,7 @@ void FUNCTION_Transmit() gDTMF_RX_live_timeout = 0; DTMF_clear_input_box_memory(); -#if defined(ENABLE_FMRADIO) +#if defined(ENABLE_FMRADIO_EMBEDDED) if (gFmRadioMode) BK1080_Init0(); #endif @@ -284,7 +284,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function) gBatterySaveCountdown_10ms = battery_save_count_10ms; gSchedulePowerSave = false; -#if defined(ENABLE_FMRADIO) +#if defined(ENABLE_FMRADIO_EMBEDDED) if(Function != FUNCTION_INCOMING) gFM_RestoreCountdown_10ms = 0; #endif diff --git a/App/misc.c b/App/misc.c index 8c5292ad..e1b8987e 100644 --- a/App/misc.c +++ b/App/misc.c @@ -251,7 +251,7 @@ bool gFlagResetVfos; bool gRequestSaveVFO; uint16_t gRequestSaveChannel; bool gRequestSaveSettings; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED bool gRequestSaveFM; #endif bool gFlagPrepareTX; @@ -259,7 +259,7 @@ bool gFlagPrepareTX; bool gFlagAcceptSetting; bool gFlagRefreshSetting; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED bool gFlagSaveFM; #endif bool g_CDCSS_Lost; @@ -312,7 +312,7 @@ volatile bool gNextTimeslice40ms; volatile bool gScheduleNOAA = true; #endif volatile bool gFlagTailNoteEliminationComplete; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED volatile bool gScheduleFM; #endif diff --git a/App/misc.h b/App/misc.h index 8457a621..dd5d6e3a 100644 --- a/App/misc.h +++ b/App/misc.h @@ -389,7 +389,7 @@ extern bool gFlagResetVfos; extern bool gRequestSaveVFO; extern uint16_t gRequestSaveChannel; extern bool gRequestSaveSettings; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED extern bool gRequestSaveFM; #endif extern uint8_t gKeypadLocked; @@ -398,7 +398,7 @@ extern bool gFlagPrepareTX; extern bool gFlagAcceptSetting; // accept menu setting extern bool gFlagRefreshSetting; // refresh menu display -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED extern bool gFlagSaveFM; #endif extern bool g_CDCSS_Lost; @@ -437,7 +437,7 @@ extern uint8_t gFSKWriteIndex; extern volatile bool gNextTimeslice; extern bool gUpdateDisplay; extern bool gF_LOCK; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED extern uint8_t gFM_ChannelPosition; #endif extern uint8_t gShowChPrefix; @@ -453,7 +453,7 @@ extern volatile bool gNextTimeslice40ms; #endif extern volatile bool gFlagTailNoteEliminationComplete; extern volatile uint8_t gVFOStateResumeCountdown_500ms; -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED extern volatile bool gScheduleFM; #endif extern uint8_t gIsLocked; diff --git a/App/radio.c b/App/radio.c index 69cc6bf7..fb84c2d9 100644 --- a/App/radio.c +++ b/App/radio.c @@ -21,7 +21,7 @@ #ifdef ENABLE_FEAT_F4HWN_RXTX_LOG #include "app/rxtx_log.h" #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #include "audio.h" @@ -887,7 +887,7 @@ void RADIO_SetupRegisters(bool switchToForeground) #ifdef ENABLE_NOAA && !IS_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED && !gFmRadioMode #endif ){ diff --git a/App/scheduler.c b/App/scheduler.c index 0d2031a1..3401e5ad 100644 --- a/App/scheduler.c +++ b/App/scheduler.c @@ -16,7 +16,7 @@ #include "scheduler.h" #include "app/chFrScanner.h" -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #include "app/scanner.h" @@ -136,7 +136,7 @@ void SysTick_Handler(void) DECREMENT_AND_TRIGGER(gCountdownToPlayNextVoice_10ms, gFlagPlayQueuedVoice); #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED if (gFM_ScanState != FM_SCAN_OFF && gCurrentFunction != FUNCTION_MONITOR) if (gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE) DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM); diff --git a/App/ui/status.c b/App/ui/status.c index fe24697b..789deee3 100644 --- a/App/ui/status.c +++ b/App/ui/status.c @@ -21,7 +21,7 @@ #ifdef ENABLE_FEAT_F4HWN_RXTX_LOG #include "app/rxtx_log.h" #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #include "app/scanner.h" diff --git a/App/ui/ui.c b/App/ui/ui.c index 8a5aca29..b509d2ec 100644 --- a/App/ui/ui.c +++ b/App/ui/ui.c @@ -19,7 +19,7 @@ #include "app/chFrScanner.h" #include "app/dtmf.h" -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "app/fm.h" #endif #include "driver/keyboard.h" @@ -27,7 +27,7 @@ #ifdef ENABLE_AIRCOPY #include "ui/aircopy.h" #endif -#ifdef ENABLE_FMRADIO +#ifdef ENABLE_FMRADIO_EMBEDDED #include "ui/fmradio.h" #endif #ifdef ENABLE_FEAT_F4HWN_RXTX_LOG @@ -53,7 +53,7 @@ void (*const UI_DisplayFunctions[])(void) = { [DISPLAY_MENU] = &UI_DisplayMenu, [DISPLAY_SCANNER] = &UI_DisplayScanner, -#if defined(ENABLE_FMRADIO) && !defined(ENABLE_FEAT_F4HWN_OVERLAY_APPS) +#ifdef ENABLE_FMRADIO_EMBEDDED [DISPLAY_FM] = &UI_DisplayFM, #elif defined(ENABLE_FMRADIO) /* The FM overlay app replaces the resident FM screen (ui/fmradio.c is not @@ -94,7 +94,7 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display) gIsInSubMenu = false; gCssBackgroundScan = false; gScanStateDir = SCAN_OFF; - #ifdef ENABLE_FMRADIO + #ifdef ENABLE_FMRADIO_EMBEDDED gFM_ScanState = FM_SCAN_OFF; #endif gAskForConfirmation = 0;