FIX #129: Bug in radio initialization after reset.

This commit is contained in:
Krzysiek Egzmont 2023-11-22 20:41:38 +01:00
parent fb30ec8c86
commit 0ce7d7bdc3
2 changed files with 18 additions and 4 deletions

View File

@ -727,6 +727,13 @@ void BOARD_EEPROM_Init(void)
// 0D60..0E27
EEPROM_ReadBuffer(0x0D60, gMR_ChannelAttributes, sizeof(gMR_ChannelAttributes));
for(uint16_t i = 0; i < sizeof(gMR_ChannelAttributes); i++) {
ChannelAttributes_t *att = &gMR_ChannelAttributes[i];
if(att->__val == 0xff){
att->__val = 0;
att->band = 0xf;
}
}
// 0F30..0F3F
EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey));

13
radio.c
View File

@ -141,6 +141,8 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
pInfo->Modulation = MODULATION_AM;
else
pInfo->Modulation = MODULATION_FM;
RADIO_ConfigureSquelchAndOutputPower(pInfo);
}
@ -243,7 +245,10 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (tmp > TX_OFFSET_FREQUENCY_DIRECTION_SUB)
tmp = 0;
pVfo->TX_OFFSET_FREQUENCY_DIRECTION = tmp;
pVfo->Modulation = (data[3] >> 4);
tmp = data[3] >> 4;
if (tmp >= MODULATION_UKNOWN)
tmp = MODULATION_FM;
pVfo->Modulation = tmp;
tmp = data[6];
if (tmp >= ARRAY_SIZE(gStepFrequencyTable))
@ -337,8 +342,10 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
uint32_t Offset;
} __attribute__((packed)) info;
EEPROM_ReadBuffer(base, &info, sizeof(info));
pVfo->freq_config_RX.Frequency = info.Frequency;
if(info.Frequency==0xFFFFFFFF)
pVfo->freq_config_RX.Frequency = frequencyBandTable[band].lower;
else
pVfo->freq_config_RX.Frequency = info.Frequency;
if (info.Offset >= 100000000)
info.Offset = 1000000;