mirror of
https://github.com/DualTachyon/uv-k5-firmware.git
synced 2024-11-27 08:59:52 +08:00
Renamed a bunch of FM variables.
This commit is contained in:
parent
a2eef61098
commit
aa8a8354ff
22
app/app.c
22
app/app.c
@ -583,20 +583,20 @@ void FUN_00007f4c(void)
|
||||
|
||||
void APP_PlayFM(void)
|
||||
{
|
||||
if (!FM_CheckFrequencyLock(gEeprom.FM_FrequencyToPlay, gEeprom.FM_LowerLimit)) {
|
||||
if (!FM_CheckFrequencyLock(gEeprom.FM_FrequencyPlaying, gEeprom.FM_LowerLimit)) {
|
||||
if (!gFM_AutoScan) {
|
||||
gFmPlayCountdown = 0;
|
||||
g_20000427 = 1;
|
||||
if (!gEeprom.FM_IsChannelSelected) {
|
||||
gEeprom.FM_CurrentFrequency = gEeprom.FM_FrequencyToPlay;
|
||||
if (!gEeprom.FM_IsMrMode) {
|
||||
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
||||
}
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
g_2000036B = 1;
|
||||
} else {
|
||||
if (gFM_ChannelPosition < 20) {
|
||||
gFM_Channels[gFM_ChannelPosition++] = gEeprom.FM_FrequencyToPlay;
|
||||
if (gEeprom.FM_UpperLimit > gEeprom.FM_FrequencyToPlay) {
|
||||
FM_Tune(gEeprom.FM_FrequencyToPlay, gFM_Step, false);
|
||||
gFM_Channels[gFM_ChannelPosition++] = gEeprom.FM_FrequencyPlaying;
|
||||
if (gEeprom.FM_UpperLimit > gEeprom.FM_FrequencyPlaying) {
|
||||
FM_Tune(gEeprom.FM_FrequencyPlaying, gFM_Step, false);
|
||||
} else {
|
||||
FM_Play();
|
||||
}
|
||||
@ -605,13 +605,13 @@ void APP_PlayFM(void)
|
||||
}
|
||||
}
|
||||
} else if (gFM_AutoScan) {
|
||||
if (gEeprom.FM_UpperLimit > gEeprom.FM_FrequencyToPlay) {
|
||||
FM_Tune(gEeprom.FM_FrequencyToPlay, gFM_Step, false);
|
||||
if (gEeprom.FM_UpperLimit > gEeprom.FM_FrequencyPlaying) {
|
||||
FM_Tune(gEeprom.FM_FrequencyPlaying, gFM_Step, false);
|
||||
} else {
|
||||
FM_Play();
|
||||
}
|
||||
} else {
|
||||
FM_Tune(gEeprom.FM_FrequencyToPlay, gFM_Step, false);
|
||||
FM_Tune(gEeprom.FM_FrequencyPlaying, gFM_Step, false);
|
||||
}
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
@ -622,7 +622,7 @@ void APP_StartFM(void)
|
||||
gFmRadioMode = true;
|
||||
gFM_Step = 0;
|
||||
g_2000038E = 0;
|
||||
BK1080_Init(gEeprom.FM_FrequencyToPlay, true);
|
||||
BK1080_Init(gEeprom.FM_FrequencyPlaying, true);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
g_2000036B = 1;
|
||||
gUpdateStatus = true;
|
||||
@ -1473,7 +1473,7 @@ void APP_StartScan(bool bFlag)
|
||||
} else {
|
||||
gFM_AutoScan = false;
|
||||
gFM_ChannelPosition = 0;
|
||||
Frequency = gEeprom.FM_FrequencyToPlay;
|
||||
Frequency = gEeprom.FM_FrequencyPlaying;
|
||||
}
|
||||
BK1080_GetFrequencyDeviation(Frequency);
|
||||
FM_Tune(Frequency, 1, bFlag);
|
||||
|
72
app/fm.c
72
app/fm.c
@ -64,15 +64,15 @@ int FM_ConfigureChannelState(void)
|
||||
{
|
||||
uint8_t Channel;
|
||||
|
||||
gEeprom.FM_FrequencyToPlay = gEeprom.FM_CurrentFrequency;
|
||||
if (gEeprom.FM_IsChannelSelected) {
|
||||
Channel = FM_FindNextChannel(gEeprom.FM_CurrentChannel, FM_CHANNEL_UP);
|
||||
gEeprom.FM_FrequencyPlaying = gEeprom.FM_SelectedFrequency;
|
||||
if (gEeprom.FM_IsMrMode) {
|
||||
Channel = FM_FindNextChannel(gEeprom.FM_SelectedChannel, FM_CHANNEL_UP);
|
||||
if (Channel == 0xFF) {
|
||||
gEeprom.FM_IsChannelSelected = false;
|
||||
gEeprom.FM_IsMrMode = false;
|
||||
return -1;
|
||||
}
|
||||
gEeprom.FM_CurrentChannel = Channel;
|
||||
gEeprom.FM_FrequencyToPlay = gFM_Channels[Channel];
|
||||
gEeprom.FM_SelectedChannel = Channel;
|
||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -115,7 +115,7 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag)
|
||||
g_20000427 = 0;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
gEeprom.FM_FrequencyToPlay = Frequency;
|
||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||
if (!bFlag) {
|
||||
Frequency += Step;
|
||||
if (Frequency < gEeprom.FM_LowerLimit) {
|
||||
@ -123,22 +123,22 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag)
|
||||
} else if (Frequency > gEeprom.FM_UpperLimit) {
|
||||
Frequency = gEeprom.FM_LowerLimit;
|
||||
}
|
||||
gEeprom.FM_FrequencyToPlay = Frequency;
|
||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||
}
|
||||
|
||||
gFM_Step = Step;
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyToPlay);
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
}
|
||||
|
||||
void FM_Play(void)
|
||||
{
|
||||
gFM_Step = 0;
|
||||
if (gFM_AutoScan) {
|
||||
gEeprom.FM_IsChannelSelected = true;
|
||||
gEeprom.FM_CurrentChannel = 0;
|
||||
gEeprom.FM_IsMrMode = true;
|
||||
gEeprom.FM_SelectedChannel = 0;
|
||||
}
|
||||
FM_ConfigureChannelState();
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyToPlay);
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
SETTINGS_SaveFM();
|
||||
gFmPlayCountdown = 0;
|
||||
gScheduleFM = false;
|
||||
@ -210,7 +210,7 @@ void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
if (gEeprom.FM_IsChannelSelected) {
|
||||
if (gEeprom.FM_IsMrMode) {
|
||||
Value = 1;
|
||||
} else {
|
||||
Value = 0;
|
||||
@ -236,10 +236,10 @@ void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
return;
|
||||
}
|
||||
gEeprom.FM_CurrentFrequency = (uint16_t)Frequency;
|
||||
gEeprom.FM_SelectedFrequency = (uint16_t)Frequency;
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
gEeprom.FM_FrequencyToPlay = gEeprom.FM_CurrentFrequency;
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyToPlay);
|
||||
gEeprom.FM_FrequencyPlaying = gEeprom.FM_SelectedFrequency;
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
gRequestSaveFM = true;
|
||||
return;
|
||||
}
|
||||
@ -251,9 +251,9 @@ void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (Value == 1) {
|
||||
if (FM_CheckValidChannel(Channel)) {
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
gEeprom.FM_CurrentChannel = Channel;
|
||||
gEeprom.FM_FrequencyToPlay = gFM_Channels[Channel];
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyToPlay);
|
||||
gEeprom.FM_SelectedChannel = Channel;
|
||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
gRequestSaveFM = true;
|
||||
return;
|
||||
}
|
||||
@ -280,9 +280,9 @@ void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
break;
|
||||
|
||||
case KEY_1:
|
||||
gEeprom.FM_IsChannelSelected = !gEeprom.FM_IsChannelSelected;
|
||||
gEeprom.FM_IsMrMode = !gEeprom.FM_IsMrMode;
|
||||
if (!FM_ConfigureChannelState()) {
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyToPlay);
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
gRequestSaveFM = true;
|
||||
return;
|
||||
}
|
||||
@ -357,9 +357,9 @@ void FM_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (gFM_Step == 0) {
|
||||
if (!gEeprom.FM_IsChannelSelected) {
|
||||
if (!gEeprom.FM_IsMrMode) {
|
||||
if (gAskToSave) {
|
||||
gFM_Channels[gFM_ChannelPosition] = gEeprom.FM_FrequencyToPlay;
|
||||
gFM_Channels[gFM_ChannelPosition] = gEeprom.FM_FrequencyPlaying;
|
||||
gAskToSave = false;
|
||||
gRequestSaveFM = true;
|
||||
} else {
|
||||
@ -367,9 +367,9 @@ void FM_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
} else {
|
||||
if (gAskToDelete) {
|
||||
gFM_Channels[gEeprom.FM_CurrentChannel] = 0xFFFF;
|
||||
gFM_Channels[gEeprom.FM_SelectedChannel] = 0xFFFF;
|
||||
FM_ConfigureChannelState();
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyToPlay);
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
gRequestSaveFM = true;
|
||||
gAskToDelete = false;
|
||||
} else {
|
||||
@ -382,7 +382,7 @@ void FM_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
} else if (gAskToSave) {
|
||||
gFM_Channels[gFM_ChannelPosition] = gEeprom.FM_FrequencyToPlay;
|
||||
gFM_Channels[gFM_ChannelPosition] = gEeprom.FM_FrequencyPlaying;
|
||||
gAskToSave = false;
|
||||
gRequestSaveFM = true;
|
||||
} else {
|
||||
@ -417,35 +417,35 @@ void FM_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Step)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
FM_Tune(gEeprom.FM_FrequencyToPlay, Step, false);
|
||||
FM_Tune(gEeprom.FM_FrequencyPlaying, Step, false);
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
return;
|
||||
}
|
||||
if (gEeprom.FM_IsChannelSelected) {
|
||||
if (gEeprom.FM_IsMrMode) {
|
||||
uint8_t Channel;
|
||||
|
||||
Channel = FM_FindNextChannel(gEeprom.FM_CurrentChannel + Step, Step);
|
||||
if (Channel == 0xFF || gEeprom.FM_CurrentChannel == Channel) {
|
||||
Channel = FM_FindNextChannel(gEeprom.FM_SelectedChannel + Step, Step);
|
||||
if (Channel == 0xFF || gEeprom.FM_SelectedChannel == Channel) {
|
||||
goto Bail;
|
||||
}
|
||||
gEeprom.FM_CurrentChannel = Channel;
|
||||
gEeprom.FM_FrequencyToPlay = gFM_Channels[Channel];
|
||||
gEeprom.FM_SelectedChannel = Channel;
|
||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||
} else {
|
||||
uint16_t Frequency;
|
||||
|
||||
Frequency = gEeprom.FM_CurrentFrequency + Step;
|
||||
Frequency = gEeprom.FM_SelectedFrequency + Step;
|
||||
if (Frequency < gEeprom.FM_LowerLimit) {
|
||||
Frequency = gEeprom.FM_UpperLimit;
|
||||
} else if (Frequency > gEeprom.FM_UpperLimit) {
|
||||
Frequency = gEeprom.FM_LowerLimit;
|
||||
}
|
||||
gEeprom.FM_FrequencyToPlay = Frequency;
|
||||
gEeprom.FM_CurrentFrequency = gEeprom.FM_FrequencyToPlay;
|
||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
||||
}
|
||||
gRequestSaveFM = true;
|
||||
|
||||
Bail:
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyToPlay);
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
}
|
||||
|
||||
|
20
board.c
20
board.c
@ -472,26 +472,26 @@ void BOARD_EEPROM_Init(void)
|
||||
|
||||
// 0E88..0E8F
|
||||
struct {
|
||||
uint16_t Frequency;
|
||||
uint8_t CurrentChannel;
|
||||
uint8_t IsChannelSelected;
|
||||
uint16_t SelectedFrequency;
|
||||
uint8_t SelectedChannel;
|
||||
uint8_t IsMrMode;
|
||||
uint8_t Padding[8];
|
||||
} FM;
|
||||
|
||||
EEPROM_ReadBuffer(0x0E88, &FM, 8);
|
||||
gEeprom.FM_LowerLimit = 760;
|
||||
gEeprom.FM_UpperLimit = 1080;
|
||||
if (FM.Frequency < gEeprom.FM_LowerLimit || FM.Frequency > gEeprom.FM_UpperLimit) {
|
||||
gEeprom.FM_CurrentFrequency = 760;
|
||||
if (FM.SelectedFrequency < gEeprom.FM_LowerLimit || FM.SelectedFrequency > gEeprom.FM_UpperLimit) {
|
||||
gEeprom.FM_SelectedFrequency = 760;
|
||||
} else {
|
||||
gEeprom.FM_CurrentFrequency = FM.Frequency;
|
||||
gEeprom.FM_SelectedFrequency = FM.SelectedFrequency;
|
||||
}
|
||||
|
||||
gEeprom.FM_CurrentChannel = FM.CurrentChannel;
|
||||
if (FM.IsChannelSelected < 2) {
|
||||
gEeprom.FM_IsChannelSelected = FM.IsChannelSelected;
|
||||
gEeprom.FM_SelectedChannel = FM.SelectedChannel;
|
||||
if (FM.IsMrMode < 2) {
|
||||
gEeprom.FM_IsMrMode = FM.IsMrMode;
|
||||
} else {
|
||||
gEeprom.FM_IsChannelSelected = false;
|
||||
gEeprom.FM_IsMrMode = false;
|
||||
}
|
||||
|
||||
// 0E40..0E67
|
||||
|
@ -36,9 +36,9 @@ void SETTINGS_SaveFM(void)
|
||||
UART_LogSend("sFm\r\n", 5);
|
||||
|
||||
memset(&State, 0xFF, sizeof(State));
|
||||
State.Channel = gEeprom.FM_CurrentChannel;
|
||||
State.Frequency = gEeprom.FM_CurrentFrequency;
|
||||
State.IsChannelSelected = gEeprom.FM_IsChannelSelected;
|
||||
State.Channel = gEeprom.FM_SelectedChannel;
|
||||
State.Frequency = gEeprom.FM_SelectedFrequency;
|
||||
State.IsChannelSelected = gEeprom.FM_IsMrMode;
|
||||
|
||||
EEPROM_WriteBuffer(0x0E88, &State);
|
||||
for (i = 0; i < 5; i++) {
|
||||
|
@ -132,10 +132,10 @@ typedef struct {
|
||||
uint8_t field30_0x27;
|
||||
uint16_t VOX1_THRESHOLD;
|
||||
uint16_t VOX0_THRESHOLD;
|
||||
uint16_t FM_CurrentFrequency;
|
||||
uint8_t FM_CurrentChannel;
|
||||
bool FM_IsChannelSelected;
|
||||
uint16_t FM_FrequencyToPlay;
|
||||
uint16_t FM_SelectedFrequency;
|
||||
uint8_t FM_SelectedChannel;
|
||||
bool FM_IsMrMode;
|
||||
uint16_t FM_FrequencyPlaying;
|
||||
uint8_t field37_0x32;
|
||||
uint8_t field38_0x33;
|
||||
uint16_t FM_LowerLimit;
|
||||
|
12
ui/fmradio.c
12
ui/fmradio.c
@ -44,9 +44,9 @@ void UI_DisplayFM(void)
|
||||
strcpy(String, "DEL?");
|
||||
} else {
|
||||
if (gFM_Step == 0) {
|
||||
if (!gEeprom.FM_IsChannelSelected) {
|
||||
if (!gEeprom.FM_IsMrMode) {
|
||||
for (i = 0; i < 20; i++) {
|
||||
if (gEeprom.FM_FrequencyToPlay == gFM_Channels[i]) {
|
||||
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) {
|
||||
sprintf(String, "VFO(CH%02d)", i + 1);
|
||||
break;
|
||||
}
|
||||
@ -55,7 +55,7 @@ void UI_DisplayFM(void)
|
||||
strcpy(String, "VFO");
|
||||
}
|
||||
} else {
|
||||
sprintf(String, "MR(CH%02d)", gEeprom.FM_CurrentChannel + 1);
|
||||
sprintf(String, "MR(CH%02d)", gEeprom.FM_SelectedChannel + 1);
|
||||
}
|
||||
} else {
|
||||
if (!gFM_AutoScan) {
|
||||
@ -69,11 +69,11 @@ void UI_DisplayFM(void)
|
||||
UI_PrintString(String, 0, 127, 2, 10, true);
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
if (gAskToSave || (gEeprom.FM_IsChannelSelected && gInputBoxIndex)) {
|
||||
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex)) {
|
||||
UI_GenerateChannelString(String, gFM_ChannelPosition);
|
||||
} else if (!gAskToDelete) {
|
||||
if (gInputBoxIndex == 0) {
|
||||
NUMBER_ToDigits(gEeprom.FM_FrequencyToPlay * 10000, String);
|
||||
NUMBER_ToDigits(gEeprom.FM_FrequencyPlaying * 10000, String);
|
||||
UI_DisplayFrequency(String, 23, 4, false, true);
|
||||
} else {
|
||||
UI_DisplayFrequency(gInputBox, 23, 4, true, false);
|
||||
@ -81,7 +81,7 @@ void UI_DisplayFM(void)
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
} else {
|
||||
sprintf(String, "CH-%02d", gEeprom.FM_CurrentChannel + 1);
|
||||
sprintf(String, "CH-%02d", gEeprom.FM_SelectedChannel + 1);
|
||||
}
|
||||
|
||||
UI_PrintString(String, 0, 127, 4, 10, true);
|
||||
|
Loading…
Reference in New Issue
Block a user