From 99441ea2eb0173efce95279029d2511ff343a8f4 Mon Sep 17 00:00:00 2001 From: ericek111 Date: Mon, 30 Aug 2021 00:12:13 +0200 Subject: [PATCH 1/6] soapy_source: always show the Refresh button --- soapy_source/src/main.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/soapy_source/src/main.cpp b/soapy_source/src/main.cpp index e73a1f16..13111d82 100644 --- a/soapy_source/src/main.cpp +++ b/soapy_source/src/main.cpp @@ -353,13 +353,18 @@ private: static void menuHandler(void* ctx) { SoapyModule* _this = (SoapyModule*)ctx; - - // If no device is available, do not attempt to display menu - if (_this->devId < 0) { - return; - } float menuWidth = ImGui::GetContentRegionAvailWidth(); + + // If no device is selected, draw just the refresh button + if (_this->devId < 0) { + if (ImGui::Button(CONCAT("Refresh##_dev_select_", _this->name), ImVec2(menuWidth, 0))) { + _this->refresh(); + _this->selectDevice(config.conf["device"]); + } + + return; + } if (_this->running) { style::beginDisabled(); } From 49fd49b4d65845c83286014733f743b8fe257010 Mon Sep 17 00:00:00 2001 From: ericek111 Date: Mon, 30 Aug 2021 01:07:40 +0200 Subject: [PATCH 2/6] soapy_source: refresh devices on start if none in devList --- soapy_source/src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/soapy_source/src/main.cpp b/soapy_source/src/main.cpp index e73a1f16..0145548b 100644 --- a/soapy_source/src/main.cpp +++ b/soapy_source/src/main.cpp @@ -296,6 +296,14 @@ private: static void start(void* ctx) { SoapyModule* _this = (SoapyModule*)ctx; if (_this->running) { return; } + if (_this->devId < 0) { + _this->refresh(); + _this->selectDevice(config.conf["device"]); + if (_this->devId < 0) { + return; + } + } + _this->dev = SoapySDR::Device::make(_this->devArgs); _this->dev->setSampleRate(SOAPY_SDR_RX, _this->channelId, _this->sampleRate); From ba6d9f720243745f1056e6584cbf8c108830cacc Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 30 Aug 2021 01:23:42 +0200 Subject: [PATCH 3/6] minor style change --- soapy_source/src/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/soapy_source/src/main.cpp b/soapy_source/src/main.cpp index 13111d82..8314fb26 100644 --- a/soapy_source/src/main.cpp +++ b/soapy_source/src/main.cpp @@ -356,13 +356,12 @@ private: float menuWidth = ImGui::GetContentRegionAvailWidth(); - // If no device is selected, draw just the refresh button + // If no device is selected, draw only the refresh button if (_this->devId < 0) { if (ImGui::Button(CONCAT("Refresh##_dev_select_", _this->name), ImVec2(menuWidth, 0))) { _this->refresh(); _this->selectDevice(config.conf["device"]); } - return; } From 04ce4c3583c7f1f390a20c15511c05d1cf0403b8 Mon Sep 17 00:00:00 2001 From: ericek111 Date: Mon, 30 Aug 2021 02:27:48 +0200 Subject: [PATCH 4/6] Make the zoom slider increase exponentially --- core/src/gui/main_window.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 1734864a..d99ffba3 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -598,8 +598,14 @@ void MainWindow::draw() { ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Zoom").x / 2.0)); ImGui::Text("Zoom"); ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10); - if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, gui::waterfall.getBandwidth(), 1000.0, "")) { - gui::waterfall.setViewBandwidth(bw); + float minSliderBw = 1000.0; + float maxSliderBw = gui::waterfall.getBandwidth(); + if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, maxSliderBw, minSliderBw, "")) { + float normBw = bw / (maxSliderBw - minSliderBw); + float factor = normBw * normBw; + float finalBw = minSliderBw + bw * factor; + + gui::waterfall.setViewBandwidth(finalBw); if (vfo != NULL) { gui::waterfall.setViewOffset(vfo->centerOffset); // center vfo on screen } From fa75a3a1763c53ab2051b3a3b52d77a7812682f9 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 30 Aug 2021 03:06:40 +0200 Subject: [PATCH 5/6] Update main.cpp --- soapy_source/src/main.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/soapy_source/src/main.cpp b/soapy_source/src/main.cpp index 0145548b..f2dced4b 100644 --- a/soapy_source/src/main.cpp +++ b/soapy_source/src/main.cpp @@ -297,11 +297,7 @@ private: SoapyModule* _this = (SoapyModule*)ctx; if (_this->running) { return; } if (_this->devId < 0) { - _this->refresh(); - _this->selectDevice(config.conf["device"]); - if (_this->devId < 0) { - return; - } + return; } _this->dev = SoapySDR::Device::make(_this->devArgs); From c31e2604258e4cefae6e8ca6e0bb41086f18bb35 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 30 Aug 2021 03:07:36 +0200 Subject: [PATCH 6/6] Added error message --- soapy_source/src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/soapy_source/src/main.cpp b/soapy_source/src/main.cpp index f2dced4b..8f6a270e 100644 --- a/soapy_source/src/main.cpp +++ b/soapy_source/src/main.cpp @@ -297,6 +297,7 @@ private: SoapyModule* _this = (SoapyModule*)ctx; if (_this->running) { return; } if (_this->devId < 0) { + spdlog::error("No device available"); return; }