mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
NFM Demod: try a deferred init to cure AF squelch init problem
This commit is contained in:
parent
e4332a16b6
commit
91021678b2
@ -94,7 +94,8 @@ void NFMDemod::configure(MessageQueue* messageQueue,
|
|||||||
bool deltaSquelch,
|
bool deltaSquelch,
|
||||||
Real squelch,
|
Real squelch,
|
||||||
bool ctcssOn,
|
bool ctcssOn,
|
||||||
bool audioMute)
|
bool audioMute,
|
||||||
|
bool force)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgConfigureNFMDemod::create(rfBandwidth,
|
Message* cmd = MsgConfigureNFMDemod::create(rfBandwidth,
|
||||||
afBandwidth,
|
afBandwidth,
|
||||||
@ -104,7 +105,8 @@ void NFMDemod::configure(MessageQueue* messageQueue,
|
|||||||
deltaSquelch,
|
deltaSquelch,
|
||||||
squelch,
|
squelch,
|
||||||
ctcssOn,
|
ctcssOn,
|
||||||
audioMute);
|
audioMute,
|
||||||
|
force);
|
||||||
messageQueue->push(cmd);
|
messageQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,6 +340,7 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
|||||||
|
|
||||||
void NFMDemod::start()
|
void NFMDemod::start()
|
||||||
{
|
{
|
||||||
|
qDebug() << "NFMDemod::start";
|
||||||
m_audioFifo.clear();
|
m_audioFifo.clear();
|
||||||
m_phaseDiscri.reset();
|
m_phaseDiscri.reset();
|
||||||
apply(true);
|
apply(true);
|
||||||
@ -379,7 +382,7 @@ bool NFMDemod::handleMessage(const Message& cmd)
|
|||||||
m_config.m_ctcssOn = cfg.getCtcssOn();
|
m_config.m_ctcssOn = cfg.getCtcssOn();
|
||||||
m_config.m_audioMute = cfg.getAudioMute();
|
m_config.m_audioMute = cfg.getAudioMute();
|
||||||
|
|
||||||
apply();
|
apply(cfg.getForce());
|
||||||
|
|
||||||
qDebug() << "NFMDemod::handleMessage: MsgConfigureNFMDemod: m_rfBandwidth: " << m_config.m_rfBandwidth
|
qDebug() << "NFMDemod::handleMessage: MsgConfigureNFMDemod: m_rfBandwidth: " << m_config.m_rfBandwidth
|
||||||
<< " m_afBandwidth: " << m_config.m_afBandwidth
|
<< " m_afBandwidth: " << m_config.m_afBandwidth
|
||||||
@ -389,7 +392,8 @@ bool NFMDemod::handleMessage(const Message& cmd)
|
|||||||
<< " m_deltaSquelch: " << m_config.m_deltaSquelch
|
<< " m_deltaSquelch: " << m_config.m_deltaSquelch
|
||||||
<< " m_squelch: " << m_squelchLevel
|
<< " m_squelch: " << m_squelchLevel
|
||||||
<< " m_ctcssOn: " << m_config.m_ctcssOn
|
<< " m_ctcssOn: " << m_config.m_ctcssOn
|
||||||
<< " m_audioMute: " << m_config.m_audioMute;
|
<< " m_audioMute: " << m_config.m_audioMute
|
||||||
|
<< " force: " << cfg.getForce();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,8 @@ public:
|
|||||||
bool deltaSquelch,
|
bool deltaSquelch,
|
||||||
Real squelch,
|
Real squelch,
|
||||||
bool ctcssOn,
|
bool ctcssOn,
|
||||||
bool audioMute);
|
bool audioMute,
|
||||||
|
bool force);
|
||||||
|
|
||||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||||
virtual void start();
|
virtual void start();
|
||||||
@ -97,6 +98,7 @@ private:
|
|||||||
Real getSquelch() const { return m_squelch; }
|
Real getSquelch() const { return m_squelch; }
|
||||||
bool getCtcssOn() const { return m_ctcssOn; }
|
bool getCtcssOn() const { return m_ctcssOn; }
|
||||||
bool getAudioMute() const { return m_audioMute; }
|
bool getAudioMute() const { return m_audioMute; }
|
||||||
|
bool getForce() const { return m_force; }
|
||||||
|
|
||||||
static MsgConfigureNFMDemod* create(Real rfBandwidth,
|
static MsgConfigureNFMDemod* create(Real rfBandwidth,
|
||||||
Real afBandwidth,
|
Real afBandwidth,
|
||||||
@ -106,7 +108,8 @@ private:
|
|||||||
bool deltaSquelch,
|
bool deltaSquelch,
|
||||||
Real squelch,
|
Real squelch,
|
||||||
bool ctcssOn,
|
bool ctcssOn,
|
||||||
bool audioMute)
|
bool audioMute,
|
||||||
|
bool force)
|
||||||
{
|
{
|
||||||
return new MsgConfigureNFMDemod(
|
return new MsgConfigureNFMDemod(
|
||||||
rfBandwidth,
|
rfBandwidth,
|
||||||
@ -117,7 +120,8 @@ private:
|
|||||||
deltaSquelch,
|
deltaSquelch,
|
||||||
squelch,
|
squelch,
|
||||||
ctcssOn,
|
ctcssOn,
|
||||||
audioMute);
|
audioMute,
|
||||||
|
force);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -130,6 +134,7 @@ private:
|
|||||||
Real m_squelch;
|
Real m_squelch;
|
||||||
bool m_ctcssOn;
|
bool m_ctcssOn;
|
||||||
bool m_audioMute;
|
bool m_audioMute;
|
||||||
|
bool m_force;
|
||||||
|
|
||||||
MsgConfigureNFMDemod(Real rfBandwidth,
|
MsgConfigureNFMDemod(Real rfBandwidth,
|
||||||
Real afBandwidth,
|
Real afBandwidth,
|
||||||
@ -139,7 +144,8 @@ private:
|
|||||||
bool deltaSquelch,
|
bool deltaSquelch,
|
||||||
Real squelch,
|
Real squelch,
|
||||||
bool ctcssOn,
|
bool ctcssOn,
|
||||||
bool audioMute) :
|
bool audioMute,
|
||||||
|
bool force) :
|
||||||
Message(),
|
Message(),
|
||||||
m_rfBandwidth(rfBandwidth),
|
m_rfBandwidth(rfBandwidth),
|
||||||
m_afBandwidth(afBandwidth),
|
m_afBandwidth(afBandwidth),
|
||||||
@ -149,7 +155,8 @@ private:
|
|||||||
m_deltaSquelch(deltaSquelch),
|
m_deltaSquelch(deltaSquelch),
|
||||||
m_squelch(squelch),
|
m_squelch(squelch),
|
||||||
m_ctcssOn(ctcssOn),
|
m_ctcssOn(ctcssOn),
|
||||||
m_audioMute(audioMute)
|
m_audioMute(audioMute),
|
||||||
|
m_force(force)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ bool NFMDemodGUI::deserialize(const QByteArray& data)
|
|||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
m_channelMarker.blockSignals(false);
|
m_channelMarker.blockSignals(false);
|
||||||
|
|
||||||
applySettings();
|
applySettings(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -272,7 +272,8 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
|||||||
m_channelMarker(this),
|
m_channelMarker(this),
|
||||||
m_basicSettingsShown(false),
|
m_basicSettingsShown(false),
|
||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
m_squelchOpen(false)
|
m_squelchOpen(false),
|
||||||
|
m_autoInitCount(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
@ -328,7 +329,7 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
|||||||
QChar delta = QChar(0x94, 0x03);
|
QChar delta = QChar(0x94, 0x03);
|
||||||
ui->deltaSquelch->setText(delta);
|
ui->deltaSquelch->setText(delta);
|
||||||
|
|
||||||
applySettings();
|
applySettings(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
NFMDemodGUI::~NFMDemodGUI()
|
NFMDemodGUI::~NFMDemodGUI()
|
||||||
@ -342,7 +343,7 @@ NFMDemodGUI::~NFMDemodGUI()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMDemodGUI::applySettings()
|
void NFMDemodGUI::applySettings(bool force)
|
||||||
{
|
{
|
||||||
if (m_doApplySettings)
|
if (m_doApplySettings)
|
||||||
{
|
{
|
||||||
@ -365,7 +366,8 @@ void NFMDemodGUI::applySettings()
|
|||||||
ui->deltaSquelch->isChecked(),
|
ui->deltaSquelch->isChecked(),
|
||||||
ui->squelch->value(), // -1000 -> 0
|
ui->squelch->value(), // -1000 -> 0
|
||||||
ui->ctcssOn->isChecked(),
|
ui->ctcssOn->isChecked(),
|
||||||
ui->audioMute->isChecked());
|
ui->audioMute->isChecked(),
|
||||||
|
force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,4 +429,10 @@ void NFMDemodGUI::tick()
|
|||||||
|
|
||||||
m_squelchOpen = squelchOpen;
|
m_squelchOpen = squelchOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_autoInitCount < 100) // ~5s
|
||||||
|
{
|
||||||
|
if (m_autoInitCount == 99) applySettings(true);
|
||||||
|
m_autoInitCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ private:
|
|||||||
bool m_ctcssOn;
|
bool m_ctcssOn;
|
||||||
bool m_audioMute;
|
bool m_audioMute;
|
||||||
bool m_squelchOpen;
|
bool m_squelchOpen;
|
||||||
|
uint32_t m_autoInitCount;
|
||||||
|
|
||||||
static const int m_rfBW[];
|
static const int m_rfBW[];
|
||||||
static const int m_fmDev[];
|
static const int m_fmDev[];
|
||||||
@ -78,7 +79,7 @@ private:
|
|||||||
virtual ~NFMDemodGUI();
|
virtual ~NFMDemodGUI();
|
||||||
|
|
||||||
void blockApplySettings(bool block);
|
void blockApplySettings(bool block);
|
||||||
void applySettings();
|
void applySettings(bool force = false);
|
||||||
|
|
||||||
void leaveEvent(QEvent*);
|
void leaveEvent(QEvent*);
|
||||||
void enterEvent(QEvent*);
|
void enterEvent(QEvent*);
|
||||||
|
@ -205,8 +205,10 @@ void AFSquelch::reset()
|
|||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < m_nTones; ++j)
|
for (unsigned int j = 0; j < m_nTones; ++j)
|
||||||
{
|
{
|
||||||
m_power[j] = m_u0[j] = m_u1[j] = 0.0; // reset
|
m_u0[j] = 0.0;
|
||||||
m_movingAverages[j].fill(0.0);
|
m_u1[j] = 0.0;
|
||||||
|
m_power[j] = 0.0;
|
||||||
|
m_movingAverages[j].fill(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_samplesProcessed = 0;
|
m_samplesProcessed = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user