From 0dbd89db195a07119806686f465b6b3066c45276 Mon Sep 17 00:00:00 2001 From: Ryzerth Date: Wed, 30 Jun 2021 03:13:14 +0200 Subject: [PATCH] Fixed BladeRF and LimeSDR bugs --- bladerf_source/src/main.cpp | 7 ++++--- limesdr_source/src/main.cpp | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bladerf_source/src/main.cpp b/bladerf_source/src/main.cpp index bda4cdd..62c5a4f 100644 --- a/bladerf_source/src/main.cpp +++ b/bladerf_source/src/main.cpp @@ -108,6 +108,7 @@ public: return; } } + selectFirst(); } void selectByInfo(bladerf_devinfo* info, bool reloadChannelId = true) { @@ -457,7 +458,7 @@ private: ImGui::Text("Gain control mode"); ImGui::SameLine(); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); - if (ImGui::Combo(CONCAT("##_balderf_gm_sel_", _this->name), &_this->gainMode, _this->gainModesTxt.c_str())) { + if (ImGui::Combo(CONCAT("##_balderf_gm_sel_", _this->name), &_this->gainMode, _this->gainModesTxt.c_str()) && _this->selectedSerial != "") { if (_this->running) { bladerf_set_gain_mode(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), _this->gainModes[_this->gainMode].mode); } @@ -472,7 +473,7 @@ private: } } - if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::beginDisabled(); } + if (_this->selectedSerial != "") { if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::beginDisabled(); } } ImGui::Text("Gain"); ImGui::SameLine(); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); @@ -487,7 +488,7 @@ private: config.release(true); } } - if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::endDisabled(); } + if (_this->selectedSerial != "") { if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::endDisabled(); } } } diff --git a/limesdr_source/src/main.cpp b/limesdr_source/src/main.cpp index 0b41978..05d9a79 100644 --- a/limesdr_source/src/main.cpp +++ b/limesdr_source/src/main.cpp @@ -258,7 +258,7 @@ public: // Load gain if (config.conf["devices"][selectedDevName].contains("gain")) { - gain = config.conf["devices"][selectedDevName]["bandwidth"]; + gain = config.conf["devices"][selectedDevName]["gain"]; gain = std::clamp(bwId, 0, 73); } else { @@ -411,8 +411,7 @@ private: ImGui::Text("RX Channel"); ImGui::SameLine(); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); - ImGui::Combo("##limesdr_ch_sel", &_this->chanId, _this->channelNamesTxt.c_str()); - if (_this->selectedDevName != "") { + if (ImGui::Combo("##limesdr_ch_sel", &_this->chanId, _this->channelNamesTxt.c_str()) && _this->selectedDevName != "") { config.aquire(); config.conf["devices"][_this->selectedDevName]["channel"] = _this->chanId; config.release(true);