From a0fd763002a9fec965040d42e243d239ee6e3408 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 28 Jul 2017 17:21:46 +0200 Subject: [PATCH] Channel Analyzer NG: better handle the LSB case --- .../chanalyzerng/chanalyzernggui.cpp | 109 +++++++++--------- .../channelrx/chanalyzerng/chanalyzernggui.h | 1 + .../channelrx/chanalyzerng/chanalyzernggui.ui | 50 ++++---- .../chanalyzerng/chanalyzerngplugin.cpp | 2 +- plugins/channelrx/chanalyzerng/readme.md | 22 ++-- 5 files changed, 102 insertions(+), 82 deletions(-) diff --git a/plugins/channelrx/chanalyzerng/chanalyzernggui.cpp b/plugins/channelrx/chanalyzerng/chanalyzernggui.cpp index 6b73e9bd2..d71ac0855 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzernggui.cpp +++ b/plugins/channelrx/chanalyzerng/chanalyzernggui.cpp @@ -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) { diff --git a/plugins/channelrx/chanalyzerng/chanalyzernggui.h b/plugins/channelrx/chanalyzerng/chanalyzernggui.h index 2e124bd6f..b81c1f31d 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzernggui.h +++ b/plugins/channelrx/chanalyzerng/chanalyzernggui.h @@ -98,6 +98,7 @@ private: void blockApplySettings(bool block); void applySettings(); + void displayBandwidth(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/chanalyzerng/chanalyzernggui.ui b/plugins/channelrx/chanalyzerng/chanalyzernggui.ui index ec3fd93c5..3844b941b 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzernggui.ui +++ b/plugins/channelrx/chanalyzerng/chanalyzernggui.ui @@ -332,8 +332,14 @@ + + + 10 + 0 + + - LP + BP @@ -394,6 +400,12 @@ + + + 10 + 0 + + HP @@ -553,17 +565,6 @@ - - ValueDial - QWidget -
gui/valuedial.h
- 1 -
- - ButtonSwitch - QToolButton -
gui/buttonswitch.h
-
RollupWidget QWidget @@ -582,6 +583,23 @@
gui/glspectrumgui.h
1
+ + ValueDialZ + QWidget +
gui/valuedialz.h
+ 1 +
+ + ValueDial + QWidget +
gui/valuedial.h
+ 1 +
+ + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
GLScopeNG QWidget @@ -594,12 +612,6 @@
gui/glscopenggui.h
1
- - ValueDialZ - QWidget -
gui/valuedialz.h
- 1 -
@@ -631,8 +643,6 @@ - - diff --git a/plugins/channelrx/chanalyzerng/chanalyzerngplugin.cpp b/plugins/channelrx/chanalyzerng/chanalyzerngplugin.cpp index 5758f9788..ea3911b02 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzerngplugin.cpp +++ b/plugins/channelrx/chanalyzerng/chanalyzerngplugin.cpp @@ -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, diff --git a/plugins/channelrx/chanalyzerng/readme.md b/plugins/channelrx/chanalyzerng/readme.md index 9f567ab90..ce2ac81cc 100644 --- a/plugins/channelrx/chanalyzerng/readme.md +++ b/plugins/channelrx/chanalyzerng/readme.md @@ -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. -

8. Select bandpass filter cut-off frequency

+

8. Select lowpass filter cut-off frequency

-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. -

9. Bandpass filter cut-off frequency

+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 +

9. Lowpass filter cut-off frequency

+ +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.

10. SSB filtering

-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.

11. Select highpass filter cut-off frequency

-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.

12. Hghpass filter cut-off frequency

-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.

D. Scope global controls line