Skip to content

Commit

Permalink
FIX #194: Spectrum going crazy when AM-fix is active
Browse files Browse the repository at this point in the history
  • Loading branch information
egzumer committed Dec 7, 2023
1 parent 754d2ce commit dc6d312
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,12 @@ uint16_t GetRssi() {
while ((BK4819_ReadRegister(0x63) & 0b11111111) >= 255) {
SYSTICK_DelayUs(100);
}

return BK4819_GetRSSI();
uint16_t rssi = 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) {
Expand Down Expand Up @@ -1121,8 +1125,11 @@ static void UpdateListening() {

static void Tick() {
#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
}
}
#endif

Expand Down

0 comments on commit dc6d312

Please sign in to comment.