diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index a8922480..427dbf85 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -145,7 +145,7 @@ jobs: run: cmake -E make_directory ${{runner.workspace}}/build - name: Install dependencies - run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako + run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako --break-system-packages - name: Install volk run: git clone --recursive https://github.com/gnuradio/volk && cd volk && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 8ed95324..65436fe4 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -433,6 +433,9 @@ void MainWindow::draw() { showCredits = false; } + // Reset waterfall lock + lockWaterfallControls = showCredits; + // Handle menu resize ImVec2 winSize = ImGui::GetWindowSize(); ImVec2 mousePos = ImGui::GetMousePos(); @@ -467,7 +470,6 @@ void MainWindow::draw() { displaymenu::checkKeybinds(); // Left Column - lockWaterfallControls = false; if (showMenu) { ImGui::Columns(3, "WindowColumns", false); ImGui::SetColumnWidth(0, menuWidth); @@ -576,20 +578,20 @@ void MainWindow::draw() { // Handle scrollwheel int wheel = ImGui::GetIO().MouseWheel; if (wheel != 0 && (gui::waterfall.mouseInFFT || gui::waterfall.mouseInWaterfall)) { - // Select factor depending on modifier keys - double interval; - if (ImGui::IsKeyDown(ImGuiKey_LeftShift)) { - interval = vfo->snapInterval * 10.0; - } - else if (ImGui::IsKeyDown(ImGuiKey_LeftAlt)) { - interval = vfo->snapInterval * 0.1; - } - else { - interval = vfo->snapInterval; - } - double nfreq; if (vfo != NULL) { + // Select factor depending on modifier keys + double interval; + if (ImGui::IsKeyDown(ImGuiKey_LeftShift)) { + interval = vfo->snapInterval * 10.0; + } + else if (ImGui::IsKeyDown(ImGuiKey_LeftAlt)) { + interval = vfo->snapInterval * 0.1; + } + else { + interval = vfo->snapInterval; + } + nfreq = gui::waterfall.getCenterFrequency() + vfo->generalOffset + (interval * wheel); nfreq = roundl(nfreq / interval) * interval; } diff --git a/decoder_modules/pager_decoder/src/main.cpp b/decoder_modules/pager_decoder/src/main.cpp index aacd76cb..99565c31 100644 --- a/decoder_modules/pager_decoder/src/main.cpp +++ b/decoder_modules/pager_decoder/src/main.cpp @@ -36,7 +36,7 @@ public: // Define protocols protocols.define("POCSAG", PROTOCOL_POCSAG); - protocols.define("FLEX", PROTOCOL_FLEX); + //protocols.define("FLEX", PROTOCOL_FLEX); // Initialize VFO with default values vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 12500, 24000, 12500, 12500, true); diff --git a/decoder_modules/pager_decoder/src/pocsag/decoder.h b/decoder_modules/pager_decoder/src/pocsag/decoder.h index 9807e6d3..ce0da317 100644 --- a/decoder_modules/pager_decoder/src/pocsag/decoder.h +++ b/decoder_modules/pager_decoder/src/pocsag/decoder.h @@ -45,10 +45,6 @@ public: // TODO } - if (ImGui::Button("Detune")) { - dsp.detune(); - } - ImGui::FillWidth(); diag.draw(); } diff --git a/decoder_modules/pager_decoder/src/pocsag/dsp.h b/decoder_modules/pager_decoder/src/pocsag/dsp.h index 20a1b8f8..37e97789 100644 --- a/decoder_modules/pager_decoder/src/pocsag/dsp.h +++ b/decoder_modules/pager_decoder/src/pocsag/dsp.h @@ -19,7 +19,7 @@ public: void init(dsp::stream* in, double samplerate, double baudrate) { // Save settings - // TODO + _samplerate = samplerate; // Configure blocks demod.init(NULL, -4500.0, samplerate); @@ -44,8 +44,12 @@ public: return count; } - void detune() { - recov.setOmega(9.99); + void setBaudrate(double baudrate) { + assert(base_type::_block_init); + std::lock_guard lck(base_type::ctrlMtx); + base_type::tempStop(); + + base_type::tempStart(); } int run() { @@ -68,4 +72,5 @@ private: dsp::filter::FIR fir; dsp::clock_recovery::MM recov; + double _samplerate; }; \ No newline at end of file diff --git a/readme.md b/readme.md index 8a02ca87..33ff7ba9 100644 --- a/readme.md +++ b/readme.md @@ -329,6 +329,7 @@ Modules in beta are still included in releases for the most part but not enabled |----------------------|------------|-------------------|--------------------------------|:---------------:|:-----------------------:|:---------------------------:| | airspy_source | Working | libairspy | OPT_BUILD_AIRSPY_SOURCE | ✅ | ✅ | ✅ | | airspyhf_source | Working | libairspyhf | OPT_BUILD_AIRSPYHF_SOURCE | ✅ | ✅ | ✅ | +| audio_source | Working | rtaudio | OPT_BUILD_AUDIO_SOURCE | ✅ | ✅ | ✅ | | bladerf_source | Working | libbladeRF | OPT_BUILD_BLADERF_SOURCE | ⛔ | ✅ (not Debian Buster) | ✅ | | file_source | Working | - | OPT_BUILD_FILE_SOURCE | ✅ | ✅ | ✅ | | hackrf_source | Working | libhackrf | OPT_BUILD_HACKRF_SOURCE | ✅ | ✅ | ✅ | diff --git a/source_modules/soapy_source/src/main.cpp b/source_modules/soapy_source/src/main.cpp index 7274024a..914bb287 100644 --- a/source_modules/soapy_source/src/main.cpp +++ b/source_modules/soapy_source/src/main.cpp @@ -81,8 +81,15 @@ public: private: void refresh() { - devList = SoapySDR::Device::enumerate(); txtDevList = ""; + try { + devList = SoapySDR::Device::enumerate(); + } + catch (const std::exception& e) { + flog::error("Could not list devices: {}", e.what()); + return; + } + int i = 0; for (auto& dev : devList) { txtDevList += dev["label"] != "" ? dev["label"] : dev["driver"]; @@ -153,7 +160,14 @@ private: return; } - SoapySDR::Device* dev = SoapySDR::Device::make(devArgs); + SoapySDR::Device* dev = NULL; + try { + dev = SoapySDR::Device::make(devArgs); + } + catch (const std::exception& e) { + flog::error("Could not open device: {}", e.what()); + return; + } antennaList = dev->listAntennas(SOAPY_SDR_RX, channelId); txtAntennaList = ""; @@ -307,7 +321,13 @@ private: return; } - _this->dev = SoapySDR::Device::make(_this->devArgs); + try { + _this->dev = SoapySDR::Device::make(_this->devArgs); + } + catch (const std::exception& e) { + flog::error("Failed to open device: {}", e.what()); + return; + } _this->dev->setSampleRate(SOAPY_SDR_RX, _this->channelId, _this->sampleRate); diff --git a/source_modules/spectran_http_source/src/main.cpp b/source_modules/spectran_http_source/src/main.cpp index 8ec62131..b9b7212f 100644 --- a/source_modules/spectran_http_source/src/main.cpp +++ b/source_modules/spectran_http_source/src/main.cpp @@ -144,9 +144,7 @@ private: _this->tryConnect(); } else if (connected && SmGui::Button("Disconnect##spectran_http_source")) { - _this->client->onCenterFrequencyChanged.unbind(_this->onFreqChangedId); - _this->client->onCenterFrequencyChanged.unbind(_this->onSamplerateChangedId); - _this->client->close(); + _this->disconnect(); } if (_this->running) { style::endDisabled(); } @@ -173,6 +171,12 @@ private: } } + void disconnect() { + client->onCenterFrequencyChanged.unbind(onFreqChangedId); + client->onSamplerateChanged.unbind(onSamplerateChangedId); + client->close(); + } + void onFreqChanged(double newFreq) { if (lastReportedFreq == newFreq) { return; } lastReportedFreq = newFreq; diff --git a/source_modules/spectran_http_source/src/spectran_http_client.cpp b/source_modules/spectran_http_source/src/spectran_http_client.cpp index 3b51f2d0..3708d518 100644 --- a/source_modules/spectran_http_source/src/spectran_http_client.cpp +++ b/source_modules/spectran_http_source/src/spectran_http_client.cpp @@ -11,12 +11,15 @@ SpectranHTTPClient::SpectranHTTPClient(std::string host, int port, dsp::streamsendstr(data); + + // Receive response net::http::ResponseHeader rshdr; controlHttp.recvResponseHeader(rshdr, 5000); - flog::debug("Response: {}", rshdr.getStatusString()); + // Log error if there is one + if (rshdr.getStatusCode() < 200 || rshdr.getStatusCode() >= 300) { + flog::debug("Response: {}", rshdr.getStatusString()); + } } void SpectranHTTPClient::worker() { @@ -101,11 +113,10 @@ void SpectranHTTPClient::worker() { auto sampleFreqEnd = jsonData.find(',', sampleFreqBegin); std::string sampleFreqStr = jsonData.substr(sampleFreqBegin + 18, sampleFreqEnd - sampleFreqBegin - 18); sampleFreq = std::stoll(sampleFreqStr); - //flog::debug("{}", jsonData); } // Calculate and update center freq - int64_t samplerate = /* sampleFreqReceived ? sampleFreq : */(endFreq - startFreq); + int64_t samplerate = sampleFreqReceived ? sampleFreq : (endFreq - startFreq); int64_t centerFreq = round(((double)endFreq + (double)startFreq) / 2.0); if (centerFreq != _centerFreq) { flog::debug("New center freq: {}", centerFreq);