BladeRF2: generalize scale support in range queries

pull/638/head
f4exb 2020-09-14 23:19:05 +02:00
rodzic 54883699d4
commit 5e2d17399d
8 zmienionych plików z 58 dodań i 46 usunięć

Wyświetl plik

@ -316,7 +316,7 @@ void DeviceBladeRF2::closeTx(int channel)
}
}
void DeviceBladeRF2::getFrequencyRangeRx(uint64_t& min, uint64_t& max, int& step)
void DeviceBladeRF2::getFrequencyRangeRx(uint64_t& min, uint64_t& max, int& step, float& scale)
{
if (m_dev)
{
@ -335,11 +335,12 @@ void DeviceBladeRF2::getFrequencyRangeRx(uint64_t& min, uint64_t& max, int& step
min = range->min;
max = range->max;
step = range->step;
scale = range->scale;
}
}
}
void DeviceBladeRF2::getFrequencyRangeTx(uint64_t& min, uint64_t& max, int& step)
void DeviceBladeRF2::getFrequencyRangeTx(uint64_t& min, uint64_t& max, int& step, float& scale)
{
if (m_dev)
{
@ -358,11 +359,12 @@ void DeviceBladeRF2::getFrequencyRangeTx(uint64_t& min, uint64_t& max, int& step
min = range->min;
max = range->max;
step = range->step;
scale = range->scale;
}
}
}
void DeviceBladeRF2::getSampleRateRangeRx(int& min, int& max, int& step)
void DeviceBladeRF2::getSampleRateRangeRx(int& min, int& max, int& step, float& scale)
{
if (m_dev)
{
@ -381,11 +383,12 @@ void DeviceBladeRF2::getSampleRateRangeRx(int& min, int& max, int& step)
min = range->min;
max = range->max;
step = range->step;
scale = range->scale;
}
}
}
void DeviceBladeRF2::getSampleRateRangeTx(int& min, int& max, int& step)
void DeviceBladeRF2::getSampleRateRangeTx(int& min, int& max, int& step, float& scale)
{
if (m_dev)
{
@ -404,12 +407,13 @@ void DeviceBladeRF2::getSampleRateRangeTx(int& min, int& max, int& step)
min = range->min;
max = range->max;
step = range->step;
scale = range->scale;
}
}
}
void DeviceBladeRF2::getBandwidthRangeRx(int& min, int& max, int& step)
void DeviceBladeRF2::getBandwidthRangeRx(int& min, int& max, int& step, float& scale)
{
if (m_dev)
{
@ -428,11 +432,12 @@ void DeviceBladeRF2::getBandwidthRangeRx(int& min, int& max, int& step)
min = range->min;
max = range->max;
step = range->step;
scale = range->scale;
}
}
}
void DeviceBladeRF2::getBandwidthRangeTx(int& min, int& max, int& step)
void DeviceBladeRF2::getBandwidthRangeTx(int& min, int& max, int& step, float& scale)
{
if (m_dev)
{
@ -451,6 +456,7 @@ void DeviceBladeRF2::getBandwidthRangeTx(int& min, int& max, int& step)
min = range->min;
max = range->max;
step = range->step;
scale = range->scale;
}
}
}

Wyświetl plik

@ -41,12 +41,12 @@ public:
void closeRx(int channel);
void closeTx(int channel);
void getFrequencyRangeRx(uint64_t& min, uint64_t& max, int& step);
void getFrequencyRangeTx(uint64_t& min, uint64_t& max, int& step);
void getSampleRateRangeRx(int& min, int& max, int& step);
void getSampleRateRangeTx(int& min, int& max, int& step);
void getBandwidthRangeRx(int& min, int& max, int& step);
void getBandwidthRangeTx(int& min, int& max, int& step);
void getFrequencyRangeRx(uint64_t& min, uint64_t& max, int& step, float& scale);
void getFrequencyRangeTx(uint64_t& min, uint64_t& max, int& step, float& scale);
void getSampleRateRangeRx(int& min, int& max, int& step, float& scale);
void getSampleRateRangeTx(int& min, int& max, int& step, float& scale);
void getBandwidthRangeRx(int& min, int& max, int& step, float& scale);
void getBandwidthRangeTx(int& min, int& max, int& step, float& scale);
void getGlobalGainRangeRx(int& min, int& max, int& step, float& scale);
void getGlobalGainRangeTx(int& min, int& max, int& step, float& scale);
int getGainModesRx(const bladerf_gain_modes**);

Wyświetl plik

@ -556,24 +556,24 @@ bool BladeRF2Output::setDeviceCenterFrequency(struct bladerf *dev, int requested
}
}
void BladeRF2Output::getFrequencyRange(uint64_t& min, uint64_t& max, int& step)
void BladeRF2Output::getFrequencyRange(uint64_t& min, uint64_t& max, int& step, float& scale)
{
if (m_deviceShared.m_dev) {
m_deviceShared.m_dev->getFrequencyRangeTx(min, max, step);
m_deviceShared.m_dev->getFrequencyRangeTx(min, max, step, scale);
}
}
void BladeRF2Output::getSampleRateRange(int& min, int& max, int& step)
void BladeRF2Output::getSampleRateRange(int& min, int& max, int& step, float& scale)
{
if (m_deviceShared.m_dev) {
m_deviceShared.m_dev->getSampleRateRangeTx(min, max, step);
m_deviceShared.m_dev->getSampleRateRangeTx(min, max, step, scale);
}
}
void BladeRF2Output::getBandwidthRange(int& min, int& max, int& step)
void BladeRF2Output::getBandwidthRange(int& min, int& max, int& step, float& scale)
{
if (m_deviceShared.m_dev) {
m_deviceShared.m_dev->getBandwidthRangeTx(min, max, step);
m_deviceShared.m_dev->getBandwidthRangeTx(min, max, step, scale);
}
}
@ -1066,14 +1066,14 @@ void BladeRF2Output::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
float scale;
uint64_t f_min, f_max;
device->getBandwidthRangeTx(min, max, step);
device->getBandwidthRangeTx(min, max, step, scale);
response.getBladeRf2OutputReport()->setBandwidthRange(new SWGSDRangel::SWGRange);
response.getBladeRf2OutputReport()->getBandwidthRange()->setMin(min);
response.getBladeRf2OutputReport()->getBandwidthRange()->setMax(max);
response.getBladeRf2OutputReport()->getBandwidthRange()->setStep(step);
device->getFrequencyRangeTx(f_min, f_max, step);
device->getFrequencyRangeTx(f_min, f_max, step, scale);
response.getBladeRf2OutputReport()->setFrequencyRange(new SWGSDRangel::SWGFrequencyRange);
response.getBladeRf2OutputReport()->getFrequencyRange()->setMin(f_min);
@ -1087,7 +1087,7 @@ void BladeRF2Output::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
response.getBladeRf2OutputReport()->getGlobalGainRange()->setMax(max);
response.getBladeRf2OutputReport()->getGlobalGainRange()->setStep(step);
device->getSampleRateRangeTx(min, max, step);
device->getSampleRateRangeTx(min, max, step, scale);
response.getBladeRf2OutputReport()->setSampleRateRange(new SWGSDRangel::SWGRange);
response.getBladeRf2OutputReport()->getSampleRateRange()->setMin(min);

Wyświetl plik

@ -126,9 +126,9 @@ public:
virtual quint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
void getFrequencyRange(uint64_t& min, uint64_t& max, int& step);
void getSampleRateRange(int& min, int& max, int& step);
void getBandwidthRange(int& min, int& max, int& step);
void getFrequencyRange(uint64_t& min, uint64_t& max, int& step, float& scale);
void getSampleRateRange(int& min, int& max, int& step, float& scale);
void getBandwidthRange(int& min, int& max, int& step, float& scale);
void getGlobalGainRange(int& min, int& max, int& step, float& scale);
virtual bool handleMessage(const Message& message);

Wyświetl plik

@ -45,21 +45,22 @@ BladeRF2OutputGui::BladeRF2OutputGui(DeviceUISet *deviceUISet, QWidget* parent)
{
m_sampleSink = (BladeRF2Output*) m_deviceUISet->m_deviceAPI->getSampleSink();
int max, min, step;
float scale;
uint64_t f_min, f_max;
ui->setupUi(this);
m_sampleSink->getFrequencyRange(f_min, f_max, step);
m_sampleSink->getFrequencyRange(f_min, f_max, step, scale);
qDebug("BladeRF2OutputGui::BladeRF2OutputGui: getFrequencyRange: [%lu,%lu] step: %d", f_min, f_max, step);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->centerFrequency->setValueRange(7, f_min/1000, f_max/1000);
m_sampleSink->getSampleRateRange(min, max, step);
m_sampleSink->getSampleRateRange(min, max, step, scale);
qDebug("BladeRF2OutputGui::BladeRF2OutputGui: getSampleRateRange: [%d,%d] step: %d", min, max, step);
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
ui->sampleRate->setValueRange(8, min, max);
m_sampleSink->getBandwidthRange(min, max, step);
m_sampleSink->getBandwidthRange(min, max, step, scale);
qDebug("BladeRF2OutputGui::BladeRF2OutputGui: getBandwidthRange: [%d,%d] step: %d", min, max, step);
ui->bandwidth->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
ui->bandwidth->setValueRange(5, min/1000, max/1000);
@ -146,8 +147,9 @@ void BladeRF2OutputGui::updateFrequencyLimits()
// values in kHz
uint64_t f_min, f_max;
int step;
float scale;
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
m_sampleSink->getFrequencyRange(f_min, f_max, step);
m_sampleSink->getFrequencyRange(f_min, f_max, step, scale);
qint64 minLimit = f_min/1000 + deltaFrequency;
qint64 maxLimit = f_max/1000 + deltaFrequency;
@ -251,7 +253,8 @@ void BladeRF2OutputGui::updateSampleRateAndFrequency()
void BladeRF2OutputGui::displaySampleRate()
{
int max, min, step;
m_sampleSink->getSampleRateRange(min, max, step);
float scale;
m_sampleSink->getSampleRateRange(min, max, step, scale);
ui->sampleRate->blockSignals(true);

Wyświetl plik

@ -570,24 +570,24 @@ bool BladeRF2Input::setDeviceCenterFrequency(struct bladerf *dev, int requestedC
}
}
void BladeRF2Input::getFrequencyRange(uint64_t& min, uint64_t& max, int& step)
void BladeRF2Input::getFrequencyRange(uint64_t& min, uint64_t& max, int& step, float& scale)
{
if (m_deviceShared.m_dev) {
m_deviceShared.m_dev->getFrequencyRangeRx(min, max, step);
m_deviceShared.m_dev->getFrequencyRangeRx(min, max, step, scale);
}
}
void BladeRF2Input::getSampleRateRange(int& min, int& max, int& step)
void BladeRF2Input::getSampleRateRange(int& min, int& max, int& step, float& scale)
{
if (m_deviceShared.m_dev) {
m_deviceShared.m_dev->getSampleRateRangeRx(min, max, step);
m_deviceShared.m_dev->getSampleRateRangeRx(min, max, step, scale);
}
}
void BladeRF2Input::getBandwidthRange(int& min, int& max, int& step)
void BladeRF2Input::getBandwidthRange(int& min, int& max, int& step, float& scale)
{
if (m_deviceShared.m_dev) {
m_deviceShared.m_dev->getBandwidthRangeRx(min, max, step);
m_deviceShared.m_dev->getBandwidthRangeRx(min, max, step, scale);
}
}
@ -1158,14 +1158,14 @@ void BladeRF2Input::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
float scale;
uint64_t f_min, f_max;
device->getBandwidthRangeRx(min, max, step);
device->getBandwidthRangeRx(min, max, step, scale);
response.getBladeRf2InputReport()->setBandwidthRange(new SWGSDRangel::SWGRange);
response.getBladeRf2InputReport()->getBandwidthRange()->setMin(min);
response.getBladeRf2InputReport()->getBandwidthRange()->setMax(max);
response.getBladeRf2InputReport()->getBandwidthRange()->setStep(step);
device->getFrequencyRangeRx(f_min, f_max, step);
device->getFrequencyRangeRx(f_min, f_max, step, scale);
response.getBladeRf2InputReport()->setFrequencyRange(new SWGSDRangel::SWGFrequencyRange);
response.getBladeRf2InputReport()->getFrequencyRange()->setMin(f_min);
@ -1179,7 +1179,7 @@ void BladeRF2Input::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
response.getBladeRf2InputReport()->getGlobalGainRange()->setMax(max);
response.getBladeRf2InputReport()->getGlobalGainRange()->setStep(step);
device->getSampleRateRangeRx(min, max, step);
device->getSampleRateRangeRx(min, max, step, scale);
response.getBladeRf2InputReport()->setSampleRateRange(new SWGSDRangel::SWGRange);
response.getBladeRf2InputReport()->getSampleRateRange()->setMin(min);

Wyświetl plik

@ -134,9 +134,9 @@ public:
virtual quint64 getCenterFrequency() const;
virtual void setCenterFrequency(qint64 centerFrequency);
void getFrequencyRange(uint64_t& min, uint64_t& max, int& step);
void getSampleRateRange(int& min, int& max, int& step);
void getBandwidthRange(int& min, int& max, int& step);
void getFrequencyRange(uint64_t& min, uint64_t& max, int& step, float& scale);
void getSampleRateRange(int& min, int& max, int& step, float& scale);
void getBandwidthRange(int& min, int& max, int& step, float& scale);
void getGlobalGainRange(int& min, int& max, int& step, float& scale);
const std::vector<GainMode>& getGainModes() { return m_gainModes; }

Wyświetl plik

@ -47,19 +47,20 @@ BladeRF2InputGui::BladeRF2InputGui(DeviceUISet *deviceUISet, QWidget* parent) :
{
m_sampleSource = (BladeRF2Input*) m_deviceUISet->m_deviceAPI->getSampleSource();
int max, min, step;
float scale;
uint64_t f_min, f_max;
ui->setupUi(this);
m_sampleSource->getFrequencyRange(f_min, f_max, step);
m_sampleSource->getFrequencyRange(f_min, f_max, step, scale);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->centerFrequency->setValueRange(7, f_min/1000, f_max/1000);
m_sampleSource->getSampleRateRange(min, max, step);
m_sampleSource->getSampleRateRange(min, max, step, scale);
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
ui->sampleRate->setValueRange(8, min, max);
m_sampleSource->getBandwidthRange(min, max, step);
m_sampleSource->getBandwidthRange(min, max, step, scale);
ui->bandwidth->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
ui->bandwidth->setValueRange(5, min/1000, max/1000);
@ -159,8 +160,9 @@ void BladeRF2InputGui::updateFrequencyLimits()
// values in kHz
uint64_t f_min, f_max;
int step;
float scale;
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
m_sampleSource->getFrequencyRange(f_min, f_max, step);
m_sampleSource->getFrequencyRange(f_min, f_max, step, scale);
qint64 minLimit = f_min/1000 + deltaFrequency;
qint64 maxLimit = f_max/1000 + deltaFrequency;
@ -264,7 +266,8 @@ void BladeRF2InputGui::updateSampleRateAndFrequency()
void BladeRF2InputGui::displaySampleRate()
{
int max, min, step;
m_sampleSource->getSampleRateRange(min, max, step);
float scale;
m_sampleSource->getSampleRateRange(min, max, step, scale);
ui->sampleRate->blockSignals(true);
displayFcTooltip();