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 #ifdef ENABLE_FMRADIO
if (gFmRadioMode) if (gFmRadioMode)
{ {
if (gCurrentFunction != FUNCTION_RECEIVE && if (FUNCTION_IsRx())
gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_TRANSMIT)
{ {
GUI_SelectNextDisplay(DISPLAY_FM); GUI_SelectNextDisplay(DISPLAY_FM);

View File

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

12
audio.c
View File

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

View File

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

View File

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

View File

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

View File

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