FM is now complete, but there's a bug left.

This commit is contained in:
Dual Tachyon 2023-08-31 00:07:23 +01:00
parent a4329f0543
commit a2eef61098
3 changed files with 49 additions and 1 deletions

View File

@ -1754,7 +1754,7 @@ static void APP_ProcessKey_FM(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
FM_Key_DIGITS(Key, bKeyPressed, bKeyHeld);
break;
case KEY_MENU:
//FM_Key_MENU(bKeyPressed, bKeyHeld);
FM_Key_MENU(bKeyPressed, bKeyHeld);
return;
case KEY_UP:
FM_Key_UP_DOWN(bKeyPressed, bKeyHeld, 1);

View File

@ -344,6 +344,53 @@ void FM_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
gRequestDisplayScreen = DISPLAY_FM;
}
void FM_Key_MENU(bool bKeyPressed, bool bKeyHeld)
{
if (bKeyHeld) {
return;
}
if (!bKeyPressed) {
return;
}
gRequestDisplayScreen = DISPLAY_FM;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (gFM_Step == 0) {
if (!gEeprom.FM_IsChannelSelected) {
if (gAskToSave) {
gFM_Channels[gFM_ChannelPosition] = gEeprom.FM_FrequencyToPlay;
gAskToSave = false;
gRequestSaveFM = true;
} else {
gAskToSave = true;
}
} else {
if (gAskToDelete) {
gFM_Channels[gEeprom.FM_CurrentChannel] = 0xFFFF;
FM_ConfigureChannelState();
BK1080_SetFrequency(gEeprom.FM_FrequencyToPlay);
gRequestSaveFM = true;
gAskToDelete = false;
} else {
gAskToDelete = true;
}
}
} else {
if (gFM_AutoScan || g_20000427 != 1) {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
gInputBoxIndex = 0;
return;
} else if (gAskToSave) {
gFM_Channels[gFM_ChannelPosition] = gEeprom.FM_FrequencyToPlay;
gAskToSave = false;
gRequestSaveFM = true;
} else {
gAskToSave = true;
}
}
}
void FM_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Step)
{
if (bKeyHeld || !bKeyPressed) {

View File

@ -37,6 +37,7 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit);
void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
void FM_Key_EXIT(bool bKeyPressed, bool bKeyHeld);
void FM_Key_MENU(bool bKeyPressed, bool bKeyHeld);
void FM_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Step);
#endif