Channel Analyzer NG: better handle the LSB case

pull/60/head
f4exb 2017-07-28 17:21:46 +02:00
rodzic f6bdf35589
commit a0fd763002
5 zmienionych plików z 102 dodań i 82 usunięć

Wyświetl plik

@ -219,22 +219,16 @@ void ChannelAnalyzerNGGUI::on_BW_valueChanged(int value)
if (ui->ssb->isChecked())
{
if (value < 0) {
m_channelMarker.setSidebands(ChannelMarker::lsb);
} else {
m_channelMarker.setSidebands(ChannelMarker::usb);
}
QString s = QString::number(value/10.0, 'f', 1);
ui->BWText->setText(tr("%1k").arg(s));
}
else
{
m_channelMarker.setSidebands(ChannelMarker::dsb);
QString s = QString::number(value/5.0, 'f', 1); // BW = value * 2
ui->BWText->setText(tr("%1k").arg(s));
}
displayBandwidth();
on_lowCut_valueChanged(m_channelMarker.getLowCutoff()/100);
}
@ -283,44 +277,38 @@ void ChannelAnalyzerNGGUI::on_spanLog2_currentIndexChanged(int index)
void ChannelAnalyzerNGGUI::on_ssb_toggled(bool checked)
{
setFiltersUIBoundaries();
int bw = m_channelMarker.getBandwidth();
//int bw = m_channelMarker.getBandwidth();
if (checked)
{
QString s = QString::number(bw/2000.0, 'f', 1); // bw/2
setFiltersUIBoundaries();
ui->BWLabel->setText("LP");
QString s = QString::number(ui->BW->value()/10.0, 'f', 1); // bw/2
ui->BWText->setText(tr("%1k").arg(s));
if (ui->BW->value() < 0) {
m_channelMarker.setSidebands(ChannelMarker::lsb);
} else {
m_channelMarker.setSidebands(ChannelMarker::usb);
}
ui->glSpectrum->setCenterFrequency(m_rate/4);
ui->glSpectrum->setSampleRate(m_rate/2);
ui->glSpectrum->setSsbSpectrum(true);
on_lowCut_valueChanged(m_channelMarker.getLowCutoff()/100);
ui->lowCut->setEnabled(true);
}
else
{
QString s = QString::number(bw/1000.0, 'f', 1); // bw
if (ui->BW->value() < 0) {
ui->BW->setValue(-ui->BW->value());
}
setFiltersUIBoundaries();
//m_channelMarker.setBandwidth(ui->BW->value() * 200.0);
ui->BWLabel->setText("BP");
QString s = QString::number(ui->BW->value()/5.0, 'f', 1); // bw
ui->BWText->setText(tr("%1k").arg(s));
ui->lowCut->setEnabled(false);
m_channelMarker.setSidebands(ChannelMarker::dsb);
ui->glSpectrum->setCenterFrequency(0);
ui->glSpectrum->setSampleRate(m_rate);
ui->glSpectrum->setSsbSpectrum(false);
applySettings();
ui->lowCut->setValue(0);
ui->lowCutText->setText("0.0k");
}
applySettings();
displayBandwidth();
}
void ChannelAnalyzerNGGUI::onWidgetRolled(QWidget* widget __attribute__((unused)), bool rollDown __attribute__((unused)))
@ -377,7 +365,9 @@ ChannelAnalyzerNGGUI::ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceSourceAPI
ui->glSpectrum->setSampleRate(m_rate);
ui->glSpectrum->setDisplayWaterfall(true);
ui->glSpectrum->setDisplayMaxHold(true);
ui->glSpectrum->setSsbSpectrum(true);
ui->glSpectrum->setSsbSpectrum(false);
ui->glSpectrum->setLsbDisplay(false);
ui->BWLabel->setText("BP");
ui->glSpectrum->connectTimer(m_pluginAPI->getMainWindow()->getMasterTimer());
ui->glScope->connectTimer(m_pluginAPI->getMainWindow()->getMasterTimer());
@ -439,26 +429,7 @@ bool ChannelAnalyzerNGGUI::setNewFinalRate(int spanLog2)
QString s = QString::number(m_rate/1000.0, 'f', 1);
ui->spanText->setText(tr("%1 kS/s").arg(s));
if (ui->ssb->isChecked())
{
if (ui->BW->value() < 0) {
m_channelMarker.setSidebands(ChannelMarker::lsb);
} else {
m_channelMarker.setSidebands(ChannelMarker::usb);
}
ui->glSpectrum->setCenterFrequency(m_rate/4);
ui->glSpectrum->setSampleRate(m_rate/2);
ui->glSpectrum->setSsbSpectrum(true);
}
else
{
m_channelMarker.setSidebands(ChannelMarker::dsb);
ui->glSpectrum->setCenterFrequency(0);
ui->glSpectrum->setSampleRate(m_rate);
ui->glSpectrum->setSsbSpectrum(false);
}
displayBandwidth();
ui->glScope->setSampleRate(m_rate);
m_scopeVis->setSampleRate(m_rate);
@ -466,6 +437,38 @@ bool ChannelAnalyzerNGGUI::setNewFinalRate(int spanLog2)
return true;
}
void ChannelAnalyzerNGGUI::displayBandwidth()
{
if (ui->ssb->isChecked())
{
if (ui->BW->value() < 0)
{
m_channelMarker.setSidebands(ChannelMarker::lsb);
ui->glSpectrum->setLsbDisplay(true);
}
else
{
m_channelMarker.setSidebands(ChannelMarker::usb);
ui->glSpectrum->setLsbDisplay(false);
}
ui->glSpectrum->setCenterFrequency(m_rate/4);
ui->glSpectrum->setSampleRate(m_rate/2);
ui->glSpectrum->setSsbSpectrum(true);
}
else
{
m_channelMarker.setSidebands(ChannelMarker::dsb);
ui->glSpectrum->setCenterFrequency(0);
ui->glSpectrum->setSampleRate(m_rate);
ui->glSpectrum->setLsbDisplay(false);
ui->glSpectrum->setSsbSpectrum(false);
}
}
void ChannelAnalyzerNGGUI::setFiltersUIBoundaries()
{
if (ui->BW->value() < -m_rate/200) {

Wyświetl plik

@ -98,6 +98,7 @@ private:
void blockApplySettings(bool block);
void applySettings();
void displayBandwidth();
void leaveEvent(QEvent*);
void enterEvent(QEvent*);

Wyświetl plik

@ -332,8 +332,14 @@
<layout class="QHBoxLayout" name="BWLayout">
<item>
<widget class="QLabel" name="BWLabel">
<property name="minimumSize">
<size>
<width>10</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>LP</string>
<string>BP</string>
</property>
</widget>
</item>
@ -394,6 +400,12 @@
</item>
<item>
<widget class="QLabel" name="lowCutLabel">
<property name="minimumSize">
<size>
<width>10</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>HP</string>
</property>
@ -553,17 +565,6 @@
</widget>
</widget>
<customwidgets>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>RollupWidget</class>
<extends>QWidget</extends>
@ -582,6 +583,23 @@
<header>gui/glspectrumgui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>GLScopeNG</class>
<extends>QWidget</extends>
@ -594,12 +612,6 @@
<header>gui/glscopenggui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrbase/resources/res.qrc"/>
@ -631,8 +643,6 @@
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
</resources>
<connections/>
</ui>

Wyświetl plik

@ -22,7 +22,7 @@
const PluginDescriptor ChannelAnalyzerNGPlugin::m_pluginDescriptor = {
QString("Channel Analyzer NG"),
QString("3.5.0"),
QString("3.5.3"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

Wyświetl plik

@ -57,27 +57,33 @@ This is the resulting sample rate that will be used by the spectrum and scope vi
Average total power in dB relative to a +/- 1.0 amplitude signal received in the pass band.
<h3>8. Select bandpass filter cut-off frequency</h3>
<h3>8. Select lowpass filter cut-off frequency</h3>
This slider controls the cut-off frequency of the bandpass filter (or lowpass filter in SSB mode - see next) applied before the signal is sent to the spectrum and scope
In SSB mode this filter is a complex filter that can lowpass on either side of the center frequency. It is therefore labeled as "LP". For negative frequencies (LSB) the cut-off frequency is therefore negative. In fact setting a negative frequency in SSB mode automatically turns on the LSB mode processing and the spectrum is reversed.
<h3>9. Bandpass filter cut-off frequency</h3>
In normal (DSB) mode this filter is a real filter that lowpass on both sides of the zero (center) frequency symmetrically. Therefore it acts as a badpass filter centered on the zero frequency and therefore it is labeled as "BP". The value displayed in (9) is the full bandwidth of the filter.
This is the cut-off frequency of the bandpass filter in kHz
<h3>9. Lowpass filter cut-off frequency</h3>
In SSB mode this is the complex cut-off frequency and is negative for LSB.
In normal (DSB) mode this is the full bandwidth of the real lowpass filter centered around zero frequency.
<h3>10. SSB filtering</h3>
When this toggle is engaged the signal is filtered either above (USB) or below (LSB) the channel center frequency. The bandpass filter now acts as a lowpass filter and the highpass filter gets active. The sideband is selected upon the sign of the bandpass filter: if positive the USB is selected else the LSB.
When this toggle is engaged the signal is filtered either above (USB) or below (LSB) the channel center frequency. The sideband is selected according to the sign of the lowpass filter cut-off frequency (8): if positive the USB is selected else the LSB. In LSB mode the spectrum is reversed.
When SSB is off the lowpass filter is not active and the lowpass filter is actually a bandpass filter around the channel center frequency.
When SSB is off the lowpass filter is actually a bandpass filter around the channel center frequency.
<h3>11. Select highpass filter cut-off frequency</h3>
When the SSB feature is engaged this controls the cut-off frequency of the highpass filter
In SSB mode this controls the cut-off frequency of the complex highpass filter which is the filter closest to the zero frequency. This cut-off frquency is always at least 0.1 kHz in absolute value below the lowpass filter cut-off frequency (8).
In normal (DSB) mode this filter is not active.
<h3>12. Hghpass filter cut-off frequency</h3>
This is the cut-off frequency of the highpass filter in kHz
This is the cut-off frequency of the highpass filter in kHz. It is zero or negative in LSB mode.
<h2>D. Scope global controls line</h2>