1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-27 15:26:33 -04:00

Channel Analyzer NG: enhanced filter cutoff handling

This commit is contained in:
f4exb 2017-02-28 01:30:12 +01:00
parent d2727708e9
commit 1c04f3f11e
3 changed files with 52 additions and 33 deletions

View File

@ -263,6 +263,8 @@ void ChannelAnalyzerNGGUI::on_spanLog2_currentIndexChanged(int index)
void ChannelAnalyzerNGGUI::on_ssb_toggled(bool checked) void ChannelAnalyzerNGGUI::on_ssb_toggled(bool checked)
{ {
setFiltersUIBoundaries();
if (checked) if (checked)
{ {
if (ui->BW->value() < 0) { if (ui->BW->value() < 0) {
@ -276,9 +278,13 @@ void ChannelAnalyzerNGGUI::on_ssb_toggled(bool checked)
ui->glSpectrum->setSsbSpectrum(true); ui->glSpectrum->setSsbSpectrum(true);
on_lowCut_valueChanged(m_channelMarker.getLowCutoff()/100); on_lowCut_valueChanged(m_channelMarker.getLowCutoff()/100);
ui->lowCut->setEnabled(true);
} }
else else
{ {
ui->lowCut->setEnabled(false);
m_channelMarker.setSidebands(ChannelMarker::dsb); m_channelMarker.setSidebands(ChannelMarker::dsb);
ui->glSpectrum->setCenterFrequency(0); ui->glSpectrum->setCenterFrequency(0);
@ -397,29 +403,10 @@ bool ChannelAnalyzerNGGUI::setNewRate(int spanLog2)
//m_rate = 48000 / (1<<spanLog2); //m_rate = 48000 / (1<<spanLog2);
m_rate = m_channelAnalyzer->getSampleRate() / (1<<spanLog2); m_rate = m_channelAnalyzer->getSampleRate() / (1<<spanLog2);
if (ui->BW->value() < -m_rate/200) { setFiltersUIBoundaries();
ui->BW->setValue(-m_rate/200);
m_channelMarker.setBandwidth(-m_rate*2);
} else if (ui->BW->value() > m_rate/200) {
ui->BW->setValue(m_rate/200);
m_channelMarker.setBandwidth(m_rate*2);
}
if (ui->lowCut->value() < -m_rate/200) {
ui->lowCut->setValue(-m_rate/200);
m_channelMarker.setLowCutoff(-m_rate);
} else if (ui->lowCut->value() > m_rate/200) {
ui->lowCut->setValue(m_rate/200);
m_channelMarker.setLowCutoff(m_rate);
}
ui->BW->setMinimum(-m_rate/200);
ui->lowCut->setMinimum(-m_rate/200);
ui->BW->setMaximum(m_rate/200);
ui->lowCut->setMaximum(m_rate/200);
QString s = QString::number(m_rate/1000.0, 'f', 1); QString s = QString::number(m_rate/1000.0, 'f', 1);
ui->spanText->setText(tr("%1k").arg(s)); ui->spanText->setText(tr("%1 kS/s").arg(s));
if (ui->ssb->isChecked()) if (ui->ssb->isChecked())
{ {
@ -448,6 +435,37 @@ bool ChannelAnalyzerNGGUI::setNewRate(int spanLog2)
return true; return true;
} }
void ChannelAnalyzerNGGUI::setFiltersUIBoundaries()
{
if (ui->BW->value() < -m_rate/200) {
ui->BW->setValue(-m_rate/200);
m_channelMarker.setBandwidth(-m_rate*2);
} else if (ui->BW->value() > m_rate/200) {
ui->BW->setValue(m_rate/200);
m_channelMarker.setBandwidth(m_rate*2);
}
if (ui->lowCut->value() < -m_rate/200) {
ui->lowCut->setValue(-m_rate/200);
m_channelMarker.setLowCutoff(-m_rate);
} else if (ui->lowCut->value() > m_rate/200) {
ui->lowCut->setValue(m_rate/200);
m_channelMarker.setLowCutoff(m_rate);
}
if (ui->ssb->isChecked()) {
ui->BW->setMinimum(-m_rate/200);
ui->lowCut->setMinimum(-m_rate/200);
} else {
ui->BW->setMinimum(0);
ui->lowCut->setMinimum(-m_rate/200);
ui->lowCut->setValue(0);
}
ui->BW->setMaximum(m_rate/200);
ui->lowCut->setMaximum(m_rate/200);
}
void ChannelAnalyzerNGGUI::blockApplySettings(bool block) void ChannelAnalyzerNGGUI::blockApplySettings(bool block)
{ {
ui->glScope->blockSignals(block); ui->glScope->blockSignals(block);

View File

@ -92,6 +92,7 @@ private:
int getEffectiveLowCutoff(int lowCutoff); int getEffectiveLowCutoff(int lowCutoff);
bool setNewRate(int spanLog2); bool setNewRate(int spanLog2);
void setFiltersUIBoundaries();
void blockApplySettings(bool block); void blockApplySettings(bool block);
void applySettings(); void applySettings();

View File

@ -240,7 +240,7 @@
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Channel downsampling</string> <string>Channel decimation</string>
</property> </property>
<item> <item>
<property name="text"> <property name="text">
@ -387,6 +387,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="ssb">
<property name="toolTip">
<string>SSB/DSB togggle</string>
</property>
<property name="text">
<string>SSB</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="lowCutLabel"> <widget class="QLabel" name="lowCutLabel">
<property name="text"> <property name="text">
@ -432,16 +442,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="ssb">
<property name="toolTip">
<string>SSB/DSB togggle</string>
</property>
<property name="text">
<string>SSB</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>