mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 17:19:57 +00:00
Use function to check if in RX mode
This commit is contained in:
parent
c3906f42f8
commit
2164461449
@ -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);
|
||||
|
||||
|
21
app/app.c
21
app/app.c
@ -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
12
audio.c
@ -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
|
||||
}
|
||||
|
12
functions.c
12
functions.c
@ -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
|
||||
@ -119,7 +127,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
if (gFmRadioMode)
|
||||
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT ||
|
||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
||||
@ -147,7 +155,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
BK4819_DisableVox();
|
||||
BK4819_DisableVox();
|
||||
BK4819_Sleep();
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, false);
|
||||
|
@ -36,6 +36,6 @@ extern FUNCTION_Type_t gCurrentFunction;
|
||||
|
||||
void FUNCTION_Init(void);
|
||||
void FUNCTION_Select(FUNCTION_Type_t Function);
|
||||
bool FUNCTION_IsRx();
|
||||
|
||||
#endif
|
||||
|
||||
|
13
ui/main.c
13
ui/main.c
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user