diff --git a/airspy_source/src/main.cpp b/airspy_source/src/main.cpp index 721d26cf..07f7862e 100644 --- a/airspy_source/src/main.cpp +++ b/airspy_source/src/main.cpp @@ -114,16 +114,15 @@ public: airspy_get_samplerates(dev, sampleRates, 0); int n = sampleRates[0]; airspy_get_samplerates(dev, sampleRates, n); - char buf[1024]; sampleRateList.clear(); sampleRateListTxt = ""; for (int i = 0; i < n; i++) { sampleRateList.push_back(sampleRates[i]); - sprintf(buf, "%d", sampleRates[i]); - sampleRateListTxt += buf; + sampleRateListTxt += getBandwdithScaled(sampleRates[i]); sampleRateListTxt += '\0'; } + char buf[1024]; sprintf(buf, "%016" PRIX64, serial); selectedSerStr = std::string(buf); @@ -193,6 +192,20 @@ public: } private: + std::string getBandwdithScaled(double bw) { + char buf[1024]; + if (bw >= 1000000.0) { + sprintf(buf, "%.1lfMHz", bw / 1000000.0); + } + else if (bw >= 1000.0) { + sprintf(buf, "%.1lfKHz", bw / 1000.0); + } + else { + sprintf(buf, "%.1lfHz", bw); + } + return std::string(buf); + } + static void menuSelected(void* ctx) { AirspySourceModule* _this = (AirspySourceModule*)ctx; core::setInputSampleRate(_this->sampleRate); @@ -411,9 +424,13 @@ private: } } else if (_this->gainMode == 2) { + // Calculate position of sliders + float pos = ImGui::CalcTextSize("Mixer Gain").x + 10; + if (_this->lnaAgc) { style::beginDisabled(); } ImGui::Text("LNA Gain"); ImGui::SameLine(); + ImGui::SetCursorPosX(pos); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt(CONCAT("##_airspy_lna_gain_", _this->name), &_this->lnaGain, 0, 15)) { if (_this->running) { @@ -430,6 +447,7 @@ private: if (_this->mixerAgc) { style::beginDisabled(); } ImGui::Text("Mixer Gain"); ImGui::SameLine(); + ImGui::SetCursorPosX(pos); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt(CONCAT("##_airspy_mix_gain_", _this->name), &_this->mixerGain, 0, 15)) { if (_this->running) { @@ -445,6 +463,7 @@ private: ImGui::Text("VGA Gain"); ImGui::SameLine(); + ImGui::SetCursorPosX(pos); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt(CONCAT("##_airspy_vga_gain_", _this->name), &_this->vgaGain, 0, 15)) { if (_this->running) { @@ -474,7 +493,6 @@ private: config.release(true); } } - if (ImGui::Checkbox(CONCAT("Mixer AGC##_airspy_", _this->name), &_this->mixerAgc)) { if (_this->running) { if (_this->mixerAgc) { diff --git a/airspyhf_source/src/main.cpp b/airspyhf_source/src/main.cpp index 2c89e79f..0071d607 100644 --- a/airspyhf_source/src/main.cpp +++ b/airspyhf_source/src/main.cpp @@ -121,16 +121,15 @@ public: airspyhf_get_samplerates(dev, sampleRates, 0); int n = sampleRates[0]; airspyhf_get_samplerates(dev, sampleRates, n); - char buf[1024]; sampleRateList.clear(); sampleRateListTxt = ""; for (int i = 0; i < n; i++) { sampleRateList.push_back(sampleRates[i]); - sprintf(buf, "%d", sampleRates[i]); - sampleRateListTxt += buf; + sampleRateListTxt += getBandwdithScaled(sampleRates[i]); sampleRateListTxt += '\0'; } + char buf[1024]; sprintf(buf, "%016" PRIX64, serial); selectedSerStr = std::string(buf); @@ -174,6 +173,20 @@ public: } private: + std::string getBandwdithScaled(double bw) { + char buf[1024]; + if (bw >= 1000000.0) { + sprintf(buf, "%.1lfMHz", bw / 1000000.0); + } + else if (bw >= 1000.0) { + sprintf(buf, "%.1lfKHz", bw / 1000.0); + } + else { + sprintf(buf, "%.1lfHz", bw); + } + return std::string(buf); + } + static void menuSelected(void* ctx) { AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx; core::setInputSampleRate(_this->sampleRate);