Improve AM-fix
This commit is contained in:
19
radio.c
19
radio.c
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "am_fix.h"
|
||||
#include "app/dtmf.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
@@ -770,6 +771,9 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
}
|
||||
#endif
|
||||
|
||||
BK4819_SetAGC(1);
|
||||
BK4819_InitAGC();
|
||||
|
||||
// enable/disable BK4819 selected interrupts
|
||||
BK4819_WriteRegister(BK4819_REG_3F, InterruptMask);
|
||||
|
||||
@@ -889,7 +893,6 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
void RADIO_SetModulation(ModulationMode_t modulation)
|
||||
{
|
||||
static ModulationMode_t m = MODULATION_UKNOWN;
|
||||
BK4819_AF_Type_t mod;
|
||||
switch(modulation) {
|
||||
default:
|
||||
@@ -914,16 +917,14 @@ void RADIO_SetModulation(ModulationMode_t modulation)
|
||||
}
|
||||
|
||||
BK4819_SetAF(mod);
|
||||
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);
|
||||
|
||||
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();
|
||||
if(modulation == MODULATION_AM && gSetting_AM_fix)
|
||||
BK4819_SetAGC(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void RADIO_SetVfoState(VfoState_t State)
|
||||
|
Reference in New Issue
Block a user