1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 18:15:45 -05:00

DSD demod: switch for cosine filter. Other changes to GUI

This commit is contained in:
f4exb 2016-08-18 19:38:39 +02:00
parent 5ccfbb0ef1
commit 99c74a8e57
6 changed files with 89 additions and 35 deletions

View File

@ -43,6 +43,7 @@ public:
int getZeroCrossingPos() const { return m_decoder.getZeroCrossingPos(); }
int getSymbolSyncQuality() const { return m_decoder.getSymbolSyncQuality(); }
int getSamplesPerSymbol() const { return m_decoder.getSamplesPerSymbol(); }
void enableCosineFiltering(bool on) { m_decoder.enableCosineFiltering(on); }
DSDcc::DSDDecoder::DSDSyncType getSyncType() const { return m_decoder.getSyncType(); }
DSDcc::DSDDecoder::DSDStationType getStationType() const { return m_decoder.getStationType(); }
const char *getFrameTypeText() const { return m_decoder.getFrameTypeText(); }

View File

@ -54,6 +54,7 @@ DSDDemod::DSDDemod(SampleSink* sampleSink) :
m_config.m_baudRate = 4800;
m_config.m_audioMute = false;
m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
m_config.m_enableCosineFiltering = false;
apply();
@ -82,7 +83,8 @@ void DSDDemod::configure(MessageQueue* messageQueue,
int baudRate,
int squelchGate,
Real squelch,
bool audioMute)
bool audioMute,
bool enableCosineFiltering)
{
Message* cmd = MsgConfigureDSDDemod::create(rfBandwidth,
demodGain,
@ -91,7 +93,8 @@ void DSDDemod::configure(MessageQueue* messageQueue,
baudRate,
squelchGate,
squelch,
audioMute);
audioMute,
enableCosineFiltering);
messageQueue->push(cmd);
}
@ -246,6 +249,7 @@ bool DSDDemod::handleMessage(const Message& cmd)
m_config.m_squelchGate = cfg.getSquelchGate();
m_config.m_squelch = cfg.getSquelch();
m_config.m_audioMute = cfg.getAudioMute();
m_config.m_enableCosineFiltering = cfg.getEnableCosineFiltering();
apply();
@ -256,7 +260,8 @@ bool DSDDemod::handleMessage(const Message& cmd)
<< " m_baudRate: " << m_config.m_baudRate
<< " m_squelchGate" << m_config.m_squelchGate
<< " m_squelch: " << m_config.m_squelch
<< " m_audioMute: " << m_config.m_audioMute;
<< " m_audioMute: " << m_config.m_audioMute
<< " m_enableCosineFiltering: " << m_config.m_enableCosineFiltering;
return true;
}
@ -313,6 +318,11 @@ void DSDDemod::apply()
m_dsdDecoder.setBaudRate(m_config.m_baudRate);
}
if (m_config.m_enableCosineFiltering != m_running.m_enableCosineFiltering)
{
m_dsdDecoder.enableCosineFiltering(m_config.m_enableCosineFiltering);
}
m_running.m_inputSampleRate = m_config.m_inputSampleRate;
m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
m_running.m_rfBandwidth = m_config.m_rfBandwidth;
@ -324,4 +334,5 @@ void DSDDemod::apply()
m_running.m_baudRate = m_config.m_baudRate;
m_running.m_audioSampleRate = m_config.m_audioSampleRate;
m_running.m_audioMute = m_config.m_audioMute;
m_running.m_enableCosineFiltering = m_config.m_enableCosineFiltering;
}

View File

@ -48,7 +48,8 @@ public:
int fmDeviation,
int squelchGate,
Real squelch,
bool audioMute);
bool audioMute,
bool enableCosineFiltering);
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
virtual void start();
@ -77,6 +78,7 @@ private:
int getSquelchGate() const { return m_squelchGate; }
Real getSquelch() const { return m_squelch; }
bool getAudioMute() const { return m_audioMute; }
bool getEnableCosineFiltering() const { return m_enableCosineFiltering; }
static MsgConfigureDSDDemod* create(int rfBandwidth,
int demodGain,
@ -85,9 +87,10 @@ private:
int baudRate,
int squelchGate,
Real squelch,
bool audioMute)
bool audioMute,
bool enableCosineFiltering)
{
return new MsgConfigureDSDDemod(rfBandwidth, demodGain, fmDeviation, volume, baudRate, squelchGate, squelch, audioMute);
return new MsgConfigureDSDDemod(rfBandwidth, demodGain, fmDeviation, volume, baudRate, squelchGate, squelch, audioMute, enableCosineFiltering);
}
private:
@ -99,6 +102,7 @@ private:
int m_squelchGate;
Real m_squelch;
bool m_audioMute;
bool m_enableCosineFiltering;
MsgConfigureDSDDemod(int rfBandwidth,
int demodGain,
@ -107,7 +111,8 @@ private:
int baudRate,
int squelchGate,
Real squelch,
bool audioMute) :
bool audioMute,
bool enableCosineFiltering) :
Message(),
m_rfBandwidth(rfBandwidth),
m_demodGain(demodGain),
@ -116,7 +121,8 @@ private:
m_baudRate(baudRate),
m_squelchGate(squelchGate),
m_squelch(squelch),
m_audioMute(audioMute)
m_audioMute(audioMute),
m_enableCosineFiltering(enableCosineFiltering)
{ }
};
@ -143,6 +149,7 @@ private:
Real m_squelch;
bool m_audioMute;
quint32 m_audioSampleRate;
bool m_enableCosineFiltering;
Config() :
m_inputSampleRate(-1),
@ -155,7 +162,8 @@ private:
m_squelchGate(1),
m_squelch(0),
m_audioMute(false),
m_audioSampleRate(0)
m_audioSampleRate(0),
m_enableCosineFiltering(false)
{ }
};

View File

@ -115,6 +115,7 @@ QByteArray DSDDemodGUI::serialize() const
s.writeS32(9, ui->volume->value());
s.writeBlob(10, ui->scopeGUI->serialize());
s.writeS32(11, ui->baudRate->currentIndex());
s.writeBool(12, m_enableCosineFiltering);
return s.final();
}
@ -162,6 +163,7 @@ bool DSDDemodGUI::deserialize(const QByteArray& data)
ui->scopeGUI->deserialize(bytetmp);
d.readS32(11, &tmp, 20);
ui->baudRate->setCurrentIndex(tmp);
d.readBool(12, &m_enableCosineFiltering, false);
blockApplySettings(false);
m_channelMarker.blockSignals(false);
@ -236,6 +238,12 @@ void DSDDemodGUI::on_baudRate_currentIndexChanged(int index)
applySettings();
}
void DSDDemodGUI::on_enableCosineFiltering_toggled(bool enable)
{
m_enableCosineFiltering = enable;
applySettings();
}
void DSDDemodGUI::on_squelchGate_valueChanged(int value)
{
applySettings();
@ -280,6 +288,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* pa
m_basicSettingsShown(false),
m_doApplySettings(true),
m_signalFormat(signalFormatNone),
m_enableCosineFiltering(false),
m_squelchOpen(false),
m_channelPowerDbAvg(20,0),
m_tickCount(0)
@ -354,6 +363,9 @@ void DSDDemodGUI::applySettings()
ui->fmDeviationText->setText(QString("%1k").arg(ui->fmDeviation->value() / 10.0, 0, 'f', 1));
ui->squelchGateText->setText(QString("%1").arg(ui->squelchGate->value() * 10.0, 0, 'f', 0));
ui->volumeText->setText(QString("%1").arg(ui->volume->value() / 10.0, 0, 'f', 1));
ui->enableCosineFiltering->setChecked(m_enableCosineFiltering);
// TODO: pass m_enableCosineFiltering
m_dsdDemod->configure(m_dsdDemod->getInputMessageQueue(),
ui->rfBW->value(),
@ -363,7 +375,8 @@ void DSDDemodGUI::applySettings()
DSDDemodBaudRates::getRate(ui->baudRate->currentIndex()),
ui->squelchGate->value(), // in 10ths of ms
ui->squelch->value(),
ui->audioMute->isChecked());
ui->audioMute->isChecked(),
m_enableCosineFiltering);
}
}

View File

@ -65,6 +65,7 @@ private slots:
void on_demodGain_valueChanged(int value);
void on_volume_valueChanged(int value);
void on_baudRate_currentIndexChanged(int index);
void on_enableCosineFiltering_toggled(bool enable);
void on_fmDeviation_valueChanged(int value);
void on_squelchGate_valueChanged(int value);
void on_squelch_valueChanged(int value);
@ -96,6 +97,7 @@ private:
ScopeVis* m_scopeVis;
DSDDemod* m_dsdDemod;
bool m_enableCosineFiltering;
bool m_audioMute;
bool m_squelchOpen;
MovingAverage<Real> m_channelPowerDbAvg;

View File

@ -202,7 +202,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="inLevelText">
<widget class="QLabel" name="symbolSyncQualityText">
<property name="minimumSize">
<size>
<width>20</width>
@ -210,7 +210,7 @@
</size>
</property>
<property name="toolTip">
<string>Carrier input level (%) when synchronized</string>
<string>Symbol synchronization quality (%)</string>
</property>
<property name="text">
<string>00</string>
@ -220,25 +220,6 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="inCarrierPosText">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Carrier relative position (%) when synchronized</string>
</property>
<property name="text">
<string>-00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="zcPosText">
<property name="minimumSize">
@ -259,18 +240,51 @@
</widget>
</item>
<item>
<widget class="QLabel" name="symbolSyncQualityText">
<widget class="ButtonSwitch" name="enableCosineFiltering">
<property name="toolTip">
<string>Enable cosine filtering</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/dsb.png</normaloff>:/dsb.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="inCarrierPosText">
<property name="minimumSize">
<size>
<width>20</width>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Symbol synchronization quality (%)</string>
<string>Carrier relative position (%) when synchronized</string>
</property>
<property name="text">
<string>00</string>
<string>-00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="inLevelText">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Carrier input level (%) when synchronized</string>
</property>
<property name="text">
<string>000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -814,6 +828,11 @@
<header>gui/glscopegui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrbase/resources/res.qrc"/>