1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 16:01: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_audioActive = delayedSample.real() != 0.0;
m_magsqCur = std::norm(sideband[i]*agcVal); 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 // 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.reset(m_agcTarget*100.0); // Quench AGC at -20dB the target
m_agc.resetStepCounters();
m_squelchDelayLine.write(sideband[i]); m_squelchDelayLine.write(sideband[i]);
} }
else else
@ -198,7 +199,8 @@ void SSBDemodSink::processOneSample(Complex &ci)
} }
else 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) if (m_audioBinaual)
{ {
@ -503,4 +505,3 @@ void SSBDemodSink::applySettings(const SSBDemodSettings& settings, bool force)
m_agcActive = settings.m_agc; m_agcActive = settings.m_agc;
m_settings = settings; m_settings = settings;
} }

View File

@ -64,6 +64,7 @@ public:
int getStepDownDelay() const { return m_stepDownDelay; } int getStepDownDelay() const { return m_stepDownDelay; }
float getStepValue() const; float getStepValue() const;
void setHardLimiting(bool hardLimiting) { m_hardLimiting = hardLimiting; } void setHardLimiting(bool hardLimiting) { m_hardLimiting = hardLimiting; }
void resetStepCounters() { m_stepUpCounter = 0; m_stepDownCounter = 0; }
private: private:
bool m_squared; //!< use squared magnitude (power) to compute AGC value 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; break;
case Projector::ProjectionMagLin: case Projector::ProjectionMagLin:
case Projector::ProjectionMagSq: case Projector::ProjectionMagSq:
case Projector::ProjectionDMagSq:
if (amp_range < 1e-9) { if (amp_range < 1e-9) {
scale.setRange(Unit::None, amp_ofs * 1e12, amp_range * 1e12 + amp_ofs * 1e12); scale.setRange(Unit::None, amp_ofs * 1e12, amp_range * 1e12 + amp_ofs * 1e12);
} else if (amp_range < 1e-6) { } else if (amp_range < 1e-6) {
@ -1920,6 +1919,7 @@ void GLScope::setYScale(ScaleEngine &scale, uint32_t highlightedTraceIndex)
// break; // break;
case Projector::ProjectionReal: // Linear generic case Projector::ProjectionReal: // Linear generic
case Projector::ProjectionImag: case Projector::ProjectionImag:
case Projector::ProjectionDMagSq:
default: default:
if (amp_range < 1e-9) { if (amp_range < 1e-9) {
scale.setRange(Unit::None, -amp_range * 5e11 + amp_ofs * 1e12, amp_range * 5e11 + amp_ofs * 1e12); scale.setRange(Unit::None, -amp_range * 5e11 + amp_ofs * 1e12, amp_range * 5e11 + amp_ofs * 1e12);