AM fix modification
This commit is contained in:
41
radio.c
41
radio.c
@@ -772,12 +772,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if(gSetting_AM_fix) {
|
||||
BK4819_SetAGC(true);
|
||||
BK4819_InitAGC(false);
|
||||
}
|
||||
#endif
|
||||
RADIO_SetupAGC(false, false);
|
||||
|
||||
// enable/disable BK4819 selected interrupts
|
||||
BK4819_WriteRegister(BK4819_REG_3F, InterruptMask);
|
||||
@@ -926,12 +921,36 @@ void RADIO_SetModulation(ModulationMode_t 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
|
||||
if(modulation == MODULATION_AM && gSetting_AM_fix) {
|
||||
BK4819_SetAGC(0);
|
||||
|
||||
RADIO_SetupAGC(modulation == MODULATION_AM, false);
|
||||
}
|
||||
|
||||
void RADIO_SetupAGC(bool listeningAM, bool disable)
|
||||
{
|
||||
static uint8_t lastSettings;
|
||||
uint8_t newSettings = (listeningAM << 1) | (disable << 1);
|
||||
if(lastSettings == newSettings)
|
||||
return;
|
||||
lastSettings = newSettings;
|
||||
|
||||
|
||||
if(!listeningAM) { // if not actively listening AM we don't need any AM specific regulation
|
||||
BK4819_SetAGC(1);
|
||||
BK4819_InitAGC(false);
|
||||
}
|
||||
else {
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if(gSetting_AM_fix) { // if AM fix active lock AGC so AM-fix can do it's job
|
||||
BK4819_SetAGC(0);
|
||||
AM_fix_enable(!disable);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
BK4819_InitAGC(modulation == MODULATION_AM);
|
||||
{
|
||||
BK4819_SetAGC(!disable);
|
||||
BK4819_InitAGC(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RADIO_SetVfoState(VfoState_t State)
|
||||
@@ -1149,4 +1168,4 @@ void RADIO_SendEndOfTransmission(void)
|
||||
}
|
||||
|
||||
BK4819_ExitDTMF_TX(true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user