Refactoring

This commit is contained in:
Krzysiek Egzmont
2023-12-03 01:50:28 +01:00
parent 9ca3ccd744
commit e2b81bf9c8
4 changed files with 16 additions and 26 deletions

14
radio.c
View File

@@ -889,6 +889,7 @@ void RADIO_SetTxParameters(void)
void RADIO_SetModulation(ModulationMode_t modulation)
{
static ModulationMode_t m = MODULATION_UKNOWN;
BK4819_AF_Type_t mod;
switch(modulation) {
default:
@@ -913,9 +914,16 @@ void RADIO_SetModulation(ModulationMode_t modulation)
}
BK4819_SetAF(mod);
BK4819_SetRegValue(afDacGainRegSpec, 0xF);
BK4819_WriteRegister(BK4819_REG_3D, modulation == MODULATION_USB ? 0 : 0x2AAB);
BK4819_SetRegValue(afcDisableRegSpec, modulation != MODULATION_FM);
if(m != modulation) {
m = modulation;
BK4819_SetRegValue(afDacGainRegSpec, 0xF);
BK4819_WriteRegister(BK4819_REG_3D, modulation == MODULATION_USB ? 0 : 0x2AAB);
BK4819_SetRegValue(afcDisableRegSpec, modulation != MODULATION_FM);
#ifdef ENABLE_AM_FIX
BK4819_SetAGC(modulation != MODULATION_AM || !gSetting_AM_fix);
BK4819_InitAGC();
#endif
}
}
void RADIO_SetVfoState(VfoState_t State)