FIX #194: Spectrum going crazy when AM-fix is active
This commit is contained in:
@@ -113,7 +113,7 @@ static uint16_t GetRegMenuValue(uint8_t st) {
|
|||||||
|
|
||||||
void LockAGC()
|
void LockAGC()
|
||||||
{
|
{
|
||||||
RADIO_SetupAGC(true, lockAGC);
|
RADIO_SetupAGC(settings.modulationType==MODULATION_AM, lockAGC);
|
||||||
lockAGC = true;
|
lockAGC = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,8 +290,12 @@ uint16_t GetRssi() {
|
|||||||
while ((BK4819_ReadRegister(0x63) & 0b11111111) >= 255) {
|
while ((BK4819_ReadRegister(0x63) & 0b11111111) >= 255) {
|
||||||
SYSTICK_DelayUs(100);
|
SYSTICK_DelayUs(100);
|
||||||
}
|
}
|
||||||
|
uint16_t rssi = BK4819_GetRSSI();
|
||||||
return BK4819_GetRSSI();
|
#ifdef ENABLE_AM_FIX
|
||||||
|
if(settings.modulationType==MODULATION_AM && gSetting_AM_fix)
|
||||||
|
rssi += AM_fix_get_gain_diff()*2;
|
||||||
|
#endif
|
||||||
|
return rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ToggleAudio(bool on) {
|
static void ToggleAudio(bool on) {
|
||||||
@@ -309,6 +313,7 @@ static void ToggleAudio(bool on) {
|
|||||||
static void ToggleRX(bool on) {
|
static void ToggleRX(bool on) {
|
||||||
isListening = on;
|
isListening = on;
|
||||||
|
|
||||||
|
RADIO_SetupAGC(on, lockAGC);
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, on);
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, on);
|
||||||
|
|
||||||
ToggleAudio(on);
|
ToggleAudio(on);
|
||||||
@@ -1121,8 +1126,11 @@ static void UpdateListening() {
|
|||||||
|
|
||||||
static void Tick() {
|
static void Tick() {
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
if(settings.modulationType == MODULATION_AM) {
|
if (gNextTimeslice) {
|
||||||
|
gNextTimeslice = false;
|
||||||
|
if(settings.modulationType == MODULATION_AM) {
|
||||||
AM_fix_10ms(vfo, !lockAGC); //allow AM_Fix to apply its AGC action
|
AM_fix_10ms(vfo, !lockAGC); //allow AM_Fix to apply its AGC action
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
2
radio.c
2
radio.c
@@ -936,7 +936,7 @@ void RADIO_SetupAGC(bool listeningAM, bool disable)
|
|||||||
|
|
||||||
|
|
||||||
if(!listeningAM) { // if not actively listening AM we don't need any AM specific regulation
|
if(!listeningAM) { // if not actively listening AM we don't need any AM specific regulation
|
||||||
BK4819_SetAGC(1);
|
BK4819_SetAGC(!disable);
|
||||||
BK4819_InitAGC(false);
|
BK4819_InitAGC(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user