1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 07:51:14 -05:00

Merge branch 'f4exb:master' into freq_scanner

This commit is contained in:
srcejon 2023-12-01 18:15:26 +00:00 committed by GitHub
commit f319dc32e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -177,11 +177,12 @@ void SSBDemodSink::processOneSample(Complex &ci)
m_audioActive = delayedSample.real() != 0.0;
m_magsqCur = std::norm(sideband[i]*agcVal);
// Prevent overload if squared magnitude variation is 90% full scale (0.9*.0.9 = 0.81)
// Prevent overload based on squared magnitude variation
// Only if AGC is active
if (m_agcActive && (m_magsqCur - m_magsqPrev > m_agcTarget*m_agcTarget*8.1))
if (m_agcActive && (std::abs(m_magsqCur - m_magsqPrev) > m_agcTarget*m_agcTarget*5.0))
{
m_agc.reset(m_agcTarget*100.0); // Quench AGC at -20dB the target
m_agc.resetStepCounters();
m_squelchDelayLine.write(sideband[i]);
}
else
@ -198,7 +199,8 @@ void SSBDemodSink::processOneSample(Complex &ci)
}
else
{
fftfilt::cmplx z = m_agcActive ? delayedSample * m_agc.getStepValue() : delayedSample;
// fftfilt::cmplx z = m_agcActive ? delayedSample * m_agc.getStepValue() : delayedSample;
fftfilt::cmplx& z = delayedSample;
if (m_audioBinaual)
{
@ -503,4 +505,3 @@ void SSBDemodSink::applySettings(const SSBDemodSettings& settings, bool force)
m_agcActive = settings.m_agc;
m_settings = settings;
}

View File

@ -64,6 +64,7 @@ public:
int getStepDownDelay() const { return m_stepDownDelay; }
float getStepValue() const;
void setHardLimiting(bool hardLimiting) { m_hardLimiting = hardLimiting; }
void resetStepCounters() { m_stepUpCounter = 0; m_stepDownCounter = 0; }
private:
bool m_squared; //!< use squared magnitude (power) to compute AGC value

View File

@ -1893,7 +1893,6 @@ void GLScope::setYScale(ScaleEngine &scale, uint32_t highlightedTraceIndex)
break;
case Projector::ProjectionMagLin:
case Projector::ProjectionMagSq:
case Projector::ProjectionDMagSq:
if (amp_range < 1e-9) {
scale.setRange(Unit::None, amp_ofs * 1e12, amp_range * 1e12 + amp_ofs * 1e12);
} else if (amp_range < 1e-6) {
@ -1920,6 +1919,7 @@ void GLScope::setYScale(ScaleEngine &scale, uint32_t highlightedTraceIndex)
// break;
case Projector::ProjectionReal: // Linear generic
case Projector::ProjectionImag:
case Projector::ProjectionDMagSq:
default:
if (amp_range < 1e-9) {
scale.setRange(Unit::None, -amp_range * 5e11 + amp_ofs * 1e12, amp_range * 5e11 + amp_ofs * 1e12);