Another rename and deleted some redundant code.

This commit is contained in:
Dual Tachyon 2023-09-05 22:02:11 +01:00
parent 768e4362bb
commit bdf68a5036
6 changed files with 18 additions and 31 deletions

View File

@ -882,9 +882,9 @@ void APP_TimeSlice10ms(void)
}
}
}
if (gFmRadioMode && g_2000038E) {
g_2000038E--;
if (g_2000038E == 0) {
if (gFmRadioMode && gFM_RestoreCountdown) {
gFM_RestoreCountdown--;
if (gFM_RestoreCountdown == 0) {
FM_Start();
GUI_SelectNextDisplay(DISPLAY_FM);
}

View File

@ -39,6 +39,7 @@ uint8_t gFM_ChannelPosition;
bool gFM_FoundFrequency;
bool gFM_AutoScan;
uint8_t gFM_ResumeCountdown;
uint16_t gFM_RestoreCountdown;
bool FM_CheckValidChannel(uint8_t Channel)
{
@ -86,7 +87,7 @@ void FM_TurnOff(void)
{
gFmRadioMode = false;
gFM_ScanState = FM_SCAN_OFF;
g_2000038E = 0;
gFM_RestoreCountdown = 0;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = false;
BK1080_Init(0, false);
@ -530,7 +531,7 @@ void FM_Start(void)
{
gFmRadioMode = true;
gFM_ScanState = FM_SCAN_OFF;
g_2000038E = 0;
gFM_RestoreCountdown = 0;
BK1080_Init(gEeprom.FM_FrequencyPlaying, true);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = true;

View File

@ -38,6 +38,7 @@ extern uint16_t gFM_FrequencyDeviation;
extern bool gFM_FoundFrequency;
extern bool gFM_AutoScan;
extern uint8_t gFM_ResumeCountdown;
extern uint16_t gFM_RestoreCountdown;
bool FM_CheckValidChannel(uint8_t Channel);
uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction);

View File

@ -69,6 +69,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
{
FUNCTION_Type_t PreviousFunction;
bool bWasPowerSave;
uint16_t Countdown = 0;
PreviousFunction = gCurrentFunction;
bWasPowerSave = (PreviousFunction == FUNCTION_POWER_SAVE);
@ -92,22 +93,17 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
gVFO_RSSI_Level[1] = 0;
} else if (PreviousFunction == FUNCTION_RECEIVE) {
if (gFmRadioMode) {
g_2000038E = 500;
Countdown = 500;
}
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED) {
gDTMF_AUTO_RESET_TIME = 1 + (gEeprom.DTMF_AUTO_RESET_TIME * 2);
}
}
gBatterySaveCountdown = 1000;
gSchedulePowerSave = false;
break;
return;
case FUNCTION_MONITOR:
case FUNCTION_INCOMING:
case FUNCTION_RECEIVE:
gBatterySaveCountdown = 1000;
gSchedulePowerSave = false;
g_2000038E = 0;
break;
case FUNCTION_POWER_SAVE:
@ -119,7 +115,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
gBatterySaveCountdownExpired = false;
gUpdateStatus = true;
GUI_SelectNextDisplay(DISPLAY_MAIN);
break;
return;
case FUNCTION_TRANSMIT:
if (gFmRadioMode) {
@ -137,9 +133,6 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
gEnableSpeaker = true;
SYSTEM_DelayMs(60);
BK4819_ExitTxMute();
gBatterySaveCountdown = 1000;
gSchedulePowerSave = false;
g_2000038E = 0;
gAlarmToneCounter = 0;
break;
}
@ -159,24 +152,18 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
SYSTEM_DelayMs(2);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gAlarmToneCounter = 0;
g_2000038E = 0;
gEnableSpeaker = true;
gSchedulePowerSave = false;
gBatterySaveCountdown = 1000;
return;
break;
}
if (gCurrentVfo->SCRAMBLING_TYPE && gSetting_ScrambleEnable) {
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1U);
gBatterySaveCountdown = 1000;
gSchedulePowerSave = false;
g_2000038E = 0;
return;
} else {
BK4819_DisableScramble();
}
BK4819_DisableScramble();
gBatterySaveCountdown = 1000;
gSchedulePowerSave = false;
g_2000038E = 0;
break;
}
gBatterySaveCountdown = 1000;
gSchedulePowerSave = false;
gFM_RestoreCountdown = Countdown;
}

1
misc.c
View File

@ -72,7 +72,6 @@ uint8_t gBatteryVoltageIndex;
CssScanMode_t gCssScanMode;
bool gUpdateRSSI;
AlarmState_t gAlarmState;
uint16_t g_2000038E;
uint8_t g_20000393;
bool gPttWasReleased;
bool gPttWasPressed;

1
misc.h
View File

@ -123,7 +123,6 @@ extern uint8_t gBatteryVoltageIndex;
extern CssScanMode_t gCssScanMode;
extern bool gUpdateRSSI;
extern AlarmState_t gAlarmState;
extern uint16_t g_2000038E;
extern uint8_t g_20000393;
extern bool gPttWasReleased;
extern bool gPttWasPressed;