Skip to content

Commit

Permalink
Merge branch 'sultanqasim-pano_rel_bw_part' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
BatchDrake committed Aug 28, 2023
2 parents 3192d92 + 3c30d96 commit 1f3205b
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 20 deletions.
1 change: 1 addition & 0 deletions App/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ Application::onPanSpectrumStart(void)
this->scanMaxFreq = static_cast<SUFREQ>(freqMax);

config.setDevice(device);
config.setAntenna(this->mediator->getPanSpectrumAntenna().toStdString());
config.setSampleRate(
static_cast<unsigned int>(
this->mediator->getPanSpectrumPreferredSampleRate()));
Expand Down
59 changes: 42 additions & 17 deletions Components/PanoramicDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ PanoramicDialogConfig::deserialize(Suscan::Object const &conf)
LOAD(panRangeMax);
LOAD(lnbFreq);
LOAD(device);
LOAD(antenna);
LOAD(sampRate);
LOAD(strategy);
LOAD(partitioning);
Expand Down Expand Up @@ -107,8 +108,9 @@ PanoramicDialogConfig::serialize(void)
STORE(panRangeMin);
STORE(panRangeMax);
STORE(lnbFreq);
STORE(sampRate);
STORE(device);
STORE(antenna);
STORE(sampRate);
STORE(strategy);
STORE(partitioning);
STORE(palette);
Expand Down Expand Up @@ -177,6 +179,8 @@ PanoramicDialog::PanoramicDialog(QWidget *parent) :
this->ui->lnbDoubleSpinBox->setMinimum(-300e9);
this->ui->lnbDoubleSpinBox->setMaximum(300e9);

this->ui->waterfall->setUseLBMdrag(true);

this->connectAll();
}

Expand Down Expand Up @@ -317,11 +321,13 @@ unsigned int
PanoramicDialog::preferredRttMs(Suscan::Source::Device const &dev)
{
if (dev.getDriver() == "rtlsdr")
return 60;
return 75;
else if (dev.getDriver() == "airspy")
return 16;
else if (dev.getDriver() == "hackrf")
return 10;
else if (dev.getDriver() == "uhd")
return 8;

return 0;
}
Expand All @@ -333,6 +339,8 @@ PanoramicDialog::refreshUi(void)
bool fullRange = this->ui->fullRangeCheck->isChecked();

this->ui->deviceCombo->setEnabled(!this->running && !empty);
this->ui->antennaCombo->setEnabled(!this->running && !empty &&
this->ui->antennaCombo->count());
this->ui->fullRangeCheck->setEnabled(!this->running && !empty);
this->ui->rangeEndSpin->setEnabled(!this->running && !empty && !fullRange);
this->ui->rangeStartSpin->setEnabled(!this->running && !empty && !fullRange);
Expand Down Expand Up @@ -373,6 +381,12 @@ PanoramicDialog::setRunning(bool running)
this->refreshUi();
}

QString
PanoramicDialog::getAntenna(void) const
{
return this->ui->antennaCombo->currentText();
}

QString
PanoramicDialog::getStrategy(void) const
{
Expand All @@ -382,8 +396,6 @@ PanoramicDialog::getStrategy(void) const
QString
PanoramicDialog::getPartitioning(void) const
{
if (this->getStrategy() == QString("Progressive"))
return "Discrete";
return this->ui->partitioningCombo->currentText();
}

Expand Down Expand Up @@ -629,10 +641,11 @@ void
PanoramicDialog::saveConfig(void)
{
Suscan::Source::Device dev;
if (this->getSelectedDevice(dev)) {
this->dialogConfig->device = dev.getDesc();
this->dialogConfig->antenna = this->ui->antennaCombo->currentText().toStdString();
}

this->getSelectedDevice(dev);

this->dialogConfig->device = dev.getDesc();
this->dialogConfig->lnbFreq = this->ui->lnbDoubleSpinBox->value();
this->dialogConfig->palette = this->paletteGradient.toStdString();
this->dialogConfig->rangeMin = this->ui->rangeStartSpin->value();
Expand Down Expand Up @@ -874,7 +887,15 @@ PanoramicDialog::applyConfig(void)
this->ui->waterfall->setWaterfallRange(
this->dialogConfig->panRangeMin,
this->dialogConfig->panRangeMax);
this->ui->walkStrategyCombo->setCurrentText(QString::fromStdString(
this->dialogConfig->strategy));
this->ui->partitioningCombo->setCurrentText(QString::fromStdString(
this->dialogConfig->partitioning));
this->ui->deviceCombo->setCurrentText(QString::fromStdString(
this->dialogConfig->device));
this->onDeviceChanged();
this->ui->antennaCombo->setCurrentText(QString::fromStdString(
this->dialogConfig->antenna));
}

////////////////////////////// Slots //////////////////////////////////////
Expand All @@ -894,6 +915,16 @@ PanoramicDialog::onDeviceChanged(void)
this->ui->rangeStartSpin->setValue(dev.getMinFreq() + this->getLnbOffset());
this->ui->rangeEndSpin->setValue(dev.getMaxFreq() + this->getLnbOffset());
}

int curAntennaIndex = this->ui->antennaCombo->currentIndex();
this->ui->antennaCombo->clear();
for (auto i = dev.getFirstAntenna(); i != dev.getLastAntenna(); i++) {
this->ui->antennaCombo->addItem(QString::fromStdString(*i));
}
int antennaCount = this->ui->antennaCombo->count();
this->ui->antennaCombo->setEnabled(antennaCount > 0);
if (curAntennaIndex < antennaCount && curAntennaIndex >= 0)
this->ui->antennaCombo->setCurrentIndex(curAntennaIndex);
} else {
this->clearGains();
}
Expand Down Expand Up @@ -1038,9 +1069,9 @@ PanoramicDialog::onNewCenterFreq(qint64 freq)
qint64 span = this->currBw;
qint64 min = freq - span / 2;
qint64 max = freq + span / 2;
bool smallRange;
bool leftBorder = false;
bool rightBorder = false;

if (min <= this->getMinFreq()) {
leftBorder = true;
min = static_cast<qint64>(this->getMinFreq());
Expand All @@ -1051,19 +1082,16 @@ PanoramicDialog::onNewCenterFreq(qint64 freq)
max = static_cast<qint64>(this->getMaxFreq());
}

smallRange = static_cast<quint64>(max - min) <= this->minBwForZoom;

if (smallRange) {
if (rightBorder || leftBorder) {
if (leftBorder && !rightBorder) {
max = min + span;
} else if (rightBorder && !leftBorder) {
min = max - span;
}
}

if (rightBorder || leftBorder)
this->ui->waterfall->setCenterFreq(
static_cast<qint64>(.5 * (max + min)));
}

emit detailChanged(min, max, this->fixedFreqMode);
}
Expand All @@ -1077,10 +1105,7 @@ PanoramicDialog::onPaletteChanged(int)
void
PanoramicDialog::onStrategyChanged(int)
{
QString strategy = this->ui->walkStrategyCombo->currentText();

this->ui->partitioningCombo->setEnabled(strategy != QString("Progressive"));
emit strategyChanged(strategy);
emit strategyChanged(this->ui->walkStrategyCombo->currentText());
}

void
Expand Down
2 changes: 1 addition & 1 deletion Panoramic/Scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ Scanner::setRelativeBw(float ratio)
ratio = 2.f / SIGDIGGER_SCANNER_SPECTRUM_SIZE;

this->views[0].fftRelBw = this->views[1].fftRelBw = ratio;
this->relBw = ratio;
this->analyzer->setRelBandwidth(ratio);
}

SpectrumView &
Expand Down
7 changes: 7 additions & 0 deletions Suscan/Analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ Analyzer::setHopRange(SUFREQ min, SUFREQ max)
suscan_analyzer_set_hop_range(this->instance, min, max));
}

void
Analyzer::setRelBandwidth(SUFLOAT rel_bw)
{
SU_ATTEMPT(
suscan_analyzer_set_rel_bandwidth(this->instance, rel_bw));
}

void
Analyzer::setBufferingSize(SUSCOUNT len)
{
Expand Down
6 changes: 6 additions & 0 deletions UIMediator/PanoramicDialogMediator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ UIMediator::getPanSpectrumDevice(Suscan::Source::Device &dev) const
return this->ui->panoramicDialog->getSelectedDevice(dev);
}

QString
UIMediator::getPanSpectrumAntenna(void) const
{
return this->ui->panoramicDialog->getAntenna();
}

bool
UIMediator::getPanSpectrumRange(qint64 &min, qint64 &max) const
{
Expand Down
2 changes: 2 additions & 0 deletions include/PanoramicDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace SigDigger {
SUFREQ lnbFreq;
int sampRate = 20000000;
std::string device;
std::string antenna;
std::string strategy;
std::string partitioning;
std::string palette = "Turbo (Gqrx)";
Expand Down Expand Up @@ -134,6 +135,7 @@ namespace SigDigger {
void setMinBwForZoom(quint64 bw);
bool invalidRange(void) const;
bool getSelectedDevice(Suscan::Source::Device &) const;
QString getAntenna(void) const;
QString getStrategy(void) const;
QString getPartitioning(void) const;
float getGain(QString const &) const;
Expand Down
1 change: 0 additions & 1 deletion include/Scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ namespace SigDigger {
SUFREQ lnb;

bool fsGuessed = false;
float relBw = .5f;
unsigned int fs = 0;
unsigned int rtt = 15;
SpectrumView views[2];
Expand Down
1 change: 1 addition & 0 deletions include/Suscan/Analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ namespace Suscan {
void setIQReverse(bool reverse);
void setAGC(bool enabled);
void setHopRange(SUFREQ min, SUFREQ max);
void setRelBandwidth(SUFLOAT rel_bw);
void setBufferingSize(SUSCOUNT len);
void halt();

Expand Down
1 change: 1 addition & 0 deletions include/UIMediator.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ namespace SigDigger {

// panSpectrum functions
bool getPanSpectrumDevice(Suscan::Source::Device &) const;
QString getPanSpectrumAntenna(void) const;
bool getPanSpectrumRange(qint64 &min, qint64 &max) const;
unsigned int getPanSpectrumRttMs() const;
float getPanSpectrumRelBw() const;
Expand Down
15 changes: 14 additions & 1 deletion ui/PanoramicDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Antenna</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="label_11">
<property name="text">
Expand All @@ -104,9 +114,12 @@
</property>
</widget>
</item>
<item row="0" column="2" colspan="3">
<item row="0" column="2">
<widget class="QComboBox" name="deviceCombo"/>
</item>
<item row="0" column="4">
<widget class="QComboBox" name="antennaCombo"/>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
Expand Down

0 comments on commit 1f3205b

Please sign in to comment.