Use function to check if in RX mode

This commit is contained in:
Juan Antonio 2023-12-07 12:12:19 +01:00
parent c3906f42f8
commit 2164461449
7 changed files with 23 additions and 45 deletions

View File

@ -102,9 +102,7 @@ void ACTION_Scan(bool bRestart)
#ifdef ENABLE_FMRADIO
if (gFmRadioMode)
{
if (gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_TRANSMIT)
if (FUNCTION_IsRx())
{
GUI_SelectNextDisplay(DISPLAY_FM);

View File

@ -897,12 +897,8 @@ void APP_Update(void)
}
#ifdef ENABLE_FMRADIO
if (gScheduleFM &&
gFM_ScanState != FM_SCAN_OFF &&
gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_TRANSMIT)
{ // switch to FM radio mode
if (gScheduleFM && gFM_ScanState != FM_SCAN_OFF && !FUNCTION_IsRx()) {
// switch to FM radio mode
FM_Play();
gScheduleFM = false;
}
@ -1479,11 +1475,7 @@ void APP_TimeSlice500ms(void)
GUI_DisplayType_t disp = DISPLAY_INVALID;
#ifdef ENABLE_FMRADIO
if (gFmRadioMode &&
gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_TRANSMIT)
{
if (gFmRadioMode && ! FUNCTION_IsRx()) {
disp = DISPLAY_FM;
}
#endif
@ -1509,11 +1501,8 @@ void APP_TimeSlice500ms(void)
{
RADIO_SetVfoState(VFO_STATE_NORMAL);
#ifdef ENABLE_FMRADIO
if (gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_TRANSMIT &&
gCurrentFunction != FUNCTION_MONITOR &&
gFmRadioMode)
{ // switch back to FM radio mode
if (gFmRadioMode && !FUNCTION_IsRx()) {
// switch back to FM radio mode
FM_Start();
GUI_SelectNextDisplay(DISPLAY_FM);
}

12
audio.c
View File

@ -255,9 +255,7 @@ void AUDIO_PlaySingleVoice(bool bFlag)
VoiceID += VOICE_ID_ENG_BASE;
}
if (gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING) // 1of11
if (FUNCTION_IsRx()) // 1of11
BK4819_SetAF(BK4819_AF_MUTE);
#ifdef ENABLE_FMRADIO
@ -281,9 +279,7 @@ void AUDIO_PlaySingleVoice(bool bFlag)
{
SYSTEM_DelayMs(Delay * 10);
if (gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING) // 1of11
if (FUNCTION_IsRx()) // 1of11
RADIO_SetModulation(gRxVfo->Modulation);
#ifdef ENABLE_FMRADIO
@ -422,9 +418,7 @@ void AUDIO_PlayQueuedVoice(void)
}
}
if (gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING)
if (FUNCTION_IsRx())
{
RADIO_SetModulation(gRxVfo->Modulation); // 1of11
}

View File

@ -42,6 +42,14 @@
FUNCTION_Type_t gCurrentFunction;
inline bool FUNCTION_IsRx()
{
return gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING ||
gCurrentFunction == FUNCTION_RECEIVE;
}
void FUNCTION_Init(void)
{
#ifdef ENABLE_NOAA

View File

@ -36,6 +36,6 @@ extern FUNCTION_Type_t gCurrentFunction;
void FUNCTION_Init(void);
void FUNCTION_Select(FUNCTION_Type_t Function);
bool FUNCTION_IsRx();
#endif

View File

@ -247,11 +247,8 @@ void DisplayRSSIBar(const bool now)
ST7565_BlitFullScreen();
#endif
}
#ifdef ENABLE_AGC_SHOW_DATA
static void PrintAGC(bool now)
{
@ -444,11 +441,7 @@ void UI_DisplayMain(void)
else
{ // receiving .. show the RX symbol
mode = VFO_MODE_RX;
if ((gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING) &&
gEeprom.RX_VFO == vfo_num)
{
if (FUNCTION_IsRx() && gEeprom.RX_VFO == vfo_num) {
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold("RX", 14, 0, line);
#else
@ -738,9 +731,7 @@ void UI_DisplayMain(void)
if (center_line == CENTER_LINE_NONE)
{ // we're free to use the middle line
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING);
const bool rx = FUNCTION_IsRx();
#ifdef ENABLE_AUDIO_BAR
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT) {

View File

@ -53,9 +53,7 @@ void UI_DisplayStatus()
x1 = x + sizeof(BITMAP_TX);
}
else
if (gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING)
if (FUNCTION_IsRx())
{
memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX));
x1 = x + sizeof(BITMAP_RX);