mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 14:04:46 -04:00
BladeRF2: generalize scale support in range queries
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user