mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-22 02:08:48 +00:00
last frequency stored and loaded in eeprom
This commit is contained in:
parent
32ab50b7d1
commit
867709af65
1
app/fm.c
1
app/fm.c
@ -189,6 +189,7 @@ static void Key_UP_DOWN(uint8_t state, bool direction)
|
||||
BK1080_TuneNext(direction);
|
||||
gEeprom.FM_FrequencyPlaying = BK1080_GetFrequency();
|
||||
// save
|
||||
gRequestSaveSettings = true;
|
||||
}
|
||||
|
||||
void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
23
board.c
23
board.c
@ -562,27 +562,8 @@ void BOARD_EEPROM_Init(void)
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
{ // 0E88..0E8F
|
||||
struct
|
||||
{
|
||||
uint16_t SelectedFrequency;
|
||||
uint8_t SelectedChannel;
|
||||
uint8_t IsMrMode;
|
||||
uint8_t Padding[8];
|
||||
} __attribute__((packed)) FM;
|
||||
|
||||
EEPROM_ReadBuffer(0x0E88, &FM, 8);
|
||||
gEeprom.FM_LowerLimit = 760;
|
||||
gEeprom.FM_UpperLimit = 1080;
|
||||
if (FM.SelectedFrequency < gEeprom.FM_LowerLimit || FM.SelectedFrequency > gEeprom.FM_UpperLimit)
|
||||
gEeprom.FM_SelectedFrequency = 960;
|
||||
else
|
||||
gEeprom.FM_SelectedFrequency = FM.SelectedFrequency;
|
||||
|
||||
gEeprom.FM_SelectedChannel = FM.SelectedChannel;
|
||||
gEeprom.FM_IsMrMode = (FM.IsMrMode < 2) ? FM.IsMrMode : false;
|
||||
}
|
||||
|
||||
EEPROM_ReadBuffer(0x0E88, Data, 8);
|
||||
memmove(&gEeprom.FM_FrequencyPlaying, Data, 2);
|
||||
#endif
|
||||
|
||||
// 0E90..0E97
|
||||
|
@ -167,6 +167,13 @@ void SETTINGS_SaveSettings(void)
|
||||
State[7] = (State[7] & ~(3u << 6)) | ((gSetting_backlight_on_tx_rx & 3u) << 6);
|
||||
|
||||
EEPROM_WriteBuffer(0x0F40, State, true);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
//0x0E88..0x0E8F
|
||||
memset(State, 0xFF, sizeof(State));
|
||||
memcpy(&State[0], &gEeprom.FM_FrequencyPlaying, 2);
|
||||
EEPROM_WriteBuffer(0x0E88, State, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
|
||||
|
Loading…
Reference in New Issue
Block a user