mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-08-03 09:36:32 +03:00
Maintain monitor state when up/down freq/chan
This commit is contained in:
48
app/action.c
48
app/action.c
@@ -66,27 +66,25 @@ void ACTION_Power(void)
|
||||
gRequestDisplayScreen = gScreenToDisplay;
|
||||
}
|
||||
|
||||
static void ACTION_Monitor(void)
|
||||
void ACTION_Monitor(void)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_MONITOR)
|
||||
{
|
||||
{ // enable the monitor
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gRxVfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST && gIsNoaaMode)
|
||||
gNoaaChannel = gRxVfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST;
|
||||
#endif
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
APP_StartListening(FUNCTION_MONITOR, false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
if (gScanState != SCAN_OFF)
|
||||
{
|
||||
ScanPauseDelayIn_10ms = 500; // 5 seconds
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gScanPauseMode = true;
|
||||
}
|
||||
@@ -98,7 +96,7 @@ static void ACTION_Monitor(void)
|
||||
gScheduleNOAA = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -117,14 +115,18 @@ void ACTION_Scan(bool bRestart)
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
if (gFM_ScanState != FM_SCAN_OFF)
|
||||
{
|
||||
FM_PlayAndUpdate();
|
||||
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
@@ -132,7 +134,7 @@ void ACTION_Scan(bool bRestart)
|
||||
else
|
||||
{
|
||||
uint16_t Frequency;
|
||||
|
||||
|
||||
if (bRestart)
|
||||
{
|
||||
gFM_AutoScan = true;
|
||||
@@ -146,16 +148,16 @@ void ACTION_Scan(bool bRestart)
|
||||
gFM_ChannelPosition = 0;
|
||||
Frequency = gEeprom.FM_FrequencyPlaying;
|
||||
}
|
||||
|
||||
|
||||
BK1080_GetFrequencyDeviation(Frequency);
|
||||
FM_Tune(Frequency, 1, bRestart);
|
||||
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_BEGIN;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -163,6 +165,8 @@ void ACTION_Scan(bool bRestart)
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{ // not scanning
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
@@ -201,6 +205,8 @@ void ACTION_Scan(bool bRestart)
|
||||
if (!bRestart)
|
||||
{ // scanning
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -241,19 +247,21 @@ void ACTION_Vox(void)
|
||||
if (gFmRadioMode)
|
||||
{
|
||||
FM_TurnOff();
|
||||
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
gVoxResumeCountdown = 80;
|
||||
gFlagReconfigureVfos = true;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
gMonitor = false;
|
||||
|
||||
RADIO_SelectVfos();
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
|
||||
FM_Start();
|
||||
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
}
|
||||
@@ -280,7 +288,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
//static void ACTION_FlashLight(void)
|
||||
void ACTION_Power(void);
|
||||
//static void ACTION_Monitor(void)
|
||||
void ACTION_Monitor(void);
|
||||
void ACTION_Scan(bool bFlag);
|
||||
void ACTION_Vox(void);
|
||||
#ifdef ENABLE_ALARM
|
||||
|
26
app/app.c
26
app/app.c
@@ -203,7 +203,7 @@ static void APP_HandleIncoming(void)
|
||||
}
|
||||
}
|
||||
|
||||
APP_StartListening(FUNCTION_RECEIVE, false);
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, false);
|
||||
}
|
||||
|
||||
static void APP_HandleReceive(void)
|
||||
@@ -979,14 +979,14 @@ void APP_Update(void)
|
||||
if (IS_FREQ_CHANNEL(gNextMrChannel))
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(FUNCTION_RECEIVE, true);
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
FREQ_NextChannel();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(FUNCTION_RECEIVE, true);
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
MR_NextChannel();
|
||||
}
|
||||
@@ -1726,8 +1726,13 @@ void APP_TimeSlice500ms(void)
|
||||
gAskToDelete = false;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode && gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
if (gFmRadioMode &&
|
||||
gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef ENABLE_NO_SCAN_TIMEOUT
|
||||
@@ -1747,7 +1752,11 @@ void APP_TimeSlice500ms(void)
|
||||
if (--gFM_ResumeCountdown_500ms == 0)
|
||||
{
|
||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_MONITOR && gFmRadioMode)
|
||||
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gFmRadioMode)
|
||||
{ // switch back to FM radio mode
|
||||
FM_Start();
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
@@ -1919,7 +1928,7 @@ void CHANNEL_Next(bool bFlag, int8_t Direction)
|
||||
FREQ_NextChannel();
|
||||
}
|
||||
|
||||
ScanPauseDelayIn_10ms = 50; // 500ms
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScanPauseMode = false;
|
||||
@@ -2340,6 +2349,9 @@ Skip:
|
||||
gVFO_RSSI_bar_level[1] = 0;
|
||||
|
||||
gFlagReconfigureVfos = false;
|
||||
|
||||
if (gMonitor)
|
||||
ACTION_Monitor(); // 1of11
|
||||
}
|
||||
|
||||
if (gFlagRefreshSetting)
|
||||
@@ -2350,6 +2362,8 @@ Skip:
|
||||
|
||||
if (gFlagStartScan)
|
||||
{
|
||||
gMonitor = false;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
AUDIO_PlaySingleVoice(true);
|
||||
|
@@ -57,7 +57,7 @@ void MENU_StartCssScan(int8_t Direction)
|
||||
|
||||
MENU_SelectNextCode();
|
||||
|
||||
ScanPauseDelayIn_10ms = 50;
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ void MENU_SelectNextCode(void)
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
ScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? 20 : 30;
|
||||
ScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user