Skip to content

Commit

Permalink
SSB demod: tie AGC steep transition correction to AGC clamping
Browse files Browse the repository at this point in the history
  • Loading branch information
f4exb committed Dec 3, 2023
1 parent e3d862c commit 9776e77
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions plugins/channelrx/demodssb/ssbdemodsink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,12 @@ void SSBDemodSink::processOneSample(Complex &ci)

// Prevent overload based on squared magnitude variation
// Only if AGC is active
if (m_agcActive && (std::abs(m_magsqCur - m_magsqPrev) > m_agcTarget*m_agcTarget*5.0))
if (m_agcActive && m_agcClamping && (std::abs(m_magsqCur - m_magsqPrev) > m_agcTarget*m_agcTarget*5.0) & (agcVal > 100.0))
{
m_agc.reset(m_agcTarget*100.0); // Quench AGC at -20dB the target
m_agc.resetStepCounters();
m_squelchDelayLine.write(sideband[i]);
float target = m_agcTarget*sqrt(agcVal); // Quench AGC depending on previous value
m_agc.reset(target);
m_squelchDelayLine.write(fftfilt::cmplx{target, 0.0});
m_magsqCur = target*target;
}
else
{
Expand Down

0 comments on commit 9776e77

Please sign in to comment.