diff --git a/plugins/samplesink/bladerf2output/bladerf2output.cpp b/plugins/samplesink/bladerf2output/bladerf2output.cpp index 83a58081f..fe1d38575 100644 --- a/plugins/samplesink/bladerf2output/bladerf2output.cpp +++ b/plugins/samplesink/bladerf2output/bladerf2output.cpp @@ -48,19 +48,6 @@ BladeRF2Output::BladeRF2Output(DeviceSinkAPI *deviceAPI) : m_running(false) { openDevice(); - - if (m_deviceShared.m_dev) - { - const bladerf_gain_modes *modes = 0; - int nbModes = m_deviceShared.m_dev->getGainModesRx(&modes); - - if (modes) - { - for (int i = 0; i < nbModes; i++) { - m_gainModes.push_back(GainMode{QString(modes[i].name), modes[i].mode}); - } - } - } } BladeRF2Output::~BladeRF2Output() @@ -948,18 +935,6 @@ void BladeRF2Output::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp response.getBladeRf2OutputReport()->getSampleRateRange()->setMin(min); response.getBladeRf2OutputReport()->getSampleRateRange()->setMax(max); response.getBladeRf2OutputReport()->getSampleRateRange()->setStep(step); - - response.getBladeRf2OutputReport()->setGainModes(new QList); - - const std::vector& modes = getGainModes(); - std::vector::const_iterator it = modes.begin(); - - for (; it != modes.end(); ++it) - { - response.getBladeRf2OutputReport()->getGainModes()->append(new SWGSDRangel::SWGNamedEnum); - response.getBladeRf2OutputReport()->getGainModes()->back()->setName(new QString(it->m_name)); - response.getBladeRf2OutputReport()->getGainModes()->back()->setValue(it->m_value); - } } } diff --git a/plugins/samplesink/bladerf2output/bladerf2output.h b/plugins/samplesink/bladerf2output/bladerf2output.h index f67e79165..3aa11401b 100644 --- a/plugins/samplesink/bladerf2output/bladerf2output.h +++ b/plugins/samplesink/bladerf2output/bladerf2output.h @@ -97,12 +97,6 @@ public: {} }; - struct GainMode - { - QString m_name; - int m_value; - }; - BladeRF2Output(DeviceSinkAPI *deviceAPI); virtual ~BladeRF2Output(); virtual void destroy(); @@ -126,7 +120,6 @@ public: void getSampleRateRange(int& min, int& max, int& step); void getBandwidthRange(int& min, int& max, int& step); void getGlobalGainRange(int& min, int& max, int& step); - const std::vector& getGainModes() { return m_gainModes; } virtual bool handleMessage(const Message& message); @@ -170,7 +163,6 @@ private: QString m_deviceDescription; DeviceBladeRF2Shared m_deviceShared; bool m_running; - std::vector m_gainModes; }; #endif /* PLUGINS_SAMPLESINK_BLADERF2OUTPUT_BLADERF2OUTPUT_H_ */ diff --git a/plugins/samplesink/bladerf2output/bladerf2outputgui.cpp b/plugins/samplesink/bladerf2output/bladerf2outputgui.cpp index 560d22752..446930cb5 100644 --- a/plugins/samplesink/bladerf2output/bladerf2outputgui.cpp +++ b/plugins/samplesink/bladerf2output/bladerf2outputgui.cpp @@ -46,33 +46,26 @@ BladeRF2OutputGui::BladeRF2OutputGui(DeviceUISet *deviceUISet, QWidget* parent) ui->setupUi(this); m_sampleSink->getFrequencyRange(f_min, f_max, step); + 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); + 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); + 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); - const std::vector& modes = m_sampleSink->getGainModes(); - std::vector::const_iterator it = modes.begin(); - - ui->gainMode->blockSignals(true); - - for (; it != modes.end(); ++it) { - ui->gainMode->addItem(it->m_name); - } - - ui->gainMode->blockSignals(false); - m_sampleSink->getGlobalGainRange(min, max, step); - ui->gain->setMinimum(min); - ui->gain->setMaximum(max); - ui->gain->setPageStep(step); - ui->gain->setSingleStep(step); + qDebug("BladeRF2OutputGui::BladeRF2OutputGui: getGlobalGainRange: [%d,%d] step: %d", min, max, step); + ui->gain->setMinimum((min-max)/1000); + ui->gain->setMaximum(0); + ui->gain->setPageStep(1); + ui->gain->setSingleStep(1); ui->label_decim->setText(QString::fromUtf8("I\u2191")); @@ -152,10 +145,10 @@ bool BladeRF2OutputGui::handleMessage(const Message& message) blockApplySettings(true); int min, max, step; m_sampleSink->getGlobalGainRange(min, max, step); - ui->gain->setMinimum(min); - ui->gain->setMaximum(max); - ui->gain->setPageStep(step); - ui->gain->setSingleStep(step); + ui->gain->setMinimum((min-max)/1000); + ui->gain->setMaximum(0); + ui->gain->setPageStep(1); + ui->gain->setSingleStep(1); displaySettings(); blockApplySettings(false); @@ -164,10 +157,10 @@ bool BladeRF2OutputGui::handleMessage(const Message& message) else if (BladeRF2Output::MsgReportGainRange::match(message)) { const BladeRF2Output::MsgReportGainRange& cfg = (BladeRF2Output::MsgReportGainRange&) message; - ui->gain->setMinimum(cfg.getMin()); - ui->gain->setMaximum(cfg.getMax()); - ui->gain->setSingleStep(cfg.getStep()); - ui->gain->setPageStep(cfg.getStep()); + ui->gain->setMinimum((cfg.getMin()-cfg.getMax())/1000); + ui->gain->setMaximum(0); + ui->gain->setSingleStep(1); + ui->gain->setPageStep(1); return true; } @@ -234,12 +227,6 @@ void BladeRF2OutputGui::displaySettings() ui->gainText->setText(tr("%1 dB").arg(m_settings.m_globalGain)); ui->gain->setValue(m_settings.m_globalGain); - if (m_settings.m_gainMode == BLADERF_GAIN_MANUAL) { - ui->gain->setEnabled(true); - } else { - ui->gain->setEnabled(false); - } - blockApplySettings(false); } @@ -281,31 +268,6 @@ void BladeRF2OutputGui::on_interp_currentIndexChanged(int index) sendSettings(); } -void BladeRF2OutputGui::on_gainMode_currentIndexChanged(int index) -{ - const std::vector& modes = m_sampleSink->getGainModes(); - unsigned int uindex = index < 0 ? 0 : (unsigned int) index; - - if (uindex < modes.size()) - { - BladeRF2Output::GainMode mode = modes[index]; - - if (m_settings.m_gainMode != mode.m_value) - { - if (mode.m_value == BLADERF_GAIN_MANUAL) - { - m_settings.m_globalGain = ui->gain->value(); - ui->gain->setEnabled(true); - } else { - ui->gain->setEnabled(false); - } - } - - m_settings.m_gainMode = mode.m_value; - sendSettings(); - } -} - void BladeRF2OutputGui::on_gain_valueChanged(int value) { ui->gainText->setText(tr("%1 dB").arg(value)); diff --git a/plugins/samplesink/bladerf2output/bladerf2outputgui.h b/plugins/samplesink/bladerf2output/bladerf2outputgui.h index 0fa4228bb..c93c2f9fe 100644 --- a/plugins/samplesink/bladerf2output/bladerf2outputgui.h +++ b/plugins/samplesink/bladerf2output/bladerf2outputgui.h @@ -78,7 +78,6 @@ private slots: void on_sampleRate_changed(quint64 value); void on_bandwidth_changed(quint64 value); void on_interp_currentIndexChanged(int index); - void on_gainMode_currentIndexChanged(int index); void on_gain_valueChanged(int value); void on_startStop_toggled(bool checked); void updateHardware(); diff --git a/plugins/samplesink/bladerf2output/bladerf2outputgui.ui b/plugins/samplesink/bladerf2output/bladerf2outputgui.ui index 468db150f..7facfdc9a 100644 --- a/plugins/samplesink/bladerf2output/bladerf2outputgui.ui +++ b/plugins/samplesink/bladerf2output/bladerf2outputgui.ui @@ -372,11 +372,11 @@ - + 3 - + Gain value @@ -386,13 +386,6 @@ - - - - Gain mode - - - @@ -400,7 +393,7 @@ - + diff --git a/plugins/samplesink/bladerf2output/bladerf2outputsettings.cpp b/plugins/samplesink/bladerf2output/bladerf2outputsettings.cpp index 7ad09065c..2a69e969b 100644 --- a/plugins/samplesink/bladerf2output/bladerf2outputsettings.cpp +++ b/plugins/samplesink/bladerf2output/bladerf2outputsettings.cpp @@ -31,7 +31,7 @@ void BladeRF2OutputSettings::resetToDefaults() m_devSampleRate = 3072000; m_bandwidth = 1500000; m_gainMode = 0; - m_globalGain = 0; + m_globalGain = -20; m_biasTee = false; m_log2Interp = 0; } diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 30babd580..162f29506 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -1377,12 +1377,6 @@ margin-bottom: 20px; }, "globalGainRange" : { "$ref" : "#/definitions/Range" - }, - "gainModes" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/NamedEnum" - } } }, "description" : "BladeRF2" @@ -23231,7 +23225,7 @@ except ApiException as e:
- Generated 2018-09-29T05:36:53.044+02:00 + Generated 2018-09-29T10:10:59.386+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml b/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml index 61f00b5d2..5a6e73ed3 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml @@ -71,7 +71,3 @@ BladeRF2OutputReport: $ref: "/doc/swagger/include/Structs.yaml#/Range" globalGainRange: $ref: "/doc/swagger/include/Structs.yaml#/Range" - gainModes: - type: array - items: - $ref: "/doc/swagger/include/Structs.yaml#/NamedEnum" diff --git a/swagger/sdrangel/api/swagger/include/BladeRF2.yaml b/swagger/sdrangel/api/swagger/include/BladeRF2.yaml index 0198207d3..3d5c16dc2 100644 --- a/swagger/sdrangel/api/swagger/include/BladeRF2.yaml +++ b/swagger/sdrangel/api/swagger/include/BladeRF2.yaml @@ -71,7 +71,3 @@ BladeRF2OutputReport: $ref: "http://localhost:8081/api/swagger/include/Structs.yaml#/Range" globalGainRange: $ref: "http://localhost:8081/api/swagger/include/Structs.yaml#/Range" - gainModes: - type: array - items: - $ref: "http://localhost:8081/api/swagger/include/Structs.yaml#/NamedEnum" diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 30babd580..162f29506 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -1377,12 +1377,6 @@ margin-bottom: 20px; }, "globalGainRange" : { "$ref" : "#/definitions/Range" - }, - "gainModes" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/NamedEnum" - } } }, "description" : "BladeRF2" @@ -23231,7 +23225,7 @@ except ApiException as e:
- Generated 2018-09-29T05:36:53.044+02:00 + Generated 2018-09-29T10:10:59.386+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputReport.cpp b/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputReport.cpp index 8ce6ae808..ef8e4b342 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputReport.cpp @@ -36,8 +36,6 @@ SWGBladeRF2OutputReport::SWGBladeRF2OutputReport() { m_bandwidth_range_isSet = false; global_gain_range = nullptr; m_global_gain_range_isSet = false; - gain_modes = nullptr; - m_gain_modes_isSet = false; } SWGBladeRF2OutputReport::~SWGBladeRF2OutputReport() { @@ -54,8 +52,6 @@ SWGBladeRF2OutputReport::init() { m_bandwidth_range_isSet = false; global_gain_range = new SWGRange(); m_global_gain_range_isSet = false; - gain_modes = new QList(); - m_gain_modes_isSet = false; } void @@ -72,13 +68,6 @@ SWGBladeRF2OutputReport::cleanup() { if(global_gain_range != nullptr) { delete global_gain_range; } - if(gain_modes != nullptr) { - auto arr = gain_modes; - for(auto o: *arr) { - delete o; - } - delete gain_modes; - } } SWGBladeRF2OutputReport* @@ -100,8 +89,6 @@ SWGBladeRF2OutputReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&global_gain_range, pJson["globalGainRange"], "SWGRange", "SWGRange"); - - ::SWGSDRangel::setValue(&gain_modes, pJson["gainModes"], "QList", "SWGNamedEnum"); } QString @@ -130,9 +117,6 @@ SWGBladeRF2OutputReport::asJsonObject() { if((global_gain_range != nullptr) && (global_gain_range->isSet())){ toJsonValue(QString("globalGainRange"), global_gain_range, obj, QString("SWGRange")); } - if(gain_modes->size() > 0){ - toJsonArray((QList*)gain_modes, obj, "gainModes", "SWGNamedEnum"); - } return obj; } @@ -177,16 +161,6 @@ SWGBladeRF2OutputReport::setGlobalGainRange(SWGRange* global_gain_range) { this->m_global_gain_range_isSet = true; } -QList* -SWGBladeRF2OutputReport::getGainModes() { - return gain_modes; -} -void -SWGBladeRF2OutputReport::setGainModes(QList* gain_modes) { - this->gain_modes = gain_modes; - this->m_gain_modes_isSet = true; -} - bool SWGBladeRF2OutputReport::isSet(){ @@ -196,7 +170,6 @@ SWGBladeRF2OutputReport::isSet(){ if(sample_rate_range != nullptr && sample_rate_range->isSet()){ isObjectUpdated = true; break;} if(bandwidth_range != nullptr && bandwidth_range->isSet()){ isObjectUpdated = true; break;} if(global_gain_range != nullptr && global_gain_range->isSet()){ isObjectUpdated = true; break;} - if(gain_modes->size() > 0){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputReport.h b/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputReport.h index e6ea9646e..03a946a29 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputReport.h @@ -23,9 +23,7 @@ #include "SWGFrequencyRange.h" -#include "SWGNamedEnum.h" #include "SWGRange.h" -#include #include "SWGObject.h" #include "export.h" @@ -57,9 +55,6 @@ public: SWGRange* getGlobalGainRange(); void setGlobalGainRange(SWGRange* global_gain_range); - QList* getGainModes(); - void setGainModes(QList* gain_modes); - virtual bool isSet() override; @@ -76,9 +71,6 @@ private: SWGRange* global_gain_range; bool m_global_gain_range_isSet; - QList* gain_modes; - bool m_gain_modes_isSet; - }; }