mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 14:48:03 +03:00
Bug fixes if FM radio enabled
This commit is contained in:
@ -94,7 +94,7 @@ static void ACTION_Monitor(void)
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gIsNoaaMode)
|
||||
{
|
||||
gNOAA_Countdown_10ms = 500; // 5 sec
|
||||
gNOAA_Countdown_10ms = NOAA_countdown_10ms;
|
||||
gScheduleNOAA = false;
|
||||
}
|
||||
#endif
|
||||
@ -155,6 +155,7 @@ void ACTION_Scan(bool bRestart)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
28
app/app.c
28
app/app.c
@ -102,7 +102,7 @@ static void APP_CheckForIncoming(void)
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gIsNoaaMode)
|
||||
{
|
||||
gNOAA_Countdown_10ms = 20; // 200ms
|
||||
gNOAA_Countdown_10ms = NOAA_countdown_3_10ms;
|
||||
gScheduleNOAA = false;
|
||||
}
|
||||
#endif
|
||||
@ -965,7 +965,8 @@ void APP_Update(void)
|
||||
APP_HandleFunction();
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioCountdown_500ms > 0)
|
||||
// if (gFmRadioCountdown_500ms > 0)
|
||||
if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11
|
||||
return;
|
||||
#endif
|
||||
|
||||
@ -1058,7 +1059,7 @@ void APP_Update(void)
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
{ // switch to FM radio mode
|
||||
FM_Play();
|
||||
gScheduleFM = false;
|
||||
}
|
||||
@ -1091,7 +1092,7 @@ void APP_Update(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
#else
|
||||
if (
|
||||
@ -1106,7 +1107,7 @@ void APP_Update(void)
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1362,9 +1363,8 @@ void APP_TimeSlice10ms(void)
|
||||
else
|
||||
{ // transmitting
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
if (gSetting_mic_bar && (gFlashLightBlinkCounter % (100 / 10)) == 0) // once every 100ms
|
||||
if (gSetting_mic_bar && (gFlashLightBlinkCounter % (150 / 10)) == 0) // once every 150ms
|
||||
UI_DisplayAudioBar();
|
||||
//gUpdateDisplay = true;
|
||||
#endif
|
||||
|
||||
if (gUpdateDisplay)
|
||||
@ -1380,7 +1380,8 @@ void APP_TimeSlice10ms(void)
|
||||
// Skipping authentic device checks
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioCountdown_500ms > 0)
|
||||
// if (gFmRadioCountdown_500ms > 0)
|
||||
if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11
|
||||
return;
|
||||
#endif
|
||||
|
||||
@ -1454,10 +1455,10 @@ void APP_TimeSlice10ms(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode && gFM_RestoreCountdown > 0)
|
||||
if (gFmRadioMode && gFM_RestoreCountdown_10ms > 0)
|
||||
{
|
||||
if (--gFM_RestoreCountdown == 0)
|
||||
{
|
||||
if (--gFM_RestoreCountdown_10ms == 0)
|
||||
{ // switch back to FM radio mode
|
||||
FM_Start();
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
@ -1630,7 +1631,8 @@ void APP_TimeSlice500ms(void)
|
||||
if (gFmRadioCountdown_500ms > 0)
|
||||
{
|
||||
gFmRadioCountdown_500ms--;
|
||||
return;
|
||||
if (gFmRadioMode) // 1of11
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1743,7 +1745,7 @@ void APP_TimeSlice500ms(void)
|
||||
{
|
||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_MONITOR && gFmRadioMode)
|
||||
{
|
||||
{ // switch back to FM radio mode
|
||||
FM_Start();
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
|
14
app/fm.c
14
app/fm.c
@ -46,7 +46,7 @@ uint8_t gFM_ChannelPosition;
|
||||
bool gFM_FoundFrequency;
|
||||
bool gFM_AutoScan;
|
||||
uint8_t gFM_ResumeCountdown_500ms;
|
||||
uint16_t gFM_RestoreCountdown;
|
||||
uint16_t gFM_RestoreCountdown_10ms;
|
||||
|
||||
bool FM_CheckValidChannel(uint8_t Channel)
|
||||
{
|
||||
@ -93,9 +93,9 @@ int FM_ConfigureChannelState(void)
|
||||
|
||||
void FM_TurnOff(void)
|
||||
{
|
||||
gFmRadioMode = false;
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
gFM_RestoreCountdown = 0;
|
||||
gFmRadioMode = false;
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
gFM_RestoreCountdown_10ms = 0;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
@ -655,9 +655,9 @@ void FM_Play(void)
|
||||
|
||||
void FM_Start(void)
|
||||
{
|
||||
gFmRadioMode = true;
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
gFM_RestoreCountdown = 0;
|
||||
gFmRadioMode = true;
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
gFM_RestoreCountdown_10ms = 0;
|
||||
|
||||
BK1080_Init(gEeprom.FM_FrequencyPlaying, true);
|
||||
|
||||
|
2
app/fm.h
2
app/fm.h
@ -40,7 +40,7 @@ extern uint16_t gFM_FrequencyDeviation;
|
||||
extern bool gFM_FoundFrequency;
|
||||
extern bool gFM_AutoScan;
|
||||
extern uint8_t gFM_ResumeCountdown_500ms;
|
||||
extern uint16_t gFM_RestoreCountdown;
|
||||
extern uint16_t gFM_RestoreCountdown_10ms;
|
||||
|
||||
bool FM_CheckValidChannel(uint8_t Channel);
|
||||
uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction);
|
||||
|
@ -50,6 +50,12 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
case KEY_0:
|
||||
#ifdef ENABLE_FMRADIO
|
||||
ACTION_FM();
|
||||
#else
|
||||
|
||||
|
||||
// TODO: do something useful with the key
|
||||
|
||||
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user