1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-27 07:16:48 -04:00

FT8 demod: removed AGC squelch system and make connection with the Demod Analyzer

This commit is contained in:
f4exb 2023-01-15 12:57:58 +01:00
parent 14f9989adb
commit 809e0bccd4
15 changed files with 26 additions and 550 deletions

View File

@ -242,10 +242,6 @@ void FT8Demod::applySettings(const FT8DemodSettings& settings, bool force)
<< " m_fftWindow: " << settings.m_filterBank[settings.m_filterIndex].m_fftWindow << "]" << " m_fftWindow: " << settings.m_filterBank[settings.m_filterIndex].m_fftWindow << "]"
<< " m_volume: " << settings.m_volume << " m_volume: " << settings.m_volume
<< " m_agcActive: " << settings.m_agc << " m_agcActive: " << settings.m_agc
<< " m_agcClamping: " << settings.m_agcClamping
<< " m_agcTimeLog2: " << settings.m_agcTimeLog2
<< " agcPowerThreshold: " << settings.m_agcPowerThreshold
<< " agcThresholdGate: " << settings.m_agcThresholdGate
<< " m_ft8SampleRate: " << settings.m_ft8SampleRate << " m_ft8SampleRate: " << settings.m_ft8SampleRate
<< " m_streamIndex: " << settings.m_streamIndex << " m_streamIndex: " << settings.m_streamIndex
<< " m_useReverseAPI: " << settings.m_useReverseAPI << " m_useReverseAPI: " << settings.m_useReverseAPI
@ -278,18 +274,6 @@ void FT8Demod::applySettings(const FT8DemodSettings& settings, bool force)
if ((m_settings.m_volume != settings.m_volume) || force) { if ((m_settings.m_volume != settings.m_volume) || force) {
reverseAPIKeys.append("volume"); reverseAPIKeys.append("volume");
} }
if ((m_settings.m_agcTimeLog2 != settings.m_agcTimeLog2) || force) {
reverseAPIKeys.append("agcTimeLog2");
}
if ((m_settings.m_agcPowerThreshold != settings.m_agcPowerThreshold) || force) {
reverseAPIKeys.append("agcPowerThreshold");
}
if ((m_settings.m_agcThresholdGate != settings.m_agcThresholdGate) || force) {
reverseAPIKeys.append("agcThresholdGate");
}
if ((m_settings.m_agcClamping != settings.m_agcClamping) || force) {
reverseAPIKeys.append("agcClamping");
}
if ((settings.m_ft8SampleRate != m_settings.m_ft8SampleRate) || force) { if ((settings.m_ft8SampleRate != m_settings.m_ft8SampleRate) || force) {
reverseAPIKeys.append("ft8SampleRate"); reverseAPIKeys.append("ft8SampleRate");
} }
@ -464,18 +448,6 @@ void FT8Demod::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("agc")) { if (channelSettingsKeys.contains("agc")) {
settings.m_agc = response.getFt8DemodSettings()->getAgc() != 0; settings.m_agc = response.getFt8DemodSettings()->getAgc() != 0;
} }
if (channelSettingsKeys.contains("agcClamping")) {
settings.m_agcClamping = response.getFt8DemodSettings()->getAgcClamping() != 0;
}
if (channelSettingsKeys.contains("agcTimeLog2")) {
settings.m_agcTimeLog2 = response.getFt8DemodSettings()->getAgcTimeLog2();
}
if (channelSettingsKeys.contains("agcPowerThreshold")) {
settings.m_agcPowerThreshold = response.getFt8DemodSettings()->getAgcPowerThreshold();
}
if (channelSettingsKeys.contains("agcThresholdGate")) {
settings.m_agcThresholdGate = response.getFt8DemodSettings()->getAgcThresholdGate();
}
if (channelSettingsKeys.contains("rgbColor")) { if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getFt8DemodSettings()->getRgbColor(); settings.m_rgbColor = response.getFt8DemodSettings()->getRgbColor();
} }
@ -535,10 +507,6 @@ void FT8Demod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& resp
response.getFt8DemodSettings()->setFftWindow((int) settings.m_filterBank[settings.m_filterIndex].m_fftWindow); response.getFt8DemodSettings()->setFftWindow((int) settings.m_filterBank[settings.m_filterIndex].m_fftWindow);
response.getFt8DemodSettings()->setVolume(settings.m_volume); response.getFt8DemodSettings()->setVolume(settings.m_volume);
response.getFt8DemodSettings()->setAgc(settings.m_agc ? 1 : 0); response.getFt8DemodSettings()->setAgc(settings.m_agc ? 1 : 0);
response.getFt8DemodSettings()->setAgcClamping(settings.m_agcClamping ? 1 : 0);
response.getFt8DemodSettings()->setAgcTimeLog2(settings.m_agcTimeLog2);
response.getFt8DemodSettings()->setAgcPowerThreshold(settings.m_agcPowerThreshold);
response.getFt8DemodSettings()->setAgcThresholdGate(settings.m_agcThresholdGate);
response.getFt8DemodSettings()->setRgbColor(settings.m_rgbColor); response.getFt8DemodSettings()->setRgbColor(settings.m_rgbColor);
response.getFt8DemodSettings()->setFt8SampleRate(settings.m_ft8SampleRate); response.getFt8DemodSettings()->setFt8SampleRate(settings.m_ft8SampleRate);
@ -711,18 +679,6 @@ void FT8Demod::webapiFormatChannelSettings(
if (channelSettingsKeys.contains("agc") || force) { if (channelSettingsKeys.contains("agc") || force) {
swgFT8DemodSettings->setAgc(settings.m_agc ? 1 : 0); swgFT8DemodSettings->setAgc(settings.m_agc ? 1 : 0);
} }
if (channelSettingsKeys.contains("agcClamping") || force) {
swgFT8DemodSettings->setAgcClamping(settings.m_agcClamping ? 1 : 0);
}
if (channelSettingsKeys.contains("agcTimeLog2") || force) {
swgFT8DemodSettings->setAgcTimeLog2(settings.m_agcTimeLog2);
}
if (channelSettingsKeys.contains("agcPowerThreshold") || force) {
swgFT8DemodSettings->setAgcPowerThreshold(settings.m_agcPowerThreshold);
}
if (channelSettingsKeys.contains("agcThresholdGate") || force) {
swgFT8DemodSettings->setAgcThresholdGate(settings.m_agcThresholdGate);
}
if (channelSettingsKeys.contains("rgbColor") || force) { if (channelSettingsKeys.contains("rgbColor") || force) {
swgFT8DemodSettings->setRgbColor(settings.m_rgbColor); swgFT8DemodSettings->setRgbColor(settings.m_rgbColor);
} }

View File

@ -171,36 +171,6 @@ void FT8DemodGUI::on_agc_toggled(bool checked)
applySettings(); applySettings();
} }
void FT8DemodGUI::on_agcClamping_toggled(bool checked)
{
m_settings.m_agcClamping = checked;
applySettings();
}
void FT8DemodGUI::on_agcTimeLog2_valueChanged(int value)
{
QString s = QString::number((1<<value), 'f', 0);
ui->agcTimeText->setText(s);
m_settings.m_agcTimeLog2 = value;
applySettings();
}
void FT8DemodGUI::on_agcPowerThreshold_valueChanged(int value)
{
displayAGCPowerThreshold(value);
m_settings.m_agcPowerThreshold = value;
applySettings();
}
void FT8DemodGUI::on_agcThresholdGate_valueChanged(int value)
{
int agcThresholdGate = value < 20 ? value : ((value - 20) * 10) + 20;
QString s = QString::number(agcThresholdGate, 'f', 0);
ui->agcThresholdGateText->setText(s);
m_settings.m_agcThresholdGate = agcThresholdGate;
applySettings();
}
void FT8DemodGUI::on_spanLog2_valueChanged(int value) void FT8DemodGUI::on_spanLog2_valueChanged(int value)
{ {
int s2max = spanLog2Max(); int s2max = spanLog2Max();
@ -498,7 +468,6 @@ void FT8DemodGUI::displaySettings()
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->agc->setChecked(m_settings.m_agc); ui->agc->setChecked(m_settings.m_agc);
ui->agcClamping->setChecked(m_settings.m_agcClamping);
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->fftWindow->setCurrentIndex((int) m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow); ui->fftWindow->setCurrentIndex((int) m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow);
@ -530,14 +499,6 @@ void FT8DemodGUI::displaySettings()
ui->volume->setValue(volume); ui->volume->setValue(volume);
ui->volumeText->setText(QString("%1").arg(volume)); ui->volumeText->setText(QString("%1").arg(volume));
ui->agcTimeLog2->setValue(m_settings.m_agcTimeLog2);
s = QString::number((1<<ui->agcTimeLog2->value()), 'f', 0);
ui->agcTimeText->setText(s);
ui->agcPowerThreshold->setValue(m_settings.m_agcPowerThreshold);
displayAGCPowerThreshold(ui->agcPowerThreshold->value());
displayAGCThresholdGate(m_settings.m_agcThresholdGate);
updateIndexLabel(); updateIndexLabel();
getRollupContents()->restoreState(m_rollupState); getRollupContents()->restoreState(m_rollupState);
@ -545,32 +506,6 @@ void FT8DemodGUI::displaySettings()
blockApplySettings(false); blockApplySettings(false);
} }
void FT8DemodGUI::displayAGCPowerThreshold(int value)
{
if (value == FT8DemodSettings::m_minPowerThresholdDB)
{
ui->agcPowerThresholdText->setText("---");
}
else
{
QString s = QString::number(value, 'f', 0);
ui->agcPowerThresholdText->setText(s);
}
}
void FT8DemodGUI::displayAGCThresholdGate(int value)
{
QString s = QString::number(value, 'f', 0);
ui->agcThresholdGateText->setText(s);
int dialValue = value;
if (value > 20) {
dialValue = ((value - 20) / 10) + 20;
}
ui->agcThresholdGate->setValue(dialValue);
}
void FT8DemodGUI::leaveEvent(QEvent* event) void FT8DemodGUI::leaveEvent(QEvent* event)
{ {
m_channelMarker.setHighlighted(false); m_channelMarker.setHighlighted(false);
@ -610,10 +545,6 @@ void FT8DemodGUI::makeUIConnections()
QObject::connect(ui->lowCut, &TickedSlider::valueChanged, this, &FT8DemodGUI::on_lowCut_valueChanged); QObject::connect(ui->lowCut, &TickedSlider::valueChanged, this, &FT8DemodGUI::on_lowCut_valueChanged);
QObject::connect(ui->volume, &QDial::valueChanged, this, &FT8DemodGUI::on_volume_valueChanged); QObject::connect(ui->volume, &QDial::valueChanged, this, &FT8DemodGUI::on_volume_valueChanged);
QObject::connect(ui->agc, &ButtonSwitch::toggled, this, &FT8DemodGUI::on_agc_toggled); QObject::connect(ui->agc, &ButtonSwitch::toggled, this, &FT8DemodGUI::on_agc_toggled);
QObject::connect(ui->agcClamping, &ButtonSwitch::toggled, this, &FT8DemodGUI::on_agcClamping_toggled);
QObject::connect(ui->agcTimeLog2, &QDial::valueChanged, this, &FT8DemodGUI::on_agcTimeLog2_valueChanged);
QObject::connect(ui->agcPowerThreshold, &QDial::valueChanged, this, &FT8DemodGUI::on_agcPowerThreshold_valueChanged);
QObject::connect(ui->agcThresholdGate, &QDial::valueChanged, this, &FT8DemodGUI::on_agcThresholdGate_valueChanged);
QObject::connect(ui->spanLog2, &QSlider::valueChanged, this, &FT8DemodGUI::on_spanLog2_valueChanged); QObject::connect(ui->spanLog2, &QSlider::valueChanged, this, &FT8DemodGUI::on_spanLog2_valueChanged);
QObject::connect(ui->fftWindow, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FT8DemodGUI::on_fftWindow_currentIndexChanged); QObject::connect(ui->fftWindow, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FT8DemodGUI::on_fftWindow_currentIndexChanged);
QObject::connect(ui->filterIndex, &QDial::valueChanged, this, &FT8DemodGUI::on_filterIndex_valueChanged); QObject::connect(ui->filterIndex, &QDial::valueChanged, this, &FT8DemodGUI::on_filterIndex_valueChanged);

View File

@ -93,8 +93,6 @@ private:
void applyBandwidths(unsigned int spanLog2, bool force = false); void applyBandwidths(unsigned int spanLog2, bool force = false);
unsigned int spanLog2Max(); unsigned int spanLog2Max();
void displaySettings(); void displaySettings();
void displayAGCPowerThreshold(int value);
void displayAGCThresholdGate(int value);
bool handleMessage(const Message& message); bool handleMessage(const Message& message);
void makeUIConnections(); void makeUIConnections();
void updateAbsoluteCenterFrequency(); void updateAbsoluteCenterFrequency();
@ -108,10 +106,6 @@ private slots:
void on_lowCut_valueChanged(int value); void on_lowCut_valueChanged(int value);
void on_volume_valueChanged(int value); void on_volume_valueChanged(int value);
void on_agc_toggled(bool checked); void on_agc_toggled(bool checked);
void on_agcClamping_toggled(bool checked);
void on_agcTimeLog2_valueChanged(int value);
void on_agcPowerThreshold_valueChanged(int value);
void on_agcThresholdGate_valueChanged(int value);
void on_spanLog2_valueChanged(int value); void on_spanLog2_valueChanged(int value);
void on_fftWindow_currentIndexChanged(int index); void on_fftWindow_currentIndexChanged(int index);
void on_filterIndex_valueChanged(int value); void on_filterIndex_valueChanged(int value);

View File

@ -401,6 +401,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="ButtonSwitch" name="agc">
<property name="toolTip">
<string>Toggle AGC</string>
</property>
<property name="text">
<string>AGC</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -628,161 +641,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="ButtonSwitch" name="agc">
<property name="toolTip">
<string>Toggle AGC</string>
</property>
<property name="text">
<string>AGC</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="agcClamping">
<property name="toolTip">
<string>Toggle AGC clamping to maximum allowable signal</string>
</property>
<property name="text">
<string>CL</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="agcTimeLog2">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>AGC time constant (ms in log2 steps)</string>
</property>
<property name="minimum">
<number>4</number>
</property>
<property name="maximum">
<number>11</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>7</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="agcTimeText">
<property name="minimumSize">
<size>
<width>35</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>AGC time constant (ms)</string>
</property>
<property name="text">
<string>0000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="agcPowerThreshold">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Power threshold (dB)</string>
</property>
<property name="minimum">
<number>-120</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>-40</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="agcPowerThresholdText">
<property name="minimumSize">
<size>
<width>26</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Power threshold (dB)</string>
</property>
<property name="text">
<string>-000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="agcThresholdGate">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Power threshold gate (ms)</string>
</property>
<property name="maximum">
<number>68</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>4</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="agcThresholdGateText">
<property name="minimumSize">
<size>
<width>22</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Power threshold gate (ms)</string>
</property>
<property name="text">
<string>000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">

View File

@ -42,10 +42,6 @@ FT8DemodSettings::FT8DemodSettings() :
void FT8DemodSettings::resetToDefaults() void FT8DemodSettings::resetToDefaults()
{ {
m_agc = false; m_agc = false;
m_agcClamping = false;
m_agcPowerThreshold = -100;
m_agcThresholdGate = 4;
m_agcTimeLog2 = 7;
m_volume = 1.0; m_volume = 1.0;
m_inputFrequencyOffset = 0; m_inputFrequencyOffset = 0;
m_rgbColor = QColor(0, 192, 255).rgb(); m_rgbColor = QColor(0, 192, 255).rgb();
@ -74,10 +70,6 @@ QByteArray FT8DemodSettings::serialize() const
s.writeU32(5, m_rgbColor); s.writeU32(5, m_rgbColor);
s.writeBool(11, m_agc); s.writeBool(11, m_agc);
s.writeS32(12, m_agcTimeLog2);
s.writeS32(13, m_agcPowerThreshold);
s.writeS32(14, m_agcThresholdGate);
s.writeBool(15, m_agcClamping);
s.writeString(16, m_title); s.writeString(16, m_title);
s.writeS32(17, m_ft8SampleRate); s.writeS32(17, m_ft8SampleRate);
s.writeBool(18, m_useReverseAPI); s.writeBool(18, m_useReverseAPI);
@ -136,10 +128,6 @@ bool FT8DemodSettings::deserialize(const QByteArray& data)
d.readU32(5, &m_rgbColor); d.readU32(5, &m_rgbColor);
d.readBool(11, &m_agc, false); d.readBool(11, &m_agc, false);
d.readS32(12, &m_agcTimeLog2, 7);
d.readS32(13, &m_agcPowerThreshold, -40);
d.readS32(14, &m_agcThresholdGate, 4);
d.readBool(15, &m_agcClamping, false);
d.readString(16, &m_title, "SSB Demodulator"); d.readString(16, &m_title, "SSB Demodulator");
d.readS32(17, &m_ft8SampleRate, 12000); d.readS32(17, &m_ft8SampleRate, 12000);
d.readBool(18, &m_useReverseAPI, false); d.readBool(18, &m_useReverseAPI, false);

View File

@ -48,10 +48,6 @@ struct FT8DemodSettings
Real m_volume; Real m_volume;
// int m_spanLog2; // int m_spanLog2;
bool m_agc; bool m_agc;
bool m_agcClamping;
int m_agcTimeLog2;
int m_agcPowerThreshold;
int m_agcThresholdGate;
quint32 m_rgbColor; quint32 m_rgbColor;
QString m_title; QString m_title;
int m_ft8SampleRate; int m_ft8SampleRate;

View File

@ -39,11 +39,6 @@ const int FT8DemodSink::m_agcTarget = 3276; // 32768/10 -10 dB amplitude => -20
FT8DemodSink::FT8DemodSink() : FT8DemodSink::FT8DemodSink() :
m_agc(12000, m_agcTarget, 1e-2), m_agc(12000, m_agcTarget, 1e-2),
m_agcActive(false), m_agcActive(false),
m_agcClamping(false),
m_agcNbSamples(12000),
m_agcPowerThreshold(1e-2),
m_agcThresholdGate(0),
m_squelchDelayLine(2*48000),
m_audioActive(false), m_audioActive(false),
m_spectrumSink(nullptr), m_spectrumSink(nullptr),
m_audioFifo(24000), m_audioFifo(24000),
@ -70,8 +65,8 @@ FT8DemodSink::FT8DemodSink() :
m_magsqPeak = 0.0f; m_magsqPeak = 0.0f;
m_magsqCount = 0; m_magsqCount = 0;
m_agc.setClampMax(SDR_RX_SCALED/100.0); m_agc.setThresholdEnable(false); // no squelch
m_agc.setClamping(m_agcClamping); m_agc.setClamping(false); // no clamping
SSBFilter = new fftfilt(m_LowCutoff / m_ft8SampleRate, m_Bandwidth / m_ft8SampleRate, m_ssbFftLen); SSBFilter = new fftfilt(m_LowCutoff / m_ft8SampleRate, m_Bandwidth / m_ft8SampleRate, m_ssbFftLen);
@ -152,17 +147,14 @@ void FT8DemodSink::processOneSample(Complex &ci)
} }
float agcVal = m_agcActive ? m_agc.feedAndGetValue(sideband[i]) : 0.1; float agcVal = m_agcActive ? m_agc.feedAndGetValue(sideband[i]) : 0.1;
fftfilt::cmplx& delayedSample = m_squelchDelayLine.readBack(m_agc.getStepDownDelay()); fftfilt::cmplx z = sideband[i]*agcVal;
m_audioActive = delayedSample.real() != 0.0; m_audioActive = z.real() != 0.0;
m_squelchDelayLine.write(sideband[i]*agcVal);
fftfilt::cmplx z = m_agcActive ? delayedSample * m_agc.getStepValue() : delayedSample;
Real demod = (z.real() + z.imag()) * 0.7; Real demod = (z.real() + z.imag()) * 0.7;
qint16 sample = (qint16)(demod * m_volume); qint16 sample = (qint16)(demod * m_volume);
m_audioBuffer[m_audioBufferFill].l = sample; m_audioBuffer[m_audioBufferFill].l = sample;
m_audioBuffer[m_audioBufferFill].r = sample; m_audioBuffer[m_audioBufferFill].r = sample;
m_demodBuffer[m_demodBufferFill++] = (z.real() + z.imag()) * 0.7; m_demodBuffer[m_demodBufferFill++] = sample;
if (m_demodBufferFill >= m_demodBuffer.size()) if (m_demodBufferFill >= m_demodBuffer.size())
{ {
@ -195,11 +187,11 @@ void FT8DemodSink::processOneSample(Complex &ci)
if (m_audioBufferFill >= m_audioBuffer.size()) if (m_audioBufferFill >= m_audioBuffer.size())
{ {
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill); // uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
if (res != m_audioBufferFill) { // if (res != m_audioBufferFill) {
qDebug("FT8DemodSink::processOneSample: %u/%u samples written", res, m_audioBufferFill); // qDebug("FT8DemodSink::processOneSample: %u/%u samples written", res, m_audioBufferFill);
} // }
m_audioBufferFill = 0; m_audioBufferFill = 0;
} }
@ -247,26 +239,9 @@ void FT8DemodSink::applyFT8SampleRate(int sampleRate)
SSBFilter->create_filter(m_LowCutoff / (float) sampleRate, m_Bandwidth / (float) sampleRate, m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow); SSBFilter->create_filter(m_LowCutoff / (float) sampleRate, m_Bandwidth / (float) sampleRate, m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow);
int agcNbSamples = (sampleRate / 1000) * (1<<m_settings.m_agcTimeLog2);
int agcThresholdGate = (sampleRate / 1000) * m_settings.m_agcThresholdGate; // ms
if (m_agcNbSamples != agcNbSamples)
{
m_agc.resize(agcNbSamples, agcNbSamples/2, m_agcTarget);
m_agc.setStepDownDelay(agcNbSamples);
m_agcNbSamples = agcNbSamples;
}
if (m_agcThresholdGate != agcThresholdGate)
{
m_agc.setGate(agcThresholdGate);
m_agcThresholdGate = agcThresholdGate;
}
m_audioFifo.setSize(sampleRate); m_audioFifo.setSize(sampleRate);
m_ft8SampleRate = sampleRate; m_ft8SampleRate = sampleRate;
QList<ObjectPipe*> pipes; QList<ObjectPipe*> pipes;
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes); MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
@ -296,10 +271,6 @@ void FT8DemodSink::applySettings(const FT8DemodSettings& settings, bool force)
<< " m_fftWindow: " << settings.m_filterBank[settings.m_filterIndex].m_fftWindow << "]" << " m_fftWindow: " << settings.m_filterBank[settings.m_filterIndex].m_fftWindow << "]"
<< " m_volume: " << settings.m_volume << " m_volume: " << settings.m_volume
<< " m_agcActive: " << settings.m_agc << " m_agcActive: " << settings.m_agc
<< " m_agcClamping: " << settings.m_agcClamping
<< " m_agcTimeLog2: " << settings.m_agcTimeLog2
<< " agcPowerThreshold: " << settings.m_agcPowerThreshold
<< " agcThresholdGate: " << settings.m_agcThresholdGate
<< " m_ft8SampleRate: " << settings.m_ft8SampleRate << " m_ft8SampleRate: " << settings.m_ft8SampleRate
<< " m_streamIndex: " << settings.m_streamIndex << " m_streamIndex: " << settings.m_streamIndex
<< " m_useReverseAPI: " << settings.m_useReverseAPI << " m_useReverseAPI: " << settings.m_useReverseAPI
@ -348,49 +319,6 @@ void FT8DemodSink::applySettings(const FT8DemodSettings& settings, bool force)
m_volume /= 4.0; // for 3276.8 m_volume /= 4.0; // for 3276.8
} }
if ((m_settings.m_agcTimeLog2 != settings.m_agcTimeLog2) ||
(m_settings.m_agcPowerThreshold != settings.m_agcPowerThreshold) ||
(m_settings.m_agcThresholdGate != settings.m_agcThresholdGate) ||
(m_settings.m_agcClamping != settings.m_agcClamping) || force)
{
int agcNbSamples = (m_ft8SampleRate / 1000) * (1<<settings.m_agcTimeLog2);
m_agc.setThresholdEnable(settings.m_agcPowerThreshold != -FT8DemodSettings::m_minPowerThresholdDB);
double agcPowerThreshold = CalcDb::powerFromdB(settings.m_agcPowerThreshold) * (SDR_RX_SCALED*SDR_RX_SCALED);
int agcThresholdGate = (m_ft8SampleRate / 1000) * settings.m_agcThresholdGate; // ms
bool agcClamping = settings.m_agcClamping;
if (m_agcNbSamples != agcNbSamples)
{
m_agc.resize(agcNbSamples, agcNbSamples/2, m_agcTarget);
m_agc.setStepDownDelay(agcNbSamples);
m_agcNbSamples = agcNbSamples;
}
if (m_agcPowerThreshold != agcPowerThreshold)
{
m_agc.setThreshold(agcPowerThreshold);
m_agcPowerThreshold = agcPowerThreshold;
}
if (m_agcThresholdGate != agcThresholdGate)
{
m_agc.setGate(agcThresholdGate);
m_agcThresholdGate = agcThresholdGate;
}
if (m_agcClamping != agcClamping)
{
m_agc.setClamping(agcClamping);
m_agcClamping = agcClamping;
}
qDebug() << "FT8DemodSink::applySettings: AGC:"
<< " agcNbSamples: " << agcNbSamples
<< " agcPowerThreshold: " << agcPowerThreshold
<< " agcThresholdGate: " << agcThresholdGate
<< " agcClamping: " << agcClamping;
}
m_spanLog2 = settings.m_filterBank[settings.m_filterIndex].m_spanLog2; m_spanLog2 = settings.m_filterBank[settings.m_filterIndex].m_spanLog2;
m_agcActive = settings.m_agc; m_agcActive = settings.m_agc;
m_settings = settings; m_settings = settings;

View File

@ -99,11 +99,6 @@ private:
MagSqLevelsStore m_magSqLevelStore; MagSqLevelsStore m_magSqLevelStore;
MagAGC m_agc; MagAGC m_agc;
bool m_agcActive; bool m_agcActive;
bool m_agcClamping;
int m_agcNbSamples; //!< number of audio (48 kHz) samples for AGC averaging
double m_agcPowerThreshold; //!< AGC power threshold (linear)
int m_agcThresholdGate; //!< Gate length in number of samples befor threshold triggers
DoubleBufferFIFO<fftfilt::cmplx> m_squelchDelayLine;
bool m_audioActive; //!< True if an audio signal is produced (no AGC or AGC and above threshold) bool m_audioActive; //!< True if an audio signal is produced (no AGC or AGC and above threshold)
NCOF m_nco; NCOF m_nco;

View File

@ -30,6 +30,7 @@ const QStringList DemodAnalyzerSettings::m_channelTypes = {
QStringLiteral("BFMDemod"), QStringLiteral("BFMDemod"),
QStringLiteral("DABDemod"), QStringLiteral("DABDemod"),
QStringLiteral("DSDDemod"), QStringLiteral("DSDDemod"),
QStringLiteral("FT8Demod"),
QStringLiteral("M17Demod"), QStringLiteral("M17Demod"),
QStringLiteral("M17Mmod"), QStringLiteral("M17Mmod"),
QStringLiteral("NFMDemod"), QStringLiteral("NFMDemod"),
@ -51,6 +52,7 @@ const QStringList DemodAnalyzerSettings::m_channelURIs = {
QStringLiteral("sdrangel.channel.bfm"), QStringLiteral("sdrangel.channel.bfm"),
QStringLiteral("sdrangel.channel.dabdemod"), QStringLiteral("sdrangel.channel.dabdemod"),
QStringLiteral("sdrangel.channel.dsddemod"), QStringLiteral("sdrangel.channel.dsddemod"),
QStringLiteral("sdrangel.channel.ft8demod"),
QStringLiteral("sdrangel.channel.m17demod"), QStringLiteral("sdrangel.channel.m17demod"),
QStringLiteral("sdrangel.channeltx.modm17"), QStringLiteral("sdrangel.channeltx.modm17"),
QStringLiteral("sdrangel.channel.nfmdemod"), QStringLiteral("sdrangel.channel.nfmdemod"),

View File

@ -5611,22 +5611,6 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"description" : "AGC (1 if AGC active else 0)" "description" : "AGC (1 if AGC active else 0)"
}, },
"agcClamping" : {
"type" : "integer",
"description" : "AGC clamping (1 if AGC clampingactive else 0)"
},
"agcTimeLog2" : {
"type" : "integer",
"description" : "AGC averaging time log2 in milliseconds"
},
"agcPowerThreshold" : {
"type" : "integer",
"description" : "Audio open RF threshold (dB)"
},
"agcThresholdGate" : {
"type" : "integer",
"description" : "Audio squelch gate in ms"
},
"rgbColor" : { "rgbColor" : {
"type" : "integer" "type" : "integer"
}, },
@ -56892,7 +56876,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2023-01-15T07:29:18.682+01:00 Generated 2023-01-15T12:10:43.505+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -33,18 +33,6 @@ FT8DemodSettings:
agc: agc:
description: AGC (1 if AGC active else 0) description: AGC (1 if AGC active else 0)
type: integer type: integer
agcClamping:
description: AGC clamping (1 if AGC clampingactive else 0)
type: integer
agcTimeLog2:
description: AGC averaging time log2 in milliseconds
type: integer
agcPowerThreshold:
description: Audio open RF threshold (dB)
type: integer
agcThresholdGate:
description: Audio squelch gate in ms
type: integer
rgbColor: rgbColor:
type: integer type: integer
title: title:

View File

@ -33,18 +33,6 @@ FT8DemodSettings:
agc: agc:
description: AGC (1 if AGC active else 0) description: AGC (1 if AGC active else 0)
type: integer type: integer
agcClamping:
description: AGC clamping (1 if AGC clampingactive else 0)
type: integer
agcTimeLog2:
description: AGC averaging time log2 in milliseconds
type: integer
agcPowerThreshold:
description: Audio open RF threshold (dB)
type: integer
agcThresholdGate:
description: Audio squelch gate in ms
type: integer
rgbColor: rgbColor:
type: integer type: integer
title: title:

View File

@ -5611,22 +5611,6 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"description" : "AGC (1 if AGC active else 0)" "description" : "AGC (1 if AGC active else 0)"
}, },
"agcClamping" : {
"type" : "integer",
"description" : "AGC clamping (1 if AGC clampingactive else 0)"
},
"agcTimeLog2" : {
"type" : "integer",
"description" : "AGC averaging time log2 in milliseconds"
},
"agcPowerThreshold" : {
"type" : "integer",
"description" : "Audio open RF threshold (dB)"
},
"agcThresholdGate" : {
"type" : "integer",
"description" : "Audio squelch gate in ms"
},
"rgbColor" : { "rgbColor" : {
"type" : "integer" "type" : "integer"
}, },
@ -56892,7 +56876,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2023-01-15T07:29:18.682+01:00 Generated 2023-01-15T12:10:43.505+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -44,14 +44,6 @@ SWGFT8DemodSettings::SWGFT8DemodSettings() {
m_volume_isSet = false; m_volume_isSet = false;
agc = 0; agc = 0;
m_agc_isSet = false; m_agc_isSet = false;
agc_clamping = 0;
m_agc_clamping_isSet = false;
agc_time_log2 = 0;
m_agc_time_log2_isSet = false;
agc_power_threshold = 0;
m_agc_power_threshold_isSet = false;
agc_threshold_gate = 0;
m_agc_threshold_gate_isSet = false;
rgb_color = 0; rgb_color = 0;
m_rgb_color_isSet = false; m_rgb_color_isSet = false;
title = nullptr; title = nullptr;
@ -100,14 +92,6 @@ SWGFT8DemodSettings::init() {
m_volume_isSet = false; m_volume_isSet = false;
agc = 0; agc = 0;
m_agc_isSet = false; m_agc_isSet = false;
agc_clamping = 0;
m_agc_clamping_isSet = false;
agc_time_log2 = 0;
m_agc_time_log2_isSet = false;
agc_power_threshold = 0;
m_agc_power_threshold_isSet = false;
agc_threshold_gate = 0;
m_agc_threshold_gate_isSet = false;
rgb_color = 0; rgb_color = 0;
m_rgb_color_isSet = false; m_rgb_color_isSet = false;
title = new QString(""); title = new QString("");
@ -145,10 +129,6 @@ SWGFT8DemodSettings::cleanup() {
if(title != nullptr) { if(title != nullptr) {
delete title; delete title;
} }
@ -199,14 +179,6 @@ SWGFT8DemodSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&agc, pJson["agc"], "qint32", ""); ::SWGSDRangel::setValue(&agc, pJson["agc"], "qint32", "");
::SWGSDRangel::setValue(&agc_clamping, pJson["agcClamping"], "qint32", "");
::SWGSDRangel::setValue(&agc_time_log2, pJson["agcTimeLog2"], "qint32", "");
::SWGSDRangel::setValue(&agc_power_threshold, pJson["agcPowerThreshold"], "qint32", "");
::SWGSDRangel::setValue(&agc_threshold_gate, pJson["agcThresholdGate"], "qint32", "");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", ""); ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString"); ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
@ -271,18 +243,6 @@ SWGFT8DemodSettings::asJsonObject() {
if(m_agc_isSet){ if(m_agc_isSet){
obj->insert("agc", QJsonValue(agc)); obj->insert("agc", QJsonValue(agc));
} }
if(m_agc_clamping_isSet){
obj->insert("agcClamping", QJsonValue(agc_clamping));
}
if(m_agc_time_log2_isSet){
obj->insert("agcTimeLog2", QJsonValue(agc_time_log2));
}
if(m_agc_power_threshold_isSet){
obj->insert("agcPowerThreshold", QJsonValue(agc_power_threshold));
}
if(m_agc_threshold_gate_isSet){
obj->insert("agcThresholdGate", QJsonValue(agc_threshold_gate));
}
if(m_rgb_color_isSet){ if(m_rgb_color_isSet){
obj->insert("rgbColor", QJsonValue(rgb_color)); obj->insert("rgbColor", QJsonValue(rgb_color));
} }
@ -403,46 +363,6 @@ SWGFT8DemodSettings::setAgc(qint32 agc) {
this->m_agc_isSet = true; this->m_agc_isSet = true;
} }
qint32
SWGFT8DemodSettings::getAgcClamping() {
return agc_clamping;
}
void
SWGFT8DemodSettings::setAgcClamping(qint32 agc_clamping) {
this->agc_clamping = agc_clamping;
this->m_agc_clamping_isSet = true;
}
qint32
SWGFT8DemodSettings::getAgcTimeLog2() {
return agc_time_log2;
}
void
SWGFT8DemodSettings::setAgcTimeLog2(qint32 agc_time_log2) {
this->agc_time_log2 = agc_time_log2;
this->m_agc_time_log2_isSet = true;
}
qint32
SWGFT8DemodSettings::getAgcPowerThreshold() {
return agc_power_threshold;
}
void
SWGFT8DemodSettings::setAgcPowerThreshold(qint32 agc_power_threshold) {
this->agc_power_threshold = agc_power_threshold;
this->m_agc_power_threshold_isSet = true;
}
qint32
SWGFT8DemodSettings::getAgcThresholdGate() {
return agc_threshold_gate;
}
void
SWGFT8DemodSettings::setAgcThresholdGate(qint32 agc_threshold_gate) {
this->agc_threshold_gate = agc_threshold_gate;
this->m_agc_threshold_gate_isSet = true;
}
qint32 qint32
SWGFT8DemodSettings::getRgbColor() { SWGFT8DemodSettings::getRgbColor() {
return rgb_color; return rgb_color;
@ -592,18 +512,6 @@ SWGFT8DemodSettings::isSet(){
if(m_agc_isSet){ if(m_agc_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
if(m_agc_clamping_isSet){
isObjectUpdated = true; break;
}
if(m_agc_time_log2_isSet){
isObjectUpdated = true; break;
}
if(m_agc_power_threshold_isSet){
isObjectUpdated = true; break;
}
if(m_agc_threshold_gate_isSet){
isObjectUpdated = true; break;
}
if(m_rgb_color_isSet){ if(m_rgb_color_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }

View File

@ -69,18 +69,6 @@ public:
qint32 getAgc(); qint32 getAgc();
void setAgc(qint32 agc); void setAgc(qint32 agc);
qint32 getAgcClamping();
void setAgcClamping(qint32 agc_clamping);
qint32 getAgcTimeLog2();
void setAgcTimeLog2(qint32 agc_time_log2);
qint32 getAgcPowerThreshold();
void setAgcPowerThreshold(qint32 agc_power_threshold);
qint32 getAgcThresholdGate();
void setAgcThresholdGate(qint32 agc_threshold_gate);
qint32 getRgbColor(); qint32 getRgbColor();
void setRgbColor(qint32 rgb_color); void setRgbColor(qint32 rgb_color);
@ -145,18 +133,6 @@ private:
qint32 agc; qint32 agc;
bool m_agc_isSet; bool m_agc_isSet;
qint32 agc_clamping;
bool m_agc_clamping_isSet;
qint32 agc_time_log2;
bool m_agc_time_log2_isSet;
qint32 agc_power_threshold;
bool m_agc_power_threshold_isSet;
qint32 agc_threshold_gate;
bool m_agc_threshold_gate_isSet;
qint32 rgb_color; qint32 rgb_color;
bool m_rgb_color_isSet; bool m_rgb_color_isSet;