From a08d2a0f8568577c79ed953aa01454a1918830d9 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 2 Feb 2024 22:52:19 +0100 Subject: [PATCH 01/56] more work on debugging the pager decoder --- .../pager_decoder/src/pocsag/decoder.h | 15 +++- .../pager_decoder/src/pocsag/dsp.h | 14 ++-- .../pager_decoder/src/pocsag/pocsag.cpp | 77 ++++++++++++++++--- .../pager_decoder/src/pocsag/pocsag.h | 3 + 4 files changed, 91 insertions(+), 18 deletions(-) diff --git a/decoder_modules/pager_decoder/src/pocsag/decoder.h b/decoder_modules/pager_decoder/src/pocsag/decoder.h index 54923755..506f8770 100644 --- a/decoder_modules/pager_decoder/src/pocsag/decoder.h +++ b/decoder_modules/pager_decoder/src/pocsag/decoder.h @@ -15,9 +15,12 @@ const char* msgTypes[] = { "Alphanumeric", }; +#define BAUDRATE 2400 +#define SAMPLERATE (BAUDRATE*10) + class POCSAGDecoder : public Decoder { public: - POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, 2400) { + POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, BAUDRATE) { this->name = name; this->vfo = vfo; @@ -28,9 +31,9 @@ public: // Init DSP vfo->setBandwidthLimits(12500, 12500, true); - vfo->setSampleRate(24000, 12500); - dsp.init(vfo->output, 24000, 2400); - reshape.init(&dsp.soft, 2400.0, (2400 / 30.0) - 2400.0); + vfo->setSampleRate(SAMPLERATE, 12500); + dsp.init(vfo->output, SAMPLERATE, BAUDRATE); + reshape.init(&dsp.soft, BAUDRATE, (BAUDRATE / 30.0) - BAUDRATE); dataHandler.init(&dsp.out, _dataHandler, this); diagHandler.init(&reshape.out, _diagHandler, this); @@ -49,6 +52,10 @@ 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 3faca285..8b15c349 100644 --- a/decoder_modules/pager_decoder/src/pocsag/dsp.h +++ b/decoder_modules/pager_decoder/src/pocsag/dsp.h @@ -23,14 +23,14 @@ public: // Configure blocks demod.init(NULL, -4500.0, samplerate); - dcBlock.init(NULL, 0.001); + //dcBlock.init(NULL, 0.001); // NOTE: DC blocking causes issues because no scrambling, think more about it float taps[] = { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f }; shape = dsp::taps::fromArray(10, taps); fir.init(NULL, shape); - recov.init(NULL, samplerate/baudrate, 1e5, 0.1, 0.05); + recov.init(NULL, samplerate/baudrate, 1e-4, 1.0, 0.05); // Free useless buffers - dcBlock.out.free(); + // dcBlock.out.free(); fir.out.free(); recov.out.free(); @@ -40,13 +40,17 @@ public: int process(int count, dsp::complex_t* in, float* softOut, uint8_t* out) { count = demod.process(count, in, demod.out.readBuf); - count = dcBlock.process(count, demod.out.readBuf, demod.out.readBuf); + //count = dcBlock.process(count, demod.out.readBuf, demod.out.readBuf); count = fir.process(count, demod.out.readBuf, demod.out.readBuf); count = recov.process(count, demod.out.readBuf, softOut); dsp::digital::BinarySlicer::process(count, softOut, out); return count; } + void detune() { + recov.setOmega(9.99); + } + int run() { int count = base_type::_in->read(); if (count < 0) { return -1; } @@ -63,7 +67,7 @@ public: private: dsp::demod::Quadrature demod; - dsp::correction::DCBlocker dcBlock; + //dsp::correction::DCBlocker dcBlock; dsp::tap shape; dsp::filter::FIR fir; dsp::clock_recovery::MM recov; diff --git a/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp b/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp index 572f69e7..e075df81 100644 --- a/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp +++ b/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp @@ -5,6 +5,7 @@ #define POCSAG_FRAME_SYNC_CODEWORD ((uint32_t)(0b01111100110100100001010111011000)) #define POCSAG_IDLE_CODEWORD_DATA ((uint32_t)(0b011110101100100111000)) #define POCSAG_BATCH_BIT_COUNT (POCSAG_BATCH_CODEWORD_COUNT*32) +#define POCSAG_DATA_BITS_PER_CW 20 #define POCSAG_GEN_POLY ((uint32_t)(0b11101101001)) @@ -28,6 +29,11 @@ namespace pocsag { '[' }; + Decoder::Decoder() { + // Zero out batch + memset(batch, 0, sizeof(batch)); + } + void Decoder::process(uint8_t* symbols, int count) { for (int i = 0; i < count; i++) { // Get symbol @@ -78,8 +84,37 @@ namespace pocsag { void Decoder::flushMessage() { if (!msg.empty()) { - onMessage(addr, msgType, msg); + + // Unpack bits + std::string outStr = ""; + + for (int i = 0; (i+7) <= msg.size(); i += 7) { + uint8_t b0 = msg[i]; + uint8_t b1 = msg[i+1]; + uint8_t b2 = msg[i+2]; + uint8_t b3 = msg[i+3]; + uint8_t b4 = msg[i+4]; + uint8_t b5 = msg[i+5]; + uint8_t b6 = msg[i+6]; + outStr += (char)((b6<<6) | (b5<<5) | (b4<<4) | (b3<<3) | (b2<<2) | (b1<<1) | b0); + } + + onMessage(addr, msgType, outStr); msg.clear(); + leftInLast = 0; + } + } + + void printbin(uint32_t cw) { + for (int i = 31; i >= 0; i--) { + printf("%c", ((cw >> i) & 1) ? '1':'0'); + } + } + + void bitswapChar(char in, char& out) { + out = 0; + for (int i = 0; i < 7; i++) { + out |= ((in >> (6-i)) & 1) << i; } } @@ -102,14 +137,14 @@ namespace pocsag { if (type == CODEWORD_TYPE_IDLE) { // If a non-empty message is available, send it out and clear flushMessage(); - flog::debug("[{}:{}]: IDLE", (i >> 1), i&1); } else if (type == CODEWORD_TYPE_ADDRESS) { // If a non-empty message is available, send it out and clear flushMessage(); // Decode message type - msgType = (MessageType)((cw >> 11) & 0b11); + msgType = MESSAGE_TYPE_ALPHANUMERIC; + // msgType = (MessageType)((cw >> 11) & 0b11); // Decode address and append lower 8 bits from position addr = ((cw >> 13) & 0b111111111111111111) << 3; @@ -122,14 +157,38 @@ namespace pocsag { // Decode data depending on message type if (msgType == MESSAGE_TYPE_NUMERIC) { // Numeric messages pack 5 characters per message codeword - msg += NUMERIC_CHARSET[(data >> 16) & 0b1111]; - msg += NUMERIC_CHARSET[(data >> 12) & 0b1111]; - msg += NUMERIC_CHARSET[(data >> 8) & 0b1111]; - msg += NUMERIC_CHARSET[(data >> 4) & 0b1111]; - msg += NUMERIC_CHARSET[data & 0b1111]; + //msg += NUMERIC_CHARSET[(data >> 16) & 0b1111]; + //msg += NUMERIC_CHARSET[(data >> 12) & 0b1111]; + //msg += NUMERIC_CHARSET[(data >> 8) & 0b1111]; + //msg += NUMERIC_CHARSET[(data >> 4) & 0b1111]; + //msg += NUMERIC_CHARSET[data & 0b1111]; } else if (msgType == MESSAGE_TYPE_ALPHANUMERIC) { - + // Alpha messages pack 7bit characters in the entire codeword stream + // int lasti; + // for (int i = -leftInLast; i <= POCSAG_DATA_BITS_PER_CW-7; i += 7) { + // // Read 7 bits + // char c = 0; + // if (i < 0) { + // c = (lastMsgData & ((1 << (-i)) - 1)) << (7+i); + // } + // c |= (data >> (13 - i)) & 0b1111111; + + // // Save character + // bitswapChar(c, c); + // msg += c; + + // // Update last successful unpack + // lasti = i; + // } + + // Pack the bits backwards + for (int i = 19; i >= 0; i--) { + msg += (char)((data >> i) & 1); + } + + // Save how much is still left to read + //leftInLast = 20 - (lasti + 7); } // Save last data diff --git a/decoder_modules/pager_decoder/src/pocsag/pocsag.h b/decoder_modules/pager_decoder/src/pocsag/pocsag.h index b0e78cfa..6452f59c 100644 --- a/decoder_modules/pager_decoder/src/pocsag/pocsag.h +++ b/decoder_modules/pager_decoder/src/pocsag/pocsag.h @@ -23,6 +23,8 @@ namespace pocsag { class Decoder { public: + Decoder(); + void process(uint8_t* symbols, int count); NewEvent onMessage; @@ -44,5 +46,6 @@ namespace pocsag { std::string msg; uint32_t lastMsgData; + bool leftInLast = 0; }; } \ No newline at end of file From a0ff745b6381455619631d34b9e10f3709c58c2b Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 2 Feb 2024 23:06:03 +0100 Subject: [PATCH 02/56] fix windows CI missing module --- .../pager_decoder/src/pocsag/pocsag.cpp | 67 ++++++++++--------- make_windows_package.ps1 | 2 + 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp b/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp index e075df81..5f98a1b1 100644 --- a/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp +++ b/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp @@ -85,21 +85,24 @@ namespace pocsag { void Decoder::flushMessage() { if (!msg.empty()) { - // Unpack bits - std::string outStr = ""; + // // Unpack bits + // std::string outStr = ""; + // for (int i = 0; (i+7) <= msg.size(); i += 7) { + // uint8_t b0 = msg[i]; + // uint8_t b1 = msg[i+1]; + // uint8_t b2 = msg[i+2]; + // uint8_t b3 = msg[i+3]; + // uint8_t b4 = msg[i+4]; + // uint8_t b5 = msg[i+5]; + // uint8_t b6 = msg[i+6]; + // outStr += (char)((b6<<6) | (b5<<5) | (b4<<4) | (b3<<3) | (b2<<2) | (b1<<1) | b0); + // } + // onMessage(addr, msgType, outStr); - for (int i = 0; (i+7) <= msg.size(); i += 7) { - uint8_t b0 = msg[i]; - uint8_t b1 = msg[i+1]; - uint8_t b2 = msg[i+2]; - uint8_t b3 = msg[i+3]; - uint8_t b4 = msg[i+4]; - uint8_t b5 = msg[i+5]; - uint8_t b6 = msg[i+6]; - outStr += (char)((b6<<6) | (b5<<5) | (b4<<4) | (b3<<3) | (b2<<2) | (b1<<1) | b0); - } + // Send out message + onMessage(addr, msgType, msg); - onMessage(addr, msgType, outStr); + // Reset state msg.clear(); leftInLast = 0; } @@ -165,30 +168,30 @@ namespace pocsag { } else if (msgType == MESSAGE_TYPE_ALPHANUMERIC) { // Alpha messages pack 7bit characters in the entire codeword stream - // int lasti; - // for (int i = -leftInLast; i <= POCSAG_DATA_BITS_PER_CW-7; i += 7) { - // // Read 7 bits - // char c = 0; - // if (i < 0) { - // c = (lastMsgData & ((1 << (-i)) - 1)) << (7+i); - // } - // c |= (data >> (13 - i)) & 0b1111111; + int lasti; + for (int i = -leftInLast; i <= POCSAG_DATA_BITS_PER_CW-7; i += 7) { + // Read 7 bits + char c = 0; + if (i < 0) { + c = (lastMsgData & ((1 << (-i)) - 1)) << (7+i); + } + c |= (data >> (13 - i)) & 0b1111111; - // // Save character - // bitswapChar(c, c); - // msg += c; + // Save character + bitswapChar(c, c); + msg += c; - // // Update last successful unpack - // lasti = i; - // } - - // Pack the bits backwards - for (int i = 19; i >= 0; i--) { - msg += (char)((data >> i) & 1); + // Update last successful unpack + lasti = i; } // Save how much is still left to read - //leftInLast = 20 - (lasti + 7); + leftInLast = 20 - (lasti + 7); + + // // Pack the bits backwards + // for (int i = 19; i >= 0; i--) { + // msg += (char)((data >> i) & 1); + // } } // Save last data diff --git a/make_windows_package.ps1 b/make_windows_package.ps1 index 91a75320..64b73466 100644 --- a/make_windows_package.ps1 +++ b/make_windows_package.ps1 @@ -79,6 +79,8 @@ cp $build_dir/misc_modules/discord_integration/Release/discord_integration.dll s cp $build_dir/misc_modules/frequency_manager/Release/frequency_manager.dll sdrpp_windows_x64/modules/ +cp $build_dir/misc_modules/iq_exporter/Release/iq_exporter.dll sdrpp_windows_x64/modules/ + cp $build_dir/misc_modules/recorder/Release/recorder.dll sdrpp_windows_x64/modules/ cp $build_dir/misc_modules/rigctl_client/Release/rigctl_client.dll sdrpp_windows_x64/modules/ From d84bb9bdec3ba44ddac76e35bd5146433653eb8a Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 2 Feb 2024 23:07:13 +0100 Subject: [PATCH 03/56] fix module not enabled --- CMakeLists.txt | 2 +- readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a038a103..3acf973b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ option(OPT_BUILD_WEATHER_SAT_DECODER "Build the HRPT decoder module (no dependen # Misc option(OPT_BUILD_DISCORD_PRESENCE "Build the Discord Rich Presence module" ON) option(OPT_BUILD_FREQUENCY_MANAGER "Build the Frequency Manager module" ON) -option(OPT_BUILD_IQ_EXPORTER "Build the IQ Exporter module" OFF) +option(OPT_BUILD_IQ_EXPORTER "Build the IQ Exporter module" ON) option(OPT_BUILD_RECORDER "Audio and baseband recorder" ON) option(OPT_BUILD_RIGCTL_CLIENT "Rigctl client to make SDR++ act as a panadapter" ON) option(OPT_BUILD_RIGCTL_SERVER "Rigctl backend for controlling SDR++ with software like gpredict" ON) diff --git a/readme.md b/readme.md index ae681271..a22e6820 100644 --- a/readme.md +++ b/readme.md @@ -377,7 +377,7 @@ Modules in beta are still included in releases for the most part but not enabled |---------------------|------------|--------------|-----------------------------|:----------------:|:----------------:|:---------------------------:| | discord_integration | Working | - | OPT_BUILD_DISCORD_PRESENCE | ✅ | ✅ | ⛔ | | frequency_manager | Working | - | OPT_BUILD_FREQUENCY_MANAGER | ✅ | ✅ | ✅ | -| iq_exporter | Unfinished | - | OPT_BUILD_IQ_EXPORTER | ⛔ | ⛔ | ⛔ | +| iq_exporter | Unfinished | - | OPT_BUILD_IQ_EXPORTER | ✅ | ✅ | ⛔ | | recorder | Working | - | OPT_BUILD_RECORDER | ✅ | ✅ | ✅ | | rigctl_client | Unfinished | - | OPT_BUILD_RIGCTL_CLIENT | ✅ | ✅ | ⛔ | | rigctl_server | Working | - | OPT_BUILD_RIGCTL_SERVER | ✅ | ✅ | ✅ | From 8029cef4dac86815993128456b75a2824f456244 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 2 Feb 2024 23:12:44 +0100 Subject: [PATCH 04/56] promote iq_exporter module to Beta status --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index a22e6820..9295f01a 100644 --- a/readme.md +++ b/readme.md @@ -377,7 +377,7 @@ Modules in beta are still included in releases for the most part but not enabled |---------------------|------------|--------------|-----------------------------|:----------------:|:----------------:|:---------------------------:| | discord_integration | Working | - | OPT_BUILD_DISCORD_PRESENCE | ✅ | ✅ | ⛔ | | frequency_manager | Working | - | OPT_BUILD_FREQUENCY_MANAGER | ✅ | ✅ | ✅ | -| iq_exporter | Unfinished | - | OPT_BUILD_IQ_EXPORTER | ✅ | ✅ | ⛔ | +| iq_exporter | Beta | - | OPT_BUILD_IQ_EXPORTER | ✅ | ✅ | ⛔ | | recorder | Working | - | OPT_BUILD_RECORDER | ✅ | ✅ | ✅ | | rigctl_client | Unfinished | - | OPT_BUILD_RIGCTL_CLIENT | ✅ | ✅ | ⛔ | | rigctl_server | Working | - | OPT_BUILD_RIGCTL_SERVER | ✅ | ✅ | ✅ | From d5fa76df063fe917954e2c8c598366912b8a2bf4 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 2 Feb 2024 23:15:58 +0100 Subject: [PATCH 05/56] removed archived decoder from readme --- readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/readme.md b/readme.md index 9295f01a..a96c2e88 100644 --- a/readme.md +++ b/readme.md @@ -362,7 +362,6 @@ Modules in beta are still included in releases for the most part but not enabled | Name | Stage | Dependencies | Option | Built by default| Built in Release | Enabled in SDR++ by default | |---------------------|------------|--------------|-------------------------------|:---------------:|:----------------:|:---------------------------:| | atv_decoder | Unfinished | - | OPT_BUILD_ATV_DECODER | ⛔ | ⛔ | ⛔ | -| dmr_decoder | Unfinished | - | OPT_BUILD_DMR_DECODER | ⛔ | ⛔ | ⛔ | | falcon9_decoder | Unfinished | ffplay | OPT_BUILD_FALCON9_DECODER | ⛔ | ⛔ | ⛔ | | kgsstv_decoder | Unfinished | - | OPT_BUILD_KGSSTV_DECODER | ⛔ | ⛔ | ⛔ | | m17_decoder | Beta | - | OPT_BUILD_M17_DECODER | ⛔ | ✅ | ⛔ | From bddfe5396f8799e9e67e3bcf3c062a70a655c89a Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sat, 3 Feb 2024 01:43:16 +0100 Subject: [PATCH 06/56] fix iq exporter config name --- .../pager_decoder/src/pocsag/pocsag.cpp | 74 +++++++++---------- misc_modules/iq_exporter/src/main.cpp | 2 +- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp b/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp index 5f98a1b1..cea144da 100644 --- a/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp +++ b/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp @@ -85,22 +85,22 @@ namespace pocsag { void Decoder::flushMessage() { if (!msg.empty()) { - // // Unpack bits - // std::string outStr = ""; - // for (int i = 0; (i+7) <= msg.size(); i += 7) { - // uint8_t b0 = msg[i]; - // uint8_t b1 = msg[i+1]; - // uint8_t b2 = msg[i+2]; - // uint8_t b3 = msg[i+3]; - // uint8_t b4 = msg[i+4]; - // uint8_t b5 = msg[i+5]; - // uint8_t b6 = msg[i+6]; - // outStr += (char)((b6<<6) | (b5<<5) | (b4<<4) | (b3<<3) | (b2<<2) | (b1<<1) | b0); - // } - // onMessage(addr, msgType, outStr); + // Unpack bits + std::string outStr = ""; + for (int i = 0; (i+7) <= msg.size(); i += 7) { + uint8_t b0 = msg[i]; + uint8_t b1 = msg[i+1]; + uint8_t b2 = msg[i+2]; + uint8_t b3 = msg[i+3]; + uint8_t b4 = msg[i+4]; + uint8_t b5 = msg[i+5]; + uint8_t b6 = msg[i+6]; + outStr += (char)((b6<<6) | (b5<<5) | (b4<<4) | (b3<<3) | (b2<<2) | (b1<<1) | b0); + } + onMessage(addr, msgType, outStr); - // Send out message - onMessage(addr, msgType, msg); + // // Send out message + // onMessage(addr, msgType, msg); // Reset state msg.clear(); @@ -167,31 +167,31 @@ namespace pocsag { //msg += NUMERIC_CHARSET[data & 0b1111]; } else if (msgType == MESSAGE_TYPE_ALPHANUMERIC) { - // Alpha messages pack 7bit characters in the entire codeword stream - int lasti; - for (int i = -leftInLast; i <= POCSAG_DATA_BITS_PER_CW-7; i += 7) { - // Read 7 bits - char c = 0; - if (i < 0) { - c = (lastMsgData & ((1 << (-i)) - 1)) << (7+i); - } - c |= (data >> (13 - i)) & 0b1111111; + // // Alpha messages pack 7bit characters in the entire codeword stream + // int lasti; + // for (int i = -leftInLast; i <= POCSAG_DATA_BITS_PER_CW-7; i += 7) { + // // Read 7 bits + // char c = 0; + // if (i < 0) { + // c = (lastMsgData & ((1 << (-i)) - 1)) << (7+i); + // } + // c |= (data >> (13 - i)) & 0b1111111; - // Save character - bitswapChar(c, c); - msg += c; + // // Save character + // bitswapChar(c, c); + // msg += c; - // Update last successful unpack - lasti = i; - } - - // Save how much is still left to read - leftInLast = 20 - (lasti + 7); - - // // Pack the bits backwards - // for (int i = 19; i >= 0; i--) { - // msg += (char)((data >> i) & 1); + // // Update last successful unpack + // lasti = i; // } + + // // Save how much is still left to read + // leftInLast = 20 - (lasti + 7); + + // Pack the bits backwards + for (int i = 19; i >= 0; i--) { + msg += (char)((data >> i) & 1); + } } // Save last data diff --git a/misc_modules/iq_exporter/src/main.cpp b/misc_modules/iq_exporter/src/main.cpp index a4b6db67..4f8ec61d 100644 --- a/misc_modules/iq_exporter/src/main.cpp +++ b/misc_modules/iq_exporter/src/main.cpp @@ -570,7 +570,7 @@ private: MOD_EXPORT void _INIT_() { json def = json({}); std::string root = (std::string)core::args["root"]; - config.setPath(root + "/iq_exporter_config_config.json"); + config.setPath(root + "/iq_exporter_config.json"); config.load(def); config.enableAutoSave(); } From f66f2c25e1d35f675db86905b1166c25fb929f42 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 5 Feb 2024 16:46:08 +0100 Subject: [PATCH 07/56] improve pocsag alpha decoding --- CMakeLists.txt | 2 +- .../pager_decoder/src/pocsag/pocsag.cpp | 69 ++++++------------- .../pager_decoder/src/pocsag/pocsag.h | 4 +- 3 files changed, 23 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3acf973b..94a782bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ option(OPT_BUILD_FALCON9_DECODER "Build the falcon9 live decoder (Dependencies: option(OPT_BUILD_KG_SSTV_DECODER "Build the KG SSTV (KG-STV) decoder module (no dependencies required)" OFF) option(OPT_BUILD_M17_DECODER "Build the M17 decoder module (Dependencies: codec2)" OFF) option(OPT_BUILD_METEOR_DEMODULATOR "Build the meteor demodulator module (no dependencies required)" ON) -option(OPT_BUILD_PAGER_DECODER "Build the pager decoder module (no dependencies required)" OFF) +option(OPT_BUILD_PAGER_DECODER "Build the pager decoder module (no dependencies required)" ON) option(OPT_BUILD_RADIO "Main audio modulation decoder (AM, FM, SSB, etc...)" ON) option(OPT_BUILD_WEATHER_SAT_DECODER "Build the HRPT decoder module (no dependencies required)" OFF) diff --git a/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp b/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp index cea144da..41dda240 100644 --- a/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp +++ b/decoder_modules/pager_decoder/src/pocsag/pocsag.cpp @@ -84,27 +84,13 @@ namespace pocsag { void Decoder::flushMessage() { if (!msg.empty()) { - - // Unpack bits - std::string outStr = ""; - for (int i = 0; (i+7) <= msg.size(); i += 7) { - uint8_t b0 = msg[i]; - uint8_t b1 = msg[i+1]; - uint8_t b2 = msg[i+2]; - uint8_t b3 = msg[i+3]; - uint8_t b4 = msg[i+4]; - uint8_t b5 = msg[i+5]; - uint8_t b6 = msg[i+6]; - outStr += (char)((b6<<6) | (b5<<5) | (b4<<4) | (b3<<3) | (b2<<2) | (b1<<1) | b0); - } - onMessage(addr, msgType, outStr); - - // // Send out message - // onMessage(addr, msgType, msg); + // Send out message + onMessage(addr, msgType, msg); // Reset state msg.clear(); - leftInLast = 0; + currChar = 0; + currOffset = 0; } } @@ -160,42 +146,27 @@ namespace pocsag { // Decode data depending on message type if (msgType == MESSAGE_TYPE_NUMERIC) { // Numeric messages pack 5 characters per message codeword - //msg += NUMERIC_CHARSET[(data >> 16) & 0b1111]; - //msg += NUMERIC_CHARSET[(data >> 12) & 0b1111]; - //msg += NUMERIC_CHARSET[(data >> 8) & 0b1111]; - //msg += NUMERIC_CHARSET[(data >> 4) & 0b1111]; - //msg += NUMERIC_CHARSET[data & 0b1111]; + msg += NUMERIC_CHARSET[(data >> 16) & 0b1111]; + msg += NUMERIC_CHARSET[(data >> 12) & 0b1111]; + msg += NUMERIC_CHARSET[(data >> 8) & 0b1111]; + msg += NUMERIC_CHARSET[(data >> 4) & 0b1111]; + msg += NUMERIC_CHARSET[data & 0b1111]; } else if (msgType == MESSAGE_TYPE_ALPHANUMERIC) { - // // Alpha messages pack 7bit characters in the entire codeword stream - // int lasti; - // for (int i = -leftInLast; i <= POCSAG_DATA_BITS_PER_CW-7; i += 7) { - // // Read 7 bits - // char c = 0; - // if (i < 0) { - // c = (lastMsgData & ((1 << (-i)) - 1)) << (7+i); - // } - // c |= (data >> (13 - i)) & 0b1111111; - - // // Save character - // bitswapChar(c, c); - // msg += c; - - // // Update last successful unpack - // lasti = i; - // } - - // // Save how much is still left to read - // leftInLast = 20 - (lasti + 7); - - // Pack the bits backwards + // Unpack ascii bits 7 at a time (TODO: could be more efficient) for (int i = 19; i >= 0; i--) { - msg += (char)((data >> i) & 1); + // Append bit to char + currChar |= ((data >> i) & 1) << (currOffset++); + + // When the char is full, append to message + if (currOffset >= 7) { + // TODO: maybe replace with std::isprint + if (currChar) { msg += currChar; } + currChar = 0; + currOffset = 0; + } } } - - // Save last data - lastMsgData = data; } } } diff --git a/decoder_modules/pager_decoder/src/pocsag/pocsag.h b/decoder_modules/pager_decoder/src/pocsag/pocsag.h index 6452f59c..d464f672 100644 --- a/decoder_modules/pager_decoder/src/pocsag/pocsag.h +++ b/decoder_modules/pager_decoder/src/pocsag/pocsag.h @@ -45,7 +45,7 @@ namespace pocsag { MessageType msgType; std::string msg; - uint32_t lastMsgData; - bool leftInLast = 0; + char currChar = 0; + int currOffset = 0; }; } \ No newline at end of file From c0a84f870374567cab8e8497fb5f243590ddb106 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Tue, 6 Feb 2024 22:16:21 +0100 Subject: [PATCH 08/56] pocsag menu cleanup --- decoder_modules/pager_decoder/src/pocsag/decoder.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/decoder_modules/pager_decoder/src/pocsag/decoder.h b/decoder_modules/pager_decoder/src/pocsag/decoder.h index 506f8770..9807e6d3 100644 --- a/decoder_modules/pager_decoder/src/pocsag/decoder.h +++ b/decoder_modules/pager_decoder/src/pocsag/decoder.h @@ -8,13 +8,6 @@ #include "dsp.h" #include "pocsag.h" -const char* msgTypes[] = { - "Numeric", - "Unknown (0b01)", - "Unknown (0b10)", - "Alphanumeric", -}; - #define BAUDRATE 2400 #define SAMPLERATE (BAUDRATE*10) @@ -68,7 +61,6 @@ public: } void start() { - flog::debug("POCSAG start"); dsp.start(); reshape.start(); dataHandler.start(); @@ -76,7 +68,6 @@ public: } void stop() { - flog::debug("POCSAG stop"); dsp.stop(); reshape.stop(); dataHandler.stop(); From 63aa45de9ecbfc17108ba16ce64158508c333253 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 8 Feb 2024 09:03:46 +0100 Subject: [PATCH 09/56] beginning of new pager clock recovery --- .../pager_decoder/src/pocsag/decoder.h | 4 +- .../pager_decoder/src/pocsag/dsp.h | 102 ++++++++++- .../src/pocsag/packet_clock_sync.h | 164 ++++++++++++++++++ 3 files changed, 263 insertions(+), 7 deletions(-) create mode 100644 decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h diff --git a/decoder_modules/pager_decoder/src/pocsag/decoder.h b/decoder_modules/pager_decoder/src/pocsag/decoder.h index 9807e6d3..d861f00a 100644 --- a/decoder_modules/pager_decoder/src/pocsag/decoder.h +++ b/decoder_modules/pager_decoder/src/pocsag/decoder.h @@ -13,7 +13,7 @@ class POCSAGDecoder : public Decoder { public: - POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, BAUDRATE) { + POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, 320) { this->name = name; this->vfo = vfo; @@ -26,7 +26,7 @@ public: vfo->setBandwidthLimits(12500, 12500, true); vfo->setSampleRate(SAMPLERATE, 12500); dsp.init(vfo->output, SAMPLERATE, BAUDRATE); - reshape.init(&dsp.soft, BAUDRATE, (BAUDRATE / 30.0) - BAUDRATE); + reshape.init(&dsp.soft, 320, 0); dataHandler.init(&dsp.out, _dataHandler, this); diagHandler.init(&reshape.out, _diagHandler, this); diff --git a/decoder_modules/pager_decoder/src/pocsag/dsp.h b/decoder_modules/pager_decoder/src/pocsag/dsp.h index 8b15c349..ae4ad949 100644 --- a/decoder_modules/pager_decoder/src/pocsag/dsp.h +++ b/decoder_modules/pager_decoder/src/pocsag/dsp.h @@ -11,6 +11,89 @@ #include #include +#include "packet_clock_sync.h" + +inline float PATTERN_DSDSDZED[] = { + -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, + -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, + 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 8.00000000e-01, + 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, + -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -8.00000000e-01, + -6.00000000e-01, -4.00000000e-01, -2.00000000e-01, -2.77555756e-17, + 2.00000000e-01, 4.00000000e-01, 6.00000000e-01, 8.00000000e-01, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 8.00000000e-01, + 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, + -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, + -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, + -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, + 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 8.00000000e-01, + 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, + -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -8.00000000e-01, + -6.00000000e-01, -4.00000000e-01, -2.00000000e-01, -2.77555756e-17, + 2.00000000e-01, 4.00000000e-01, 6.00000000e-01, 8.00000000e-01, + 1.00000000e+00, 8.00000000e-01, 6.00000000e-01, 4.00000000e-01, + 2.00000000e-01, 2.77555756e-17, -2.00000000e-01, -4.00000000e-01, + -6.00000000e-01, -8.00000000e-01, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, + -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, + 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 8.00000000e-01, + 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, + -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, + -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, + -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, + 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 8.00000000e-01, + 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, + -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, + -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, + -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, + 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 8.00000000e-01, + 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, + -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, + -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, + -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, + 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, + 1.00000000e+00, 8.00000000e-01, 6.00000000e-01, 4.00000000e-01, + 2.00000000e-01, 2.77555756e-17, -2.00000000e-01, -4.00000000e-01, + -6.00000000e-01, -8.00000000e-01, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, + -1.00000000e+00, -1.00000000e+00, -1.00000000e+00 +}; + class POCSAGDSP : public dsp::Processor { using base_type = dsp::Processor; public: @@ -27,7 +110,9 @@ public: float taps[] = { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f }; shape = dsp::taps::fromArray(10, taps); fir.init(NULL, shape); - recov.init(NULL, samplerate/baudrate, 1e-4, 1.0, 0.05); + //recov.init(NULL, samplerate/baudrate, 1e-4, 1.0, 0.05); + + cs.init(NULL, PATTERN_DSDSDZED, sizeof(PATTERN_DSDSDZED)/sizeof(float), 0, 10); // Free useless buffers // dcBlock.out.free(); @@ -42,8 +127,11 @@ public: count = demod.process(count, in, demod.out.readBuf); //count = dcBlock.process(count, demod.out.readBuf, demod.out.readBuf); count = fir.process(count, demod.out.readBuf, demod.out.readBuf); - count = recov.process(count, demod.out.readBuf, softOut); - dsp::digital::BinarySlicer::process(count, softOut, out); + //count = recov.process(count, demod.out.readBuf, softOut); + + count = cs.process(count, demod.out.readBuf, softOut); + + //dsp::digital::BinarySlicer::process(count, softOut, out); return count; } @@ -58,8 +146,10 @@ public: count = process(count, base_type::_in->readBuf, soft.writeBuf, base_type::out.writeBuf); base_type::_in->flush(); - if (!base_type::out.swap(count)) { return -1; } - if (!soft.swap(count)) { return -1; } + //if (!base_type::out.swap(count)) { return -1; } + + if (count) { if (!soft.swap(count)) { return -1; } } + return count; } @@ -72,4 +162,6 @@ private: dsp::filter::FIR fir; dsp::clock_recovery::MM recov; + dsp::PacketClockSync cs; + }; \ No newline at end of file diff --git a/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h b/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h new file mode 100644 index 00000000..42a57f5b --- /dev/null +++ b/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h @@ -0,0 +1,164 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace dsp { + class PacketClockSync : public dsp::Processor { + using base_type = dsp::Processor; + public: + PacketClockSync() {} + PacketClockSync(dsp::stream* in, float* pattern, int patternLen, int frameLen, float sampsPerSym, float threshold = 0.4f) { init(in, pattern, patternLen, frameLen, sampsPerSym, threshold); } + + // TODO: Free in destroyer + + void init(dsp::stream* in, float* pattern, int patternLen, int frameLen, float sampsPerSym, float threshold = 0.4f) { + // Compute the required FFT size and associated delay length + fftSize = 512;// TODO: Find smallest power of 2 that fits patternLen + delayLen = fftSize - 1; + + // Allocate buffers + buffer = dsp::buffer::alloc(STREAM_BUFFER_SIZE+delayLen); + bufferStart = &buffer[delayLen]; + this->pattern = dsp::buffer::alloc(patternLen); + patternFFT = dsp::buffer::alloc(fftSize); + patternFFTAmps = dsp::buffer::alloc(fftSize); + fftIn = fftwf_alloc_real(fftSize); + fftOut = (complex_t*)fftwf_alloc_complex(fftSize); + + // Copy parameters + memcpy(this->pattern, pattern, patternLen*sizeof(float)); + this->sampsPerSym = sampsPerSym; + this->threshold = threshold; + this->patternLen = patternLen; + + // Plan FFT + plan = fftwf_plan_dft_r2c_1d(fftSize, fftIn, (fftwf_complex*)fftOut, FFTW_ESTIMATE); + + // Pre-compute pattern conjugated FFT + // TODO: Offset the pattern to avoid it being cut off (EXTREMELY IMPORTANT) + memcpy(fftIn, pattern, patternLen*sizeof(float)); + memset(&fftIn[patternLen], 0, (fftSize-patternLen)*sizeof(float)); + fftwf_execute(plan); + volk_32fc_conjugate_32fc((lv_32fc_t*)patternFFT, (lv_32fc_t*)fftOut, fftSize); + + // Compute amplitudes of the pattern FFT + volk_32fc_magnitude_32f(patternFFTAmps, (lv_32fc_t*)patternFFT, fftSize); + + // Normalize the amplitudes + float maxAmp = 0.0f; + for (int i = 0; i < patternLen; i++) { + if (patternFFTAmps[i] > maxAmp) { maxAmp = patternFFTAmps[i]; } + } + volk_32f_s32f_multiply_32f(patternFFTAmps, patternFFTAmps, 1.0f/maxAmp, fftSize); + + // Init base + base_type::init(in); + } + + int process(int count, float* in, float* out) { + // Copy to buffer + memcpy(bufferStart, in, count * sizeof(float)); + + int outCount = 0; + bool first = true; + + for (int i = 0; i < count; i++) { + // Measure correlation to the sync pattern + float corr; + volk_32f_x2_dot_prod_32f(&corr, &buffer[i], pattern, patternLen); + + // If not correlated enough, go to next sample. Otherwise continue with fine detection + if (corr/(float)patternLen < threshold) { continue; } + + // Copy samples into FFT input (only the part where we think the pattern is located) + // TODO: Instead, check the interval onto which correlation occurs to determine where the pattern is located (IMPORTANT) + memcpy(fftIn, &buffer[i], patternLen*sizeof(float)); + memset(&fftIn[patternLen], 0, (fftSize-patternLen)*sizeof(float)); // TODO, figure out why we need this + + // Compute FFT + fftwf_execute(plan); + + // Multiply with the conjugated pattern FFT to get the phase offset at each frequency + volk_32fc_x2_multiply_32fc((lv_32fc_t*)fftOut, (lv_32fc_t*)fftOut, (lv_32fc_t*)patternFFT, fftSize); + + // Compute the average phase delay rate + float last = 0; + float rateIntegral = 0; + for (int j = 1; j < fftSize/2; j++) { + // Compute instantanous rate + float currentPhase = fftOut[j].phase(); + float instantRate = dsp::math::normalizePhase(currentPhase - last); + last = currentPhase; + + // Compute current rate guess + float rateGuess = rateIntegral / (float)j; + + // Update the rate integral as a weighted average of the current guess and measured rate depending on pattern amplitude + rateIntegral += patternFFTAmps[j]*instantRate + (1.0f-patternFFTAmps[j])*rateGuess; + } + float avgRate = 1.14f*rateIntegral/(float)(fftSize/2); + + // Compute the total offset + float offset = (float)i - avgRate*(float)fftSize/(2.0f*FL_M_PI); + + if (first) { + outCount = 320; + memcpy(out, &buffer[(int)roundf(offset)], 320*sizeof(float)); + first = false; + } + + + flog::debug("Detected: {} -> {} ({})", i, offset, avgRate); + } + + // Move unused data + memmove(buffer, &buffer[count], delayLen * sizeof(float)); + + return outCount; + } + + int run() { + int count = base_type::_in->read(); + if (count < 0) { return -1; } + + count = process(count, base_type::_in->readBuf, base_type::out.writeBuf); + + base_type::_in->flush(); + //if (!base_type::out.swap(count)) { return -1; } + return count; + } + + private: + int delayLen; + float* buffer = NULL; + float* bufferStart = NULL; + float* pattern = NULL; + int patternLen; + bool locked; + int fftSize; + + float threshold; + + float* fftIn = NULL; + complex_t* fftOut = NULL; + fftwf_plan plan; + + complex_t* patternFFT; + float* patternFFTAmps; + + float sampsPerSym; + }; +} \ No newline at end of file From daf0f8c159c00f1535022107305a9157a681d94f Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 8 Feb 2024 14:17:35 +0100 Subject: [PATCH 10/56] more work on new clock recovery --- .../pager_decoder/src/pocsag/decoder.h | 4 +- .../pager_decoder/src/pocsag/dsp.h | 2 +- .../src/pocsag/packet_clock_sync.h | 87 +++++++++++++++---- 3 files changed, 75 insertions(+), 18 deletions(-) diff --git a/decoder_modules/pager_decoder/src/pocsag/decoder.h b/decoder_modules/pager_decoder/src/pocsag/decoder.h index d861f00a..672bed3d 100644 --- a/decoder_modules/pager_decoder/src/pocsag/decoder.h +++ b/decoder_modules/pager_decoder/src/pocsag/decoder.h @@ -13,7 +13,7 @@ class POCSAGDecoder : public Decoder { public: - POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, 320) { + POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, 544) { this->name = name; this->vfo = vfo; @@ -26,7 +26,7 @@ public: vfo->setBandwidthLimits(12500, 12500, true); vfo->setSampleRate(SAMPLERATE, 12500); dsp.init(vfo->output, SAMPLERATE, BAUDRATE); - reshape.init(&dsp.soft, 320, 0); + reshape.init(&dsp.soft, 544, 0); dataHandler.init(&dsp.out, _dataHandler, this); diagHandler.init(&reshape.out, _diagHandler, this); diff --git a/decoder_modules/pager_decoder/src/pocsag/dsp.h b/decoder_modules/pager_decoder/src/pocsag/dsp.h index ae4ad949..f5d10a6f 100644 --- a/decoder_modules/pager_decoder/src/pocsag/dsp.h +++ b/decoder_modules/pager_decoder/src/pocsag/dsp.h @@ -112,7 +112,7 @@ public: fir.init(NULL, shape); //recov.init(NULL, samplerate/baudrate, 1e-4, 1.0, 0.05); - cs.init(NULL, PATTERN_DSDSDZED, sizeof(PATTERN_DSDSDZED)/sizeof(float), 0, 10); + cs.init(NULL, PATTERN_DSDSDZED, sizeof(PATTERN_DSDSDZED)/sizeof(float), 544, 10); // Free useless buffers // dcBlock.out.free(); diff --git a/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h b/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h index 42a57f5b..e5367f57 100644 --- a/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h +++ b/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h @@ -43,6 +43,7 @@ namespace dsp { this->sampsPerSym = sampsPerSym; this->threshold = threshold; this->patternLen = patternLen; + this->frameLen = frameLen; // Plan FFT plan = fftwf_plan_dft_r2c_1d(fftSize, fftIn, (fftwf_complex*)fftOut, FFTW_ESTIMATE); @@ -59,11 +60,16 @@ namespace dsp { // Normalize the amplitudes float maxAmp = 0.0f; - for (int i = 0; i < patternLen; i++) { + for (int i = 0; i < fftSize/2; i++) { if (patternFFTAmps[i] > maxAmp) { maxAmp = patternFFTAmps[i]; } } volk_32f_s32f_multiply_32f(patternFFTAmps, patternFFTAmps, 1.0f/maxAmp, fftSize); + // Initialize the phase control loop + float omegaRelLimit = 0.05; + pcl.init(1, 10e-4, 0.0, 0.0, 1.0, sampsPerSym, sampsPerSym * (1.0 - omegaRelLimit), sampsPerSym * (1.0 + omegaRelLimit)); + generateInterpTaps(); + // Init base base_type::init(in); } @@ -72,21 +78,55 @@ namespace dsp { // Copy to buffer memcpy(bufferStart, in, count * sizeof(float)); - int outCount = 0; - bool first = true; + int outCount = 0; + + for (int i = 0; i < count;) { + // Run clock recovery if needed + while (toRead) { + // Interpolate symbol + float symbol; + int phase = std::clamp(floorf(pcl.phase * (float)interpPhaseCount), 0, interpPhaseCount - 1); + volk_32f_x2_dot_prod_32f(&symbol, &buffer[offsetInt], interpBank.phases[phase], interpTapCount); + out[outCount++] = symbol; + + // Compute symbol phase error + float error = (math::step(lastSymbol) * symbol) - (lastSymbol * math::step(symbol)); + lastSymbol = symbol; + + // Clamp symbol phase error + if (error > 1.0f) { error = 1.0f; } + if (error < -1.0f) { error = -1.0f; } + + // Advance symbol offset and phase + pcl.advance(error); + float delta = floorf(pcl.phase); + offsetInt += delta; + i = offsetInt; + pcl.phase -= delta; + + // Decrement read counter + toRead--; + + if (offsetInt >= count) { + offsetInt -= count; + break; + } + } + - for (int i = 0; i < count; i++) { // Measure correlation to the sync pattern float corr; volk_32f_x2_dot_prod_32f(&corr, &buffer[i], pattern, patternLen); // If not correlated enough, go to next sample. Otherwise continue with fine detection - if (corr/(float)patternLen < threshold) { continue; } + if (corr/(float)patternLen < threshold) { + i++; + continue; + } // Copy samples into FFT input (only the part where we think the pattern is located) // TODO: Instead, check the interval onto which correlation occurs to determine where the pattern is located (IMPORTANT) memcpy(fftIn, &buffer[i], patternLen*sizeof(float)); - memset(&fftIn[patternLen], 0, (fftSize-patternLen)*sizeof(float)); // TODO, figure out why we need this // Compute FFT fftwf_execute(plan); @@ -113,15 +153,15 @@ namespace dsp { // Compute the total offset float offset = (float)i - avgRate*(float)fftSize/(2.0f*FL_M_PI); + flog::debug("Detected: {} -> {}", i, offset); - if (first) { - outCount = 320; - memcpy(out, &buffer[(int)roundf(offset)], 320*sizeof(float)); - first = false; - } - + // Initialize clock recovery + offsetInt = floorf(offset) - 3; // TODO: Will be negative sometimes, has to be taken into account + pcl.phase = offset - (float)floorf(offset); + pcl.freq = sampsPerSym; - flog::debug("Detected: {} -> {} ({})", i, offset, avgRate); + // Start reading symbols + toRead = frameLen; } // Move unused data @@ -137,11 +177,20 @@ namespace dsp { count = process(count, base_type::_in->readBuf, base_type::out.writeBuf); base_type::_in->flush(); - //if (!base_type::out.swap(count)) { return -1; } + if (count) { + if (!base_type::out.swap(count)) { return -1; } + } return count; } private: + void generateInterpTaps() { + double bw = 0.5 / (double)interpPhaseCount; + dsp::tap lp = dsp::taps::windowedSinc(interpPhaseCount * interpTapCount, dsp::math::hzToRads(bw, 1.0), dsp::window::nuttall, interpPhaseCount); + interpBank = dsp::multirate::buildPolyphaseBank(interpPhaseCount, lp); + taps::free(lp); + } + int delayLen; float* buffer = NULL; float* bufferStart = NULL; @@ -149,7 +198,7 @@ namespace dsp { int patternLen; bool locked; int fftSize; - + int frameLen; float threshold; float* fftIn = NULL; @@ -160,5 +209,13 @@ namespace dsp { float* patternFFTAmps; float sampsPerSym; + int toRead = 0; + + loop::PhaseControlLoop pcl; + dsp::multirate::PolyphaseBank interpBank; + int interpTapCount = 8; + int interpPhaseCount = 128; + float lastSymbol = 0.0f; + int offsetInt; }; } \ No newline at end of file From ba5380f9bb90a761ea023d29f6ecba99773e16be Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 8 Feb 2024 15:01:11 +0100 Subject: [PATCH 11/56] started work on the network source --- CMakeLists.txt | 5 + readme.md | 1 + source_modules/network_source/CMakeLists.txt | 6 + source_modules/network_source/src/main.cpp | 334 +++++++++++++++++++ 4 files changed, 346 insertions(+) create mode 100644 source_modules/network_source/CMakeLists.txt create mode 100644 source_modules/network_source/src/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 94a782bc..0c82dbb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ option(OPT_BUILD_FILE_SOURCE "Wav file source" ON) option(OPT_BUILD_HACKRF_SOURCE "Build HackRF Source Module (Dependencies: libhackrf)" ON) option(OPT_BUILD_HERMES_SOURCE "Build Hermes Source Module (no dependencies required)" ON) option(OPT_BUILD_LIMESDR_SOURCE "Build LimeSDR Source Module (Dependencies: liblimesuite)" OFF) +option(OPT_BUILD_NETWORK_SOURCE "Build Network Source Module (no dependencies required)" on) option(OPT_BUILD_PERSEUS_SOURCE "Build Perseus Source Module (Dependencies: libperseus-sdr)" OFF) option(OPT_BUILD_PLUTOSDR_SOURCE "Build PlutoSDR Source Module (Dependencies: libiio, libad9361)" ON) option(OPT_BUILD_RFSPACE_SOURCE "Build RFspace Source Module (no dependencies required)" ON) @@ -144,6 +145,10 @@ if (OPT_BUILD_LIMESDR_SOURCE) add_subdirectory("source_modules/limesdr_source") endif (OPT_BUILD_LIMESDR_SOURCE) +if (OPT_BUILD_NETWORK_SOURCE) +add_subdirectory("source_modules/network_source") +endif (OPT_BUILD_NETWORK_SOURCE) + if (OPT_BUILD_PERSEUS_SOURCE) add_subdirectory("source_modules/perseus_source") endif (OPT_BUILD_PERSEUS_SOURCE) diff --git a/readme.md b/readme.md index a96c2e88..785c1420 100644 --- a/readme.md +++ b/readme.md @@ -334,6 +334,7 @@ Modules in beta are still included in releases for the most part but not enabled | hackrf_source | Working | libhackrf | OPT_BUILD_HACKRF_SOURCE | ✅ | ✅ | ✅ | | hermes_source | Beta | - | OPT_BUILD_HERMES_SOURCE | ✅ | ✅ | ✅ | | limesdr_source | Working | liblimesuite | OPT_BUILD_LIMESDR_SOURCE | ⛔ | ✅ | ✅ | +| network_source | Unfinished | - | OPT_BUILD_NETWORK_SOURCE | ✅ | ✅ | ⛔ | | perseus_source | Beta | libperseus-sdr | OPT_BUILD_PERSEUS_SOURCE | ⛔ | ✅ | ✅ | | plutosdr_source | Working | libiio, libad9361 | OPT_BUILD_PLUTOSDR_SOURCE | ✅ | ✅ | ✅ | | rfspace_source | Working | - | OPT_BUILD_RFSPACE_SOURCE | ✅ | ✅ | ✅ | diff --git a/source_modules/network_source/CMakeLists.txt b/source_modules/network_source/CMakeLists.txt new file mode 100644 index 00000000..9822e0e8 --- /dev/null +++ b/source_modules/network_source/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.13) +project(network_source) + +file(GLOB SRC "src/*.cpp") + +include(${SDRPP_MODULE_CMAKE}) \ No newline at end of file diff --git a/source_modules/network_source/src/main.cpp b/source_modules/network_source/src/main.cpp new file mode 100644 index 00000000..6da46ed1 --- /dev/null +++ b/source_modules/network_source/src/main.cpp @@ -0,0 +1,334 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CONCAT(a, b) ((std::string(a) + b).c_str()) + +SDRPP_MOD_INFO{ + /* Name: */ "network_source", + /* Description: */ "UDP/TCP Source Module", + /* Author: */ "Ryzerth", + /* Version: */ 0, 1, 0, + /* Max instances */ 1 +}; + +ConfigManager config; + +enum Protocol { + PROTOCOL_TCP_SERVER, + PROTOCOL_TCP_CLIENT, + PROTOCOL_UDP +}; + +enum SampleType { + SAMPLE_TYPE_INT8, + SAMPLE_TYPE_INT16, + SAMPLE_TYPE_INT32, + SAMPLE_TYPE_FLOAT32 +}; + +class NetworkSourceModule : public ModuleManager::Instance { +public: + NetworkSourceModule(std::string name) { + this->name = name; + + samplerate = 1000000.0; + + handler.ctx = this; + handler.selectHandler = menuSelected; + handler.deselectHandler = menuDeselected; + handler.menuHandler = menuHandler; + handler.startHandler = start; + handler.stopHandler = stop; + handler.tuneHandler = tune; + handler.stream = &stream; + + // Define samplerates + for (int i = 3000; i <= 192000; i <<= 1) { + samplerates.define(i, getSrScaled(i), i); + } + for (int i = 250000; i < 1000000; i += 250000) { + samplerates.define(i, getSrScaled(i), i); + } + for (int i = 1000000; i < 10000000; i += 500000) { + samplerates.define(i, getSrScaled(i), i); + } + for (int i = 10000000; i <= 100000000; i += 5000000) { + samplerates.define(i, getSrScaled(i), i); + } + + // Define protocols + protocols.define("TCP (Server)", PROTOCOL_TCP_SERVER); + protocols.define("TCP (Client)", PROTOCOL_TCP_CLIENT); + protocols.define("UDP", PROTOCOL_UDP); + + // Define sample types + sampleTypes.define("Int8", SAMPLE_TYPE_INT8); + sampleTypes.define("Int16", SAMPLE_TYPE_INT16); + sampleTypes.define("Int32", SAMPLE_TYPE_INT32); + sampleTypes.define("Float32", SAMPLE_TYPE_FLOAT32); + + // Load config + config.acquire(); + if (config.conf[name].contains("samplerate")) { + int sr = config.conf[name]["samplerate"]; + if (samplerates.keyExists(sr)) { samplerate = samplerates.value(samplerates.keyId(sr)); } + } + if (config.conf[name].contains("protocol")) { + std::string protoStr = config.conf[name]["protocol"]; + if (protocols.keyExists(protoStr)) { proto = protocols.value(protocols.keyId(protoStr)); } + } + if (config.conf[name].contains("sampleType")) { + std::string sampTypeStr = config.conf[name]["sampleType"]; + if (sampleTypes.keyExists(sampTypeStr)) { sampType = sampleTypes.value(sampleTypes.keyId(sampTypeStr)); } + } + if (config.conf[name].contains("host")) { + std::string hostStr = config.conf[name]["host"]; + strcpy(hostname, hostStr.c_str()); + } + if (config.conf[name].contains("port")) { + port = config.conf[name]["port"]; + port = std::clamp(port, 1, 65535); + } + config.release(); + + // Set menu IDs + srId = samplerates.valueId(samplerate); + protoId = protocols.valueId(proto); + sampTypeId = sampleTypes.valueId(sampType); + + sigpath::sourceManager.registerSource("Network", &handler); + } + + ~NetworkSourceModule() { + stop(this); + sigpath::sourceManager.unregisterSource("Network"); + } + + void postInit() {} + + void enable() { + enabled = true; + } + + void disable() { + enabled = false; + } + + bool isEnabled() { + return enabled; + } + +private: + std::string getSrScaled(double sr) { + char buf[1024]; + if (sr >= 1000000.0) { + sprintf(buf, "%.1lf MS/s", sr / 1000000.0); + } + else if (sr >= 1000.0) { + sprintf(buf, "%.1lf KS/s", sr / 1000.0); + } + else { + sprintf(buf, "%.1lf S/s", sr); + } + return std::string(buf); + } + + static void menuSelected(void* ctx) { + NetworkSourceModule* _this = (NetworkSourceModule*)ctx; + core::setInputSampleRate(_this->samplerate); + flog::info("NetworkSourceModule '{0}': Menu Select!", _this->name); + } + + static void menuDeselected(void* ctx) { + NetworkSourceModule* _this = (NetworkSourceModule*)ctx; + flog::info("NetworkSourceModule '{0}': Menu Deselect!", _this->name); + } + + static void start(void* ctx) { + NetworkSourceModule* _this = (NetworkSourceModule*)ctx; + if (_this->running) { return; } + + // TODO + + _this->running = true; + flog::info("NetworkSourceModule '{0}': Start!", _this->name); + } + + static void stop(void* ctx) { + NetworkSourceModule* _this = (NetworkSourceModule*)ctx; + if (!_this->running) { return; } + + // TODO + + _this->running = false; + flog::info("NetworkSourceModule '{0}': Stop!", _this->name); + } + + static void tune(double freq, void* ctx) { + NetworkSourceModule* _this = (NetworkSourceModule*)ctx; + if (_this->running) { + // Nothing for now + } + _this->freq = freq; + flog::info("NetworkSourceModule '{0}': Tune: {1}!", _this->name, freq); + } + + static void menuHandler(void* ctx) { + NetworkSourceModule* _this = (NetworkSourceModule*)ctx; + + if (_this->running) { SmGui::BeginDisabled(); } + + // Hostname and port field + if (ImGui::InputText(("##iq_exporter_host_" + _this->name).c_str(), _this->hostname, sizeof(_this->hostname))) { + config.acquire(); + config.conf[_this->name]["host"] = _this->hostname; + config.release(true); + } + ImGui::SameLine(); + ImGui::FillWidth(); + if (ImGui::InputInt(("##iq_exporter_port_" + _this->name).c_str(), &_this->port, 0, 0)) { + _this->port = std::clamp(_this->port, 1, 65535); + config.acquire(); + config.conf[_this->name]["port"] = _this->port; + config.release(true); + } + + // Samplerate selector + ImGui::LeftLabel("Samplerate"); + ImGui::FillWidth(); + if (ImGui::Combo(("##iq_exporter_sr_" + _this->name).c_str(), &_this->srId, _this->samplerates.txt)) { + _this->samplerate = _this->samplerates.value(_this->srId); + core::setInputSampleRate(_this->samplerate); + config.acquire(); + config.conf[_this->name]["samplerate"] = _this->samplerates.key(_this->srId); + config.release(true); + } + + // Mode protocol selector + ImGui::LeftLabel("Protocol"); + ImGui::FillWidth(); + if (ImGui::Combo(("##iq_exporter_proto_" + _this->name).c_str(), &_this->protoId, _this->protocols.txt)) { + _this->proto = _this->protocols.value(_this->protoId); + config.acquire(); + config.conf[_this->name]["protocol"] = _this->protocols.key(_this->protoId); + config.release(true); + } + + // Sample type selector + ImGui::LeftLabel("Sample type"); + ImGui::FillWidth(); + if (ImGui::Combo(("##iq_exporter_samp_" + _this->name).c_str(), &_this->sampTypeId, _this->sampleTypes.txt)) { + _this->sampType = _this->sampleTypes.value(_this->sampTypeId); + config.acquire(); + config.conf[_this->name]["sampleType"] = _this->sampleTypes.key(_this->sampTypeId); + config.release(true); + } + + if (_this->running) { SmGui::EndDisabled(); } + } + + void worker() { + int frameSize = samplerate / 200; + switch (sampType) { + case SAMPLE_TYPE_INT8: + frameSize *= 2*sizeof(int8_t);; + break; + case SAMPLE_TYPE_INT16: + frameSize *= 2*sizeof(int16_t); + break; + case SAMPLE_TYPE_INT32: + frameSize *= 2*sizeof(int32_t); + break; + case SAMPLE_TYPE_FLOAT32: + frameSize *= sizeof(dsp::complex_t); + break; + default: + return; + } + uint8_t* buffer = dsp::buffer::alloc(STREAM_BUFFER_SIZE*sizeof(uint32_t)); + + while (true) { + // Read samples from socket + int bytes = sock->recv(buffer, frameSize, true); + + // Convert to CF32 + int count; + switch (sampType) { + case SAMPLE_TYPE_INT8: + frameSize *= 2*sizeof(int8_t);; + break; + case SAMPLE_TYPE_INT16: + frameSize *= 2*sizeof(int16_t); + break; + case SAMPLE_TYPE_INT32: + frameSize *= 2*sizeof(int32_t); + break; + case SAMPLE_TYPE_FLOAT32: + //memcpy(stream.writeBuf, buffer, ) + break; + default: + break; + } + + // Send out converted samples + //if (!stream.swap(bufferSize)) + } + + dsp::buffer::free(buffer); + } + + std::string name; + bool enabled = true; + dsp::stream stream; + SourceManager::SourceHandler handler; + bool running = false; + double freq; + + int samplerate = 1000000; + int srId; + Protocol proto = PROTOCOL_TCP_SERVER; + int protoId; + SampleType sampType = SAMPLE_TYPE_INT16; + int sampTypeId; + char hostname[1024] = "localhost"; + int port = 1234; + + OptionList samplerates; + OptionList protocols; + OptionList sampleTypes; + + std::thread listenWorkerThread; + + std::mutex sockMtx; + std::shared_ptr sock; + std::shared_ptr listener; +}; + +MOD_EXPORT void _INIT_() { + json def = json({}); + config.setPath(core::args["root"].s() + "/network_source_config.json"); + config.load(def); + config.enableAutoSave(); +} + +MOD_EXPORT ModuleManager::Instance* _CREATE_INSTANCE_(std::string name) { + return new NetworkSourceModule(name); +} + +MOD_EXPORT void _DELETE_INSTANCE_(ModuleManager::Instance* instance) { + delete (NetworkSourceModule*)instance; +} + +MOD_EXPORT void _END_() { + config.disableAutoSave(); + config.save(); +} \ No newline at end of file From cd3e2b6c052dc42839daf3264a9e44fea2832bc2 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 8 Feb 2024 21:45:58 +0100 Subject: [PATCH 12/56] fix network source build on windows --- source_modules/network_source/src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source_modules/network_source/src/main.cpp b/source_modules/network_source/src/main.cpp index 6da46ed1..fac95594 100644 --- a/source_modules/network_source/src/main.cpp +++ b/source_modules/network_source/src/main.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -8,7 +9,6 @@ #include #include #include -#include #define CONCAT(a, b) ((std::string(a) + b).c_str()) @@ -331,4 +331,4 @@ MOD_EXPORT void _DELETE_INSTANCE_(ModuleManager::Instance* instance) { MOD_EXPORT void _END_() { config.disableAutoSave(); config.save(); -} \ No newline at end of file +} From 5e0c4449f84c94c748ceb2dead344ada4e8d6c32 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 9 Feb 2024 22:13:25 +0100 Subject: [PATCH 13/56] switched back ATV demod to black and white --- decoder_modules/atv_decoder/src/main.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/decoder_modules/atv_decoder/src/main.cpp b/decoder_modules/atv_decoder/src/main.cpp index 9ae9856d..5d9ffce2 100644 --- a/decoder_modules/atv_decoder/src/main.cpp +++ b/decoder_modules/atv_decoder/src/main.cpp @@ -139,18 +139,19 @@ class ATVDecoderModule : public ModuleManager::Instance { _this->pll.process(720, _this->fir.out.writeBuf, _this->pll.out.writeBuf, ((_this->ypos%2)==1) ^ _this->evenFrame); // Render line to the image without color - //int lypos = _this->ypos - 1; - //if (lypos < 0) { lypos = 624; } - //uint32_t* lastLine = &((uint32_t *)_this->img.buffer)[(lypos < 313) ? (lypos*720*2) : ((((lypos - 313)*2)+1)*720) ]; - //uint32_t* currentLine = &((uint32_t *)_this->img.buffer)[(_this->ypos < 313) ? (_this->ypos*720*2) : ((((_this->ypos - 313)*2)+1)*720) ]; + int lypos = _this->ypos - 1; + if (lypos < 0) { lypos = 624; } + uint32_t* lastLine = &((uint32_t *)_this->img.buffer)[(lypos < 313) ? (lypos*720*2) : ((((lypos - 313)*2)+1)*720) ]; + uint32_t* currentLine = &((uint32_t *)_this->img.buffer)[(_this->ypos < 313) ? (_this->ypos*720*2) : ((((_this->ypos - 313)*2)+1)*720) ]; - uint32_t* currentLine = &((uint32_t *)_this->img.buffer)[_this->ypos*720]; + //uint32_t* currentLine = &((uint32_t *)_this->img.buffer)[_this->ypos*720]; for (int i = 0; i < count; i++) { - //float imval = std::clamp((data[i] - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255); - uint32_t re = std::clamp((_this->pll.out.writeBuf[i].re - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255); - uint32_t im = std::clamp((_this->pll.out.writeBuf[i].im - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255); - currentLine[i] = 0xFF000000 | (im << 8) | re; + int imval = std::clamp((data[i] - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255); + // uint32_t re = std::clamp((_this->pll.out.writeBuf[i].re - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255); + // uint32_t im = std::clamp((_this->pll.out.writeBuf[i].im - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255); + // currentLine[i] = 0xFF000000 | (im << 8) | re; + currentLine[i] = 0xFF000000 | (imval << 16) | (imval << 8) | imval; } // Vertical scan logic From 5f23c1f3124c0c35291b90e68f9ba498ab8846c9 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sat, 10 Feb 2024 20:59:37 +0100 Subject: [PATCH 14/56] added new patrons and hardware donors --- core/src/credits.cpp | 3 +++ readme.md | 2 ++ 2 files changed, 5 insertions(+) diff --git a/core/src/credits.cpp b/core/src/credits.cpp index 58685fbd..f2ea9a6f 100644 --- a/core/src/credits.cpp +++ b/core/src/credits.cpp @@ -41,6 +41,7 @@ namespace sdrpp_credits { "CaribouLabs", "Ettus Research", "Howard Su", + "MicroPhase", "MyriadRF", "Nuand", "RFspace", @@ -54,6 +55,7 @@ namespace sdrpp_credits { "Croccydile", "Dale L Puckett (K0HYD)", "Daniele D'Agnelli", + "David Taylor (GM8ARV)", "D. Jones", "Dexruus", "EB3FRN", @@ -81,6 +83,7 @@ namespace sdrpp_credits { "Syne Ardwin (WI9SYN)", "W4IPA", "William Arcand (W1WRA)", + "William Pitchford", "Yves Rougy", "Zipper" }; diff --git a/readme.md b/readme.md index 785c1420..8a02ca87 100644 --- a/readme.md +++ b/readme.md @@ -433,6 +433,7 @@ I will soon publish a contributing.md listing the code style to use. * Croccydile * Dale L Puckett (K0HYD) * [Daniele D'Agnelli](https://linkedin.com/in/dagnelli) +* [David Taylor (GM8ARV)](https://twitter.com/gm8arv) * D. Jones * Dexruus * [EB3FRN](https://www.eb3frn.net/) @@ -460,6 +461,7 @@ I will soon publish a contributing.md listing the code style to use. * Syne Ardwin (WI9SYN) * [W4IPA](https://twitter.com/W4IPAstroke5) * William Arcand (W1WRA) +* William Pitchford * [Yves Rougy](https://www.twitch.tv/yorzian) * [Zipper](https://github.com/reppiZ) From c616892eda3756915a8c5bdbf432335b73c28d16 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 11 Feb 2024 19:36:26 +0100 Subject: [PATCH 15/56] attempt to add MacOS M1 CI --- .github/workflows/build_all.yml | 61 +++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 03a97fa5..6cdf8151 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -84,8 +84,8 @@ jobs: name: sdrpp_windows_x64 path: ${{runner.workspace}}/sdrpp_windows_x64.zip - build_macos: - runs-on: macos-latest + build_macos_intel: + runs-on: macos-12 steps: - uses: actions/checkout@v4 @@ -138,6 +138,60 @@ jobs: name: sdrpp_macos_intel path: ${{runner.workspace}}/sdrpp_macos_intel.zip + build_macos_arm: + runs-on: macos-14 + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Update brew repositories + run: brew update + + - name: Install dependencies + run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako + + - 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 ../../ + + - name: Install SDRplay API + run: wget https://www.sdrplay.com/software/SDRplayAPI-macos-installer-universal-3.12.1.pkg && sudo installer -pkg SDRplayAPI-macos-installer-universal-3.12.1.pkg -target / + + - name: Install libiio + run: wget https://github.com/analogdevicesinc/libiio/archive/refs/tags/v0.25.zip && 7z x v0.25.zip && cd libiio-0.25 && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ + + - name: Install libad9361 + run: git clone https://github.com/analogdevicesinc/libad9361-iio && cd libad9361-iio && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ + + - name: Install LimeSuite + run: git clone https://github.com/myriadrf/LimeSuite && cd LimeSuite && mkdir builddir && cd builddir && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ + + - name: Install libperseus + run: git clone https://github.com/Microtelecom/libperseus-sdr && cd libperseus-sdr && autoreconf -i && ./configure --prefix=/usr/local && make && make install && cd .. + + - name: Install more recent librtlsdr + run: git clone https://github.com/osmocom/rtl-sdr && cd rtl-sdr && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 LIBRARY_PATH=$(pkg-config --libs-only-L libusb-1.0 | sed 's/\-L//') && sudo make install && cd ../../ + + - name: Prepare CMake + working-directory: ${{runner.workspace}}/build + run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release + + - name: Build + working-directory: ${{runner.workspace}}/build + run: make VERBOSE=1 -j3 + + - name: Create Archive + working-directory: ${{runner.workspace}} + run: cd $GITHUB_WORKSPACE && sh make_macos_bundle.sh ${{runner.workspace}}/build ./SDR++.app && zip -r ${{runner.workspace}}/sdrpp_macos_arm.zip SDR++.app + + - name: Save Archive + uses: actions/upload-artifact@v4 + with: + name: sdrpp_macos_arm + path: ${{runner.workspace}}/sdrpp_macos_arm.zip + build_debian_buster: runs-on: ubuntu-latest @@ -347,7 +401,7 @@ jobs: path: ${{runner.workspace}}/sdrpp.apk create_full_archive: - needs: ['build_windows', 'build_macos', 'build_debian_buster', 'build_debian_bullseye', 'build_debian_bookworm', 'build_debian_sid', 'build_ubuntu_focal', 'build_ubuntu_jammy', 'build_ubuntu_mantic', 'build_raspios_bullseye_armhf', 'build_android'] + needs: ['build_windows', 'build_macos_intel', 'build_macos_arm', 'build_debian_buster', 'build_debian_bullseye', 'build_debian_bookworm', 'build_debian_sid', 'build_ubuntu_focal', 'build_ubuntu_jammy', 'build_ubuntu_mantic', 'build_raspios_bullseye_armhf', 'build_android'] runs-on: ubuntu-latest steps: @@ -359,6 +413,7 @@ jobs: mkdir sdrpp_all && mv sdrpp_windows_x64/sdrpp_windows_x64.zip sdrpp_all/ && mv sdrpp_macos_intel/sdrpp_macos_intel.zip sdrpp_all/ && + mv sdrpp_macos_arm/sdrpp_macos_arm.zip sdrpp_all/ && mv sdrpp_debian_buster_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_buster_amd64.deb && mv sdrpp_debian_bullseye_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_bullseye_amd64.deb && mv sdrpp_debian_bookworm_amd64/sdrpp_debian_amd64.deb sdrpp_all/sdrpp_debian_bookworm_amd64.deb && From 5204cfec56fede44d03357fb99d3d16471b95dbd Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 11 Feb 2024 19:41:49 +0100 Subject: [PATCH 16/56] disable perseus source on macos M1 --- .github/workflows/build_all.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 6cdf8151..862d4158 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -168,15 +168,15 @@ jobs: - name: Install LimeSuite run: git clone https://github.com/myriadrf/LimeSuite && cd LimeSuite && mkdir builddir && cd builddir && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ - - name: Install libperseus - run: git clone https://github.com/Microtelecom/libperseus-sdr && cd libperseus-sdr && autoreconf -i && ./configure --prefix=/usr/local && make && make install && cd .. + # - name: Install libperseus + # run: git clone https://github.com/Microtelecom/libperseus-sdr && cd libperseus-sdr && autoreconf -i && ./configure --prefix=/usr/local && make && make install && cd .. - name: Install more recent librtlsdr run: git clone https://github.com/osmocom/rtl-sdr && cd rtl-sdr && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 LIBRARY_PATH=$(pkg-config --libs-only-L libusb-1.0 | sed 's/\-L//') && sudo make install && cd ../../ - name: Prepare CMake working-directory: ${{runner.workspace}}/build - run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release + run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=OFF -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release - name: Build working-directory: ${{runner.workspace}}/build From 2b752bb26761bb144dd855f0c2596bcccabaa327 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 11 Feb 2024 19:57:13 +0100 Subject: [PATCH 17/56] disable M17 decoder on M1 CI --- .github/workflows/build_all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 862d4158..ae2e3020 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -176,7 +176,7 @@ jobs: - name: Prepare CMake working-directory: ${{runner.workspace}}/build - run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=OFF -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release + run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF -DOPT_BUILD_PERSEUS_SOURCE=OFF -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release - name: Build working-directory: ${{runner.workspace}}/build From 01ab1831e8cff851028453f1dde7868f7f0dc6ff Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 12 Feb 2024 22:07:17 +0100 Subject: [PATCH 18/56] more progress on the network source --- source_modules/network_source/src/main.cpp | 41 ++++++++++------------ 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/source_modules/network_source/src/main.cpp b/source_modules/network_source/src/main.cpp index fac95594..90f6d8ae 100644 --- a/source_modules/network_source/src/main.cpp +++ b/source_modules/network_source/src/main.cpp @@ -35,6 +35,13 @@ enum SampleType { SAMPLE_TYPE_FLOAT32 }; +const size_t SAMPLE_TYPE_SIZE[] { + sizeof(int8_t)*2, + sizeof(int16_t)*2, + sizeof(int32_t)*2, + sizeof(float)*2, +}; + class NetworkSourceModule : public ModuleManager::Instance { public: NetworkSourceModule(std::string name) { @@ -237,40 +244,28 @@ private: } void worker() { - int frameSize = samplerate / 200; - switch (sampType) { - case SAMPLE_TYPE_INT8: - frameSize *= 2*sizeof(int8_t);; - break; - case SAMPLE_TYPE_INT16: - frameSize *= 2*sizeof(int16_t); - break; - case SAMPLE_TYPE_INT32: - frameSize *= 2*sizeof(int32_t); - break; - case SAMPLE_TYPE_FLOAT32: - frameSize *= sizeof(dsp::complex_t); - break; - default: - return; - } - uint8_t* buffer = dsp::buffer::alloc(STREAM_BUFFER_SIZE*sizeof(uint32_t)); + int blockSize = samplerate / 200; + int frameSize = blockSize*SAMPLE_TYPE_SIZE[sampType]; + uint8_t* buffer = dsp::buffer::alloc(frameSize); while (true) { // Read samples from socket - int bytes = sock->recv(buffer, frameSize, true); + { + std::lock_guard lck(sockMtx); + int bytes = sock->recv(buffer, frameSize, true); + } // Convert to CF32 int count; switch (sampType) { case SAMPLE_TYPE_INT8: - frameSize *= 2*sizeof(int8_t);; + break; case SAMPLE_TYPE_INT16: - frameSize *= 2*sizeof(int16_t); + break; case SAMPLE_TYPE_INT32: - frameSize *= 2*sizeof(int32_t); + break; case SAMPLE_TYPE_FLOAT32: //memcpy(stream.writeBuf, buffer, ) @@ -280,7 +275,7 @@ private: } // Send out converted samples - //if (!stream.swap(bufferSize)) + if (!stream.swap(count)) { break; } } dsp::buffer::free(buffer); From 61c14bab482ec377c3c9f9f25fa99c9643159664 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 12 Feb 2024 22:43:16 +0100 Subject: [PATCH 19/56] fix iq_exporter module crashing when removed in the case it's disabled and in baseband mode --- misc_modules/iq_exporter/src/main.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/misc_modules/iq_exporter/src/main.cpp b/misc_modules/iq_exporter/src/main.cpp index 4f8ec61d..645e3057 100644 --- a/misc_modules/iq_exporter/src/main.cpp +++ b/misc_modules/iq_exporter/src/main.cpp @@ -408,9 +408,9 @@ private: if (!_this->enabled) { ImGui::EndDisabled(); } } - void setMode(Mode newMode, bool fromDisabled = false) { + void setMode(Mode newMode, bool forceSet = false) { // If there is no mode to change, do nothing - if (!fromDisabled && mode == newMode) { return; } + if (!forceSet && mode == newMode) { return; } // Stop the DSP reshape.stop(); @@ -421,14 +421,13 @@ private: sigpath::vfoManager.deleteVFO(vfo); vfo = NULL; } - if (mode == MODE_BASEBAND && !fromDisabled) { + if (streamBound) { sigpath::iqFrontEnd.unbindIQStream(&iqStream); + streamBound = false; } // If the mode was none, we're done - if (newMode == MODE_NONE) { - return; - } + if (newMode == MODE_NONE) { return; } // Create VFO or bind IQ stream if (newMode == MODE_VFO) { @@ -441,6 +440,7 @@ private: else { // Bind IQ stream sigpath::iqFrontEnd.bindIQStream(&iqStream); + streamBound = true; // Set its output as the input to the DSP reshape.setInput(&iqStream); @@ -555,6 +555,7 @@ private: OptionList packetSizes; VFOManager::VFO* vfo = NULL; + bool streamBound = false; dsp::stream iqStream; dsp::buffer::Reshaper reshape; dsp::sink::Handler handler; From 726e1069bf105567b93a6dea8bbfc45ea99012b3 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 12 Feb 2024 22:46:03 +0100 Subject: [PATCH 20/56] fix wrong mode name in rigctl server as described in #1327 --- misc_modules/rigctl_server/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc_modules/rigctl_server/src/main.cpp b/misc_modules/rigctl_server/src/main.cpp index 3673d4dd..926ce6ea 100644 --- a/misc_modules/rigctl_server/src/main.cpp +++ b/misc_modules/rigctl_server/src/main.cpp @@ -334,7 +334,7 @@ private: } std::map radioModeToString = { - { RADIO_IFACE_MODE_NFM, "NFM" }, + { RADIO_IFACE_MODE_NFM, "FM" }, { RADIO_IFACE_MODE_WFM, "WFM" }, { RADIO_IFACE_MODE_AM, "AM" }, { RADIO_IFACE_MODE_DSB, "DSB" }, From 34171d4edc69fd8534aeb39e01ea6e66192c75a9 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 12 Feb 2024 23:24:00 +0100 Subject: [PATCH 21/56] fix windows CI --- .github/workflows/build_all.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index ae2e3020..5792dd96 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -37,10 +37,10 @@ jobs: run: 7z x libusb.7z -olibusb_old ; rm "C:/Program Files/PothosSDR/bin/libusb-1.0.dll" ; cp "libusb_old/MS64/dll/libusb-1.0.dll" "C:/Program Files/PothosSDR/bin/" ; rm "C:/Program Files/PothosSDR/lib/libusb-1.0.lib" ; cp "libusb_old/MS64/dll/libusb-1.0.lib" "C:/Program Files/PothosSDR/lib/" - name: Download SDRPlay API - run: Invoke-WebRequest -Uri "https://drive.google.com/uc?id=12UHPMwkfa67A11QZDmpCT4iwHnyJHWuu&confirm=t" -OutFile ${{runner.workspace}}/SDRPlay.zip + run: Invoke-WebRequest -Uri "https://www.sdrpp.org/SDRplay.zip" -OutFile ${{runner.workspace}}/SDRplay.zip - name: Install SDRPlay API - run: 7z x ${{runner.workspace}}/SDRPlay.zip -o"C:/Program Files/" + run: 7z x ${{runner.workspace}}/SDRplay.zip -o"C:/Program Files/" - name: Download codec2 run: git clone https://github.com/AlexandreRouma/codec2 From 95052c34ff83a1d713bfb20279befd85f5beb601 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Tue, 13 Feb 2024 03:11:37 +0100 Subject: [PATCH 22/56] more work on network source and syntax cleanup in iq exporter --- misc_modules/iq_exporter/src/main.cpp | 2 +- source_modules/network_source/src/main.cpp | 23 ++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/misc_modules/iq_exporter/src/main.cpp b/misc_modules/iq_exporter/src/main.cpp index 645e3057..9c9c5011 100644 --- a/misc_modules/iq_exporter/src/main.cpp +++ b/misc_modules/iq_exporter/src/main.cpp @@ -509,7 +509,7 @@ private: size = sizeof(int16_t)*2; break; case SAMPLE_TYPE_INT32: - volk_32f_s32f_convert_32i((int32_t*)_this->buffer, (float*)data, (float)2147483647.0f, count*2); + volk_32f_s32f_convert_32i((int32_t*)_this->buffer, (float*)data, 2147483647.0f, count*2); size = sizeof(int32_t)*2; break; case SAMPLE_TYPE_FLOAT32: diff --git a/source_modules/network_source/src/main.cpp b/source_modules/network_source/src/main.cpp index 90f6d8ae..08cd7c7d 100644 --- a/source_modules/network_source/src/main.cpp +++ b/source_modules/network_source/src/main.cpp @@ -244,31 +244,37 @@ private: } void worker() { + // Compute sizes int blockSize = samplerate / 200; - int frameSize = blockSize*SAMPLE_TYPE_SIZE[sampType]; + int sampleSize = SAMPLE_TYPE_SIZE[sampType]; + int frameSize = blockSize*sampleSize; + + // Allocate receive buffer uint8_t* buffer = dsp::buffer::alloc(frameSize); while (true) { // Read samples from socket + int bytes; { std::lock_guard lck(sockMtx); - int bytes = sock->recv(buffer, frameSize, true); + bytes = sock->recv(buffer, frameSize, true); + if (bytes <= 0) { break; } } - // Convert to CF32 - int count; + // Convert to CF32 (note: problem if partial sample) + int count = bytes / sampleSize; switch (sampType) { case SAMPLE_TYPE_INT8: - + volk_8i_s32f_convert_32f((float*)stream.writeBuf, (int8_t*)buffer, 128.0f, count*2); break; case SAMPLE_TYPE_INT16: - + volk_16i_s32f_convert_32f((float*)stream.writeBuf, (int16_t*)buffer, 32768.0f, count*2); break; case SAMPLE_TYPE_INT32: - + volk_32i_s32f_convert_32f((float*)stream.writeBuf, (int32_t*)buffer, 2147483647.0f, count*2); break; case SAMPLE_TYPE_FLOAT32: - //memcpy(stream.writeBuf, buffer, ) + memcpy(stream.writeBuf, buffer, bytes); break; default: break; @@ -278,6 +284,7 @@ private: if (!stream.swap(count)) { break; } } + // Free receive buffer dsp::buffer::free(buffer); } From edc08ddc0823c3a350c4bb32487d86314efca938 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Tue, 13 Feb 2024 16:17:17 +0100 Subject: [PATCH 23/56] more progress on the network source --- CMakeLists.txt | 2 +- source_modules/network_source/src/main.cpp | 48 ++++++++++++++++++---- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c82dbb9..0f3fe404 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ option(OPT_BUILD_FILE_SOURCE "Wav file source" ON) option(OPT_BUILD_HACKRF_SOURCE "Build HackRF Source Module (Dependencies: libhackrf)" ON) option(OPT_BUILD_HERMES_SOURCE "Build Hermes Source Module (no dependencies required)" ON) option(OPT_BUILD_LIMESDR_SOURCE "Build LimeSDR Source Module (Dependencies: liblimesuite)" OFF) -option(OPT_BUILD_NETWORK_SOURCE "Build Network Source Module (no dependencies required)" on) +option(OPT_BUILD_NETWORK_SOURCE "Build Network Source Module (no dependencies required)" ON) option(OPT_BUILD_PERSEUS_SOURCE "Build Perseus Source Module (Dependencies: libperseus-sdr)" OFF) option(OPT_BUILD_PLUTOSDR_SOURCE "Build PlutoSDR Source Module (Dependencies: libiio, libad9361)" ON) option(OPT_BUILD_RFSPACE_SOURCE "Build RFspace Source Module (no dependencies required)" ON) diff --git a/source_modules/network_source/src/main.cpp b/source_modules/network_source/src/main.cpp index 08cd7c7d..29db4032 100644 --- a/source_modules/network_source/src/main.cpp +++ b/source_modules/network_source/src/main.cpp @@ -73,7 +73,7 @@ public: } // Define protocols - protocols.define("TCP (Server)", PROTOCOL_TCP_SERVER); + // protocols.define("TCP (Server)", PROTOCOL_TCP_SERVER); protocols.define("TCP (Client)", PROTOCOL_TCP_CLIENT); protocols.define("UDP", PROTOCOL_UDP); @@ -164,7 +164,31 @@ private: NetworkSourceModule* _this = (NetworkSourceModule*)ctx; if (_this->running) { return; } - // TODO + // Depends on protocol + try { + if (_this->proto == PROTOCOL_TCP_SERVER) { + // Create TCP listener + // TODO + + // Start listen worker + // TODO + } + else if (_this->proto == PROTOCOL_TCP_CLIENT) { + // Connect to TCP server + _this->sock = net::connect(_this->hostname, _this->port); + } + else if (_this->proto == PROTOCOL_UDP) { + // Open UDP socket + _this->sock = net::openudp("0.0.0.0", _this->port, _this->hostname, _this->port, true); + } + } + catch (const std::exception& e) { + flog::error("Could not start Network Source: {}", e.what()); + return; + } + + // Start receive worker + _this->workerThread = std::thread(&NetworkSourceModule::worker, _this); _this->running = true; flog::info("NetworkSourceModule '{0}': Start!", _this->name); @@ -174,8 +198,17 @@ private: NetworkSourceModule* _this = (NetworkSourceModule*)ctx; if (!_this->running) { return; } + // Stop listen worker // TODO + // Close connection + if (_this->sock) { _this->sock->close(); } + + // Stop worker thread + _this->stream.stopWriter(); + if (_this->workerThread.joinable()) { _this->workerThread.join(); } + _this->stream.clearWriteStop(); + _this->running = false; flog::info("NetworkSourceModule '{0}': Stop!", _this->name); } @@ -254,12 +287,8 @@ private: while (true) { // Read samples from socket - int bytes; - { - std::lock_guard lck(sockMtx); - bytes = sock->recv(buffer, frameSize, true); - if (bytes <= 0) { break; } - } + int bytes = sock->recv(buffer, frameSize, true); + if (bytes <= 0) { break; } // Convert to CF32 (note: problem if partial sample) int count = bytes / sampleSize; @@ -297,7 +326,7 @@ private: int samplerate = 1000000; int srId; - Protocol proto = PROTOCOL_TCP_SERVER; + Protocol proto = PROTOCOL_UDP; int protoId; SampleType sampType = SAMPLE_TYPE_INT16; int sampTypeId; @@ -308,6 +337,7 @@ private: OptionList protocols; OptionList sampleTypes; + std::thread workerThread; std::thread listenWorkerThread; std::mutex sockMtx; From 9ab3c97c44ae90934adebaab133533356596721e Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Tue, 13 Feb 2024 16:18:25 +0100 Subject: [PATCH 24/56] don't include rc file on platforms other than windows --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f3fe404..470b17cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,7 +287,12 @@ if (OPT_BUILD_SCHEDULER) add_subdirectory("misc_modules/scheduler") endif (OPT_BUILD_SCHEDULER) -add_executable(sdrpp "src/main.cpp" "win32/resources.rc") +if (MSVC) + add_executable(sdrpp "src/main.cpp" "win32/resources.rc") +else () + add_executable(sdrpp "src/main.cpp") +endif () + target_link_libraries(sdrpp PRIVATE sdrpp_core) # Compiler arguments From 61ffb3e6bf63df866cb568cd75c4b52464623265 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Tue, 13 Feb 2024 16:27:54 +0100 Subject: [PATCH 25/56] revert pager decoder to traditional clock recovery --- .../pager_decoder/src/pocsag/decoder.h | 4 +- .../pager_decoder/src/pocsag/dsp.h | 104 +-------- .../src/pocsag/packet_clock_sync.h | 221 ------------------ 3 files changed, 6 insertions(+), 323 deletions(-) delete mode 100644 decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h diff --git a/decoder_modules/pager_decoder/src/pocsag/decoder.h b/decoder_modules/pager_decoder/src/pocsag/decoder.h index 672bed3d..9807e6d3 100644 --- a/decoder_modules/pager_decoder/src/pocsag/decoder.h +++ b/decoder_modules/pager_decoder/src/pocsag/decoder.h @@ -13,7 +13,7 @@ class POCSAGDecoder : public Decoder { public: - POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, 544) { + POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, BAUDRATE) { this->name = name; this->vfo = vfo; @@ -26,7 +26,7 @@ public: vfo->setBandwidthLimits(12500, 12500, true); vfo->setSampleRate(SAMPLERATE, 12500); dsp.init(vfo->output, SAMPLERATE, BAUDRATE); - reshape.init(&dsp.soft, 544, 0); + reshape.init(&dsp.soft, BAUDRATE, (BAUDRATE / 30.0) - BAUDRATE); dataHandler.init(&dsp.out, _dataHandler, this); diagHandler.init(&reshape.out, _diagHandler, this); diff --git a/decoder_modules/pager_decoder/src/pocsag/dsp.h b/decoder_modules/pager_decoder/src/pocsag/dsp.h index f5d10a6f..20a1b8f8 100644 --- a/decoder_modules/pager_decoder/src/pocsag/dsp.h +++ b/decoder_modules/pager_decoder/src/pocsag/dsp.h @@ -11,89 +11,6 @@ #include #include -#include "packet_clock_sync.h" - -inline float PATTERN_DSDSDZED[] = { - -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, - -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, - 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 8.00000000e-01, - 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, - -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -8.00000000e-01, - -6.00000000e-01, -4.00000000e-01, -2.00000000e-01, -2.77555756e-17, - 2.00000000e-01, 4.00000000e-01, 6.00000000e-01, 8.00000000e-01, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 8.00000000e-01, - 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, - -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, - -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, - -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, - 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 8.00000000e-01, - 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, - -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -8.00000000e-01, - -6.00000000e-01, -4.00000000e-01, -2.00000000e-01, -2.77555756e-17, - 2.00000000e-01, 4.00000000e-01, 6.00000000e-01, 8.00000000e-01, - 1.00000000e+00, 8.00000000e-01, 6.00000000e-01, 4.00000000e-01, - 2.00000000e-01, 2.77555756e-17, -2.00000000e-01, -4.00000000e-01, - -6.00000000e-01, -8.00000000e-01, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, - -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, - 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 8.00000000e-01, - 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, - -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, - -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, - -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, - 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 8.00000000e-01, - 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, - -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, - -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, - -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, - 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 8.00000000e-01, - 6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17, - -2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01, - -1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01, - -2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01, - 6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, - 1.00000000e+00, 8.00000000e-01, 6.00000000e-01, 4.00000000e-01, - 2.00000000e-01, 2.77555756e-17, -2.00000000e-01, -4.00000000e-01, - -6.00000000e-01, -8.00000000e-01, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, - -1.00000000e+00, -1.00000000e+00, -1.00000000e+00 -}; - class POCSAGDSP : public dsp::Processor { using base_type = dsp::Processor; public: @@ -106,16 +23,12 @@ public: // Configure blocks demod.init(NULL, -4500.0, samplerate); - //dcBlock.init(NULL, 0.001); // NOTE: DC blocking causes issues because no scrambling, think more about it float taps[] = { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f }; shape = dsp::taps::fromArray(10, taps); fir.init(NULL, shape); - //recov.init(NULL, samplerate/baudrate, 1e-4, 1.0, 0.05); - - cs.init(NULL, PATTERN_DSDSDZED, sizeof(PATTERN_DSDSDZED)/sizeof(float), 544, 10); + recov.init(NULL, samplerate/baudrate, 1e-4, 1.0, 0.05); // Free useless buffers - // dcBlock.out.free(); fir.out.free(); recov.out.free(); @@ -125,13 +38,9 @@ public: int process(int count, dsp::complex_t* in, float* softOut, uint8_t* out) { count = demod.process(count, in, demod.out.readBuf); - //count = dcBlock.process(count, demod.out.readBuf, demod.out.readBuf); count = fir.process(count, demod.out.readBuf, demod.out.readBuf); - //count = recov.process(count, demod.out.readBuf, softOut); - - count = cs.process(count, demod.out.readBuf, softOut); - - //dsp::digital::BinarySlicer::process(count, softOut, out); + count = recov.process(count, demod.out.readBuf, softOut); + dsp::digital::BinarySlicer::process(count, softOut, out); return count; } @@ -146,10 +55,8 @@ public: count = process(count, base_type::_in->readBuf, soft.writeBuf, base_type::out.writeBuf); base_type::_in->flush(); - //if (!base_type::out.swap(count)) { return -1; } - + if (!base_type::out.swap(count)) { return -1; } if (count) { if (!soft.swap(count)) { return -1; } } - return count; } @@ -157,11 +64,8 @@ public: private: dsp::demod::Quadrature demod; - //dsp::correction::DCBlocker dcBlock; dsp::tap shape; dsp::filter::FIR fir; dsp::clock_recovery::MM recov; - dsp::PacketClockSync cs; - }; \ No newline at end of file diff --git a/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h b/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h deleted file mode 100644 index e5367f57..00000000 --- a/decoder_modules/pager_decoder/src/pocsag/packet_clock_sync.h +++ /dev/null @@ -1,221 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace dsp { - class PacketClockSync : public dsp::Processor { - using base_type = dsp::Processor; - public: - PacketClockSync() {} - PacketClockSync(dsp::stream* in, float* pattern, int patternLen, int frameLen, float sampsPerSym, float threshold = 0.4f) { init(in, pattern, patternLen, frameLen, sampsPerSym, threshold); } - - // TODO: Free in destroyer - - void init(dsp::stream* in, float* pattern, int patternLen, int frameLen, float sampsPerSym, float threshold = 0.4f) { - // Compute the required FFT size and associated delay length - fftSize = 512;// TODO: Find smallest power of 2 that fits patternLen - delayLen = fftSize - 1; - - // Allocate buffers - buffer = dsp::buffer::alloc(STREAM_BUFFER_SIZE+delayLen); - bufferStart = &buffer[delayLen]; - this->pattern = dsp::buffer::alloc(patternLen); - patternFFT = dsp::buffer::alloc(fftSize); - patternFFTAmps = dsp::buffer::alloc(fftSize); - fftIn = fftwf_alloc_real(fftSize); - fftOut = (complex_t*)fftwf_alloc_complex(fftSize); - - // Copy parameters - memcpy(this->pattern, pattern, patternLen*sizeof(float)); - this->sampsPerSym = sampsPerSym; - this->threshold = threshold; - this->patternLen = patternLen; - this->frameLen = frameLen; - - // Plan FFT - plan = fftwf_plan_dft_r2c_1d(fftSize, fftIn, (fftwf_complex*)fftOut, FFTW_ESTIMATE); - - // Pre-compute pattern conjugated FFT - // TODO: Offset the pattern to avoid it being cut off (EXTREMELY IMPORTANT) - memcpy(fftIn, pattern, patternLen*sizeof(float)); - memset(&fftIn[patternLen], 0, (fftSize-patternLen)*sizeof(float)); - fftwf_execute(plan); - volk_32fc_conjugate_32fc((lv_32fc_t*)patternFFT, (lv_32fc_t*)fftOut, fftSize); - - // Compute amplitudes of the pattern FFT - volk_32fc_magnitude_32f(patternFFTAmps, (lv_32fc_t*)patternFFT, fftSize); - - // Normalize the amplitudes - float maxAmp = 0.0f; - for (int i = 0; i < fftSize/2; i++) { - if (patternFFTAmps[i] > maxAmp) { maxAmp = patternFFTAmps[i]; } - } - volk_32f_s32f_multiply_32f(patternFFTAmps, patternFFTAmps, 1.0f/maxAmp, fftSize); - - // Initialize the phase control loop - float omegaRelLimit = 0.05; - pcl.init(1, 10e-4, 0.0, 0.0, 1.0, sampsPerSym, sampsPerSym * (1.0 - omegaRelLimit), sampsPerSym * (1.0 + omegaRelLimit)); - generateInterpTaps(); - - // Init base - base_type::init(in); - } - - int process(int count, float* in, float* out) { - // Copy to buffer - memcpy(bufferStart, in, count * sizeof(float)); - - int outCount = 0; - - for (int i = 0; i < count;) { - // Run clock recovery if needed - while (toRead) { - // Interpolate symbol - float symbol; - int phase = std::clamp(floorf(pcl.phase * (float)interpPhaseCount), 0, interpPhaseCount - 1); - volk_32f_x2_dot_prod_32f(&symbol, &buffer[offsetInt], interpBank.phases[phase], interpTapCount); - out[outCount++] = symbol; - - // Compute symbol phase error - float error = (math::step(lastSymbol) * symbol) - (lastSymbol * math::step(symbol)); - lastSymbol = symbol; - - // Clamp symbol phase error - if (error > 1.0f) { error = 1.0f; } - if (error < -1.0f) { error = -1.0f; } - - // Advance symbol offset and phase - pcl.advance(error); - float delta = floorf(pcl.phase); - offsetInt += delta; - i = offsetInt; - pcl.phase -= delta; - - // Decrement read counter - toRead--; - - if (offsetInt >= count) { - offsetInt -= count; - break; - } - } - - - // Measure correlation to the sync pattern - float corr; - volk_32f_x2_dot_prod_32f(&corr, &buffer[i], pattern, patternLen); - - // If not correlated enough, go to next sample. Otherwise continue with fine detection - if (corr/(float)patternLen < threshold) { - i++; - continue; - } - - // Copy samples into FFT input (only the part where we think the pattern is located) - // TODO: Instead, check the interval onto which correlation occurs to determine where the pattern is located (IMPORTANT) - memcpy(fftIn, &buffer[i], patternLen*sizeof(float)); - - // Compute FFT - fftwf_execute(plan); - - // Multiply with the conjugated pattern FFT to get the phase offset at each frequency - volk_32fc_x2_multiply_32fc((lv_32fc_t*)fftOut, (lv_32fc_t*)fftOut, (lv_32fc_t*)patternFFT, fftSize); - - // Compute the average phase delay rate - float last = 0; - float rateIntegral = 0; - for (int j = 1; j < fftSize/2; j++) { - // Compute instantanous rate - float currentPhase = fftOut[j].phase(); - float instantRate = dsp::math::normalizePhase(currentPhase - last); - last = currentPhase; - - // Compute current rate guess - float rateGuess = rateIntegral / (float)j; - - // Update the rate integral as a weighted average of the current guess and measured rate depending on pattern amplitude - rateIntegral += patternFFTAmps[j]*instantRate + (1.0f-patternFFTAmps[j])*rateGuess; - } - float avgRate = 1.14f*rateIntegral/(float)(fftSize/2); - - // Compute the total offset - float offset = (float)i - avgRate*(float)fftSize/(2.0f*FL_M_PI); - flog::debug("Detected: {} -> {}", i, offset); - - // Initialize clock recovery - offsetInt = floorf(offset) - 3; // TODO: Will be negative sometimes, has to be taken into account - pcl.phase = offset - (float)floorf(offset); - pcl.freq = sampsPerSym; - - // Start reading symbols - toRead = frameLen; - } - - // Move unused data - memmove(buffer, &buffer[count], delayLen * sizeof(float)); - - return outCount; - } - - int run() { - int count = base_type::_in->read(); - if (count < 0) { return -1; } - - count = process(count, base_type::_in->readBuf, base_type::out.writeBuf); - - base_type::_in->flush(); - if (count) { - if (!base_type::out.swap(count)) { return -1; } - } - return count; - } - - private: - void generateInterpTaps() { - double bw = 0.5 / (double)interpPhaseCount; - dsp::tap lp = dsp::taps::windowedSinc(interpPhaseCount * interpTapCount, dsp::math::hzToRads(bw, 1.0), dsp::window::nuttall, interpPhaseCount); - interpBank = dsp::multirate::buildPolyphaseBank(interpPhaseCount, lp); - taps::free(lp); - } - - int delayLen; - float* buffer = NULL; - float* bufferStart = NULL; - float* pattern = NULL; - int patternLen; - bool locked; - int fftSize; - int frameLen; - float threshold; - - float* fftIn = NULL; - complex_t* fftOut = NULL; - fftwf_plan plan; - - complex_t* patternFFT; - float* patternFFTAmps; - - float sampsPerSym; - int toRead = 0; - - loop::PhaseControlLoop pcl; - dsp::multirate::PolyphaseBank interpBank; - int interpTapCount = 8; - int interpPhaseCount = 128; - float lastSymbol = 0.0f; - int offsetInt; - }; -} \ No newline at end of file From 650a61930ca45ef28ac2f2729da65a4b926371da Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Tue, 13 Feb 2024 18:39:11 +0100 Subject: [PATCH 26/56] fix SDR++ server crash at high samplerates #1326 --- core/src/dsp/compression/sample_stream_compressor.h | 4 ++++ core/src/server.cpp | 2 +- .../sdrpp_server_source/src/sdrpp_server_client.cpp | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/dsp/compression/sample_stream_compressor.h b/core/src/dsp/compression/sample_stream_compressor.h index 69b5cbbf..8e79b8bf 100644 --- a/core/src/dsp/compression/sample_stream_compressor.h +++ b/core/src/dsp/compression/sample_stream_compressor.h @@ -12,6 +12,10 @@ namespace dsp::compression { void init(stream* in, PCMType pcmType) { _pcmType = pcmType; + + // Set the output buffer size to the max size of a complex buffer + 8 bytes for the header + out.setBufferSize(STREAM_BUFFER_SIZE*sizeof(complex_t) + 8); + base_type::init(in); } diff --git a/core/src/server.cpp b/core/src/server.cpp index a780a384..501198c3 100644 --- a/core/src/server.cpp +++ b/core/src/server.cpp @@ -230,7 +230,7 @@ namespace server { // Compress data if needed and fill out header fields if (compression) { bb_pkt_hdr->type = PACKET_TYPE_BASEBAND_COMPRESSED; - bb_pkt_hdr->size = sizeof(PacketHeader) + (uint32_t)ZSTD_compressCCtx(cctx, &bbuf[sizeof(PacketHeader)], SERVER_MAX_PACKET_SIZE, data, count, 1); + bb_pkt_hdr->size = sizeof(PacketHeader) + (uint32_t)ZSTD_compressCCtx(cctx, &bbuf[sizeof(PacketHeader)], SERVER_MAX_PACKET_SIZE-sizeof(PacketHeader), data, count, 1); } else { bb_pkt_hdr->type = PACKET_TYPE_BASEBAND; diff --git a/source_modules/sdrpp_server_source/src/sdrpp_server_client.cpp b/source_modules/sdrpp_server_source/src/sdrpp_server_client.cpp index 0e25efe7..9b1e63d5 100644 --- a/source_modules/sdrpp_server_source/src/sdrpp_server_client.cpp +++ b/source_modules/sdrpp_server_source/src/sdrpp_server_client.cpp @@ -30,7 +30,7 @@ namespace server { dctx = ZSTD_createDCtx(); // Initialize DSP - decompIn.setBufferSize((sizeof(dsp::complex_t) * STREAM_BUFFER_SIZE) + 8); + decompIn.setBufferSize(STREAM_BUFFER_SIZE*sizeof(dsp::complex_t) + 8); decompIn.clearWriteStop(); decomp.init(&decompIn); link.init(&decomp.out, output); @@ -209,7 +209,7 @@ namespace server { if (!decompIn.swap(r_pkt_hdr->size - sizeof(PacketHeader))) { break; } } else if (r_pkt_hdr->type == PACKET_TYPE_BASEBAND_COMPRESSED) { - size_t outCount = ZSTD_decompressDCtx(dctx, decompIn.writeBuf, STREAM_BUFFER_SIZE, r_pkt_data, r_pkt_hdr->size - sizeof(PacketHeader)); + size_t outCount = ZSTD_decompressDCtx(dctx, decompIn.writeBuf, STREAM_BUFFER_SIZE*sizeof(dsp::complex_t)+8, r_pkt_data, r_pkt_hdr->size - sizeof(PacketHeader)); if (outCount) { if (!decompIn.swap(outCount)) { break; } }; From f1339f08cf180adf926343c63ecf409fe5cfed35 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sat, 17 Feb 2024 06:30:06 +0100 Subject: [PATCH 27/56] add workaround for uhd bug reporting same device twice --- source_modules/usrp_source/src/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source_modules/usrp_source/src/main.cpp b/source_modules/usrp_source/src/main.cpp index 5f5cc640..1718515c 100644 --- a/source_modules/usrp_source/src/main.cpp +++ b/source_modules/usrp_source/src/main.cpp @@ -78,6 +78,10 @@ public: std::string serial = devAddr["serial"]; std::string model = devAddr.has_key("product") ? devAddr["product"] : devAddr["type"]; sprintf(buf, "USRP %s [%s]", model.c_str(), serial.c_str()); + + // Work-around for UHD sometimes reporting the same device twice + if (devices.keyExists(serial)) { continue; } + devices.define(serial, buf, devAddr); } } From a987c112a3e6f4ae588f1b887b6e4102d41d571a Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sat, 17 Feb 2024 17:37:37 +0100 Subject: [PATCH 28/56] fix crash when USRP has two frontends named the same --- source_modules/usrp_source/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source_modules/usrp_source/src/main.cpp b/source_modules/usrp_source/src/main.cpp index 1718515c..07ac2a73 100644 --- a/source_modules/usrp_source/src/main.cpp +++ b/source_modules/usrp_source/src/main.cpp @@ -111,7 +111,7 @@ public: channels.clear(); auto subdevs = dev->get_rx_subdev_spec(); for (int i = 0; i < subdevs.size(); i++) { - std::string slot = subdevs[i].db_name; + std::string slot = subdevs[i].db_name + ',' + subdevs[i].sd_name; sprintf(buf, "%s [%s]", dev->get_rx_subdev_name(i).c_str(), slot.c_str()); channels.define(buf, buf, buf); } From 7c933d51037ce8c8e703e6869d8ff36e9cd6476e Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 21 Feb 2024 18:47:50 +0100 Subject: [PATCH 29/56] fix typo mentioned in #174 --- core/src/signal_path/source.cpp | 4 ++-- core/src/signal_path/source.h | 2 +- misc_modules/rigctl_client/src/main.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/signal_path/source.cpp b/core/src/signal_path/source.cpp index 5b02a4c5..d3a2a90a 100644 --- a/core/src/signal_path/source.cpp +++ b/core/src/signal_path/source.cpp @@ -84,7 +84,7 @@ void SourceManager::tune(double freq) { if (selectedHandler == NULL) { return; } - // TODO: No need to always retune the hardware in panadpter mode + // TODO: No need to always retune the hardware in Panadapter mode selectedHandler->tuneHandler(((tuneMode == TuningMode::NORMAL) ? freq : ifFreq) + tuneOffset, selectedHandler->ctx); onRetune.emit(freq); currentFreq = freq; @@ -100,7 +100,7 @@ void SourceManager::setTuningMode(TuningMode mode) { tune(currentFreq); } -void SourceManager::setPanadpterIF(double freq) { +void SourceManager::setPanadapterIF(double freq) { ifFreq = freq; tune(currentFreq); } \ No newline at end of file diff --git a/core/src/signal_path/source.h b/core/src/signal_path/source.h index 5021ea2d..edf883b2 100644 --- a/core/src/signal_path/source.h +++ b/core/src/signal_path/source.h @@ -35,7 +35,7 @@ public: void tune(double freq); void setTuningOffset(double offset); void setTuningMode(TuningMode mode); - void setPanadpterIF(double freq); + void setPanadapterIF(double freq); std::vector getSourceNames(); diff --git a/misc_modules/rigctl_client/src/main.cpp b/misc_modules/rigctl_client/src/main.cpp index 83350ba5..1a39fd31 100644 --- a/misc_modules/rigctl_client/src/main.cpp +++ b/misc_modules/rigctl_client/src/main.cpp @@ -86,7 +86,7 @@ public: } // Switch source to panadapter mode - sigpath::sourceManager.setPanadpterIF(ifFreq); + sigpath::sourceManager.setPanadapterIF(ifFreq); sigpath::sourceManager.setTuningMode(SourceManager::TuningMode::PANADAPTER); sigpath::sourceManager.onRetune.bindHandler(&_retuneHandler); @@ -131,7 +131,7 @@ private: ImGui::FillWidth(); if (ImGui::InputDouble(CONCAT("##_rigctl_if_freq_", _this->name), &_this->ifFreq, 100.0, 100000.0, "%.0f")) { if (_this->running) { - sigpath::sourceManager.setPanadpterIF(_this->ifFreq); + sigpath::sourceManager.setPanadapterIF(_this->ifFreq); } config.acquire(); config.conf[_this->name]["ifFreq"] = _this->ifFreq; From 021928bbda35d5bc5a24b7e57730d43773c5fd06 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 21 Feb 2024 21:59:55 +0100 Subject: [PATCH 30/56] fix show/hide waterfall keybind not working with the Display menu hidden --- core/src/gui/main_window.cpp | 2 ++ core/src/gui/menus/display.cpp | 23 ++++++++++++++++------- core/src/gui/menus/display.h | 1 + 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 8c90ebd6..8ed95324 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -463,6 +463,8 @@ void MainWindow::draw() { } } + // Process menu keybinds + displaymenu::checkKeybinds(); // Left Column lockWaterfallControls = false; diff --git a/core/src/gui/menus/display.cpp b/core/src/gui/menus/display.cpp index 2f9f1b7e..59649ed1 100644 --- a/core/src/gui/menus/display.cpp +++ b/core/src/gui/menus/display.cpp @@ -127,15 +127,24 @@ namespace displaymenu { uiScaleId = uiScales.valueId(style::uiScale); } + void setWaterfallShown(bool shown) { + showWaterfall = shown; + showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall(); + core::configManager.acquire(); + core::configManager.conf["showWaterfall"] = showWaterfall; + core::configManager.release(true); + } + + void checkKeybinds() { + if (ImGui::IsKeyPressed(ImGuiKey_Home, false)) { + setWaterfallShown(!showWaterfall); + } + } + void draw(void* ctx) { float menuWidth = ImGui::GetContentRegionAvail().x; - bool homePressed = ImGui::IsKeyPressed(ImGuiKey_Home, false); - if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall) || homePressed) { - if (homePressed) { showWaterfall = !showWaterfall; } - showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall(); - core::configManager.acquire(); - core::configManager.conf["showWaterfall"] = showWaterfall; - core::configManager.release(true); + if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall)) { + setWaterfallShown(showWaterfall); } if (ImGui::Checkbox("Full Waterfall Update##_sdrpp", &fullWaterfallUpdate)) { diff --git a/core/src/gui/menus/display.h b/core/src/gui/menus/display.h index f0a97d18..68e18002 100644 --- a/core/src/gui/menus/display.h +++ b/core/src/gui/menus/display.h @@ -2,5 +2,6 @@ namespace displaymenu { void init(); + void checkKeybinds(); void draw(void* ctx); } \ No newline at end of file From 09467439e3bfc15d0e366c9f54eb1fce50fcd24f Mon Sep 17 00:00:00 2001 From: LEDFlighter <78096516+LEDFlighter@users.noreply.github.com> Date: Fri, 23 Feb 2024 23:21:42 +0100 Subject: [PATCH 31/56] Update germany.json Updated and extended the German bandplan --- root/res/bandplans/germany.json | 374 +++++++++++++++++++++++++++++--- 1 file changed, 349 insertions(+), 25 deletions(-) diff --git a/root/res/bandplans/germany.json b/root/res/bandplans/germany.json index 946084e9..e4329ac4 100644 --- a/root/res/bandplans/germany.json +++ b/root/res/bandplans/germany.json @@ -2,74 +2,290 @@ "name": "Germany", "country_name": "Germany", "country_code": "DE", - "author_name": "Manawyrm", - "author_url": "https://tbspace.de", + "author_name": "Johannes Kosfelder", + "author_url": "none", "bands": [ { - "name": "LW", + "name": "LW-Amateur", "type": "amateur", "start": 135700, "end": 137800 + }, + { + "name": "LW-Broadcast", + "type": "broadcast", + "start": 148500, + "end": 283500 }, { - "name": "630m", + "name": "630m-Amateur", "type": "amateur", "start": 472000, "end": 479000 + }, + { + "name": "MW-Broadcast", + "type": "broadcast", + "start": 526500, + "end": 1606500 }, { - "name": "160m", + "name": "160m-Amateur", "type": "amateur", "start": 1810000, "end": 2000000 }, - { - "name": "80m", + { + "name": "Maritime", + "type": "marine", + "start": 2045000, + "end": 2300000 + }, + { + "name": "120m-Broadcast", + "type": "broadcast", + "start": 2300000, + "end": 2495000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 2850000, + "end": 3155000 + }, + { + "name": "90m-Broadcast", + "type": "broadcast", + "start": 3200000, + "end": 3400000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 3400000, + "end": 3500000 + }, + { + "name": "80m-Amateur", "type": "amateur", "start": 3500000, "end": 3800000 + }, + { + "name": "75m-Broadcast", + "type": "broadcast", + "start": 3900000, + "end": 4000000 + }, + { + "name": "Maritime", + "type": "marine", + "start": 4063000, + "end": 4438000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 4650000, + "end": 4750000 + }, + { + "name": "60m-Broadcast", + "type": "broadcast", + "start": 4750000, + "end": 5060000 }, { - "name": "60m", + "name": "60m-Amateur", "type": "amateur", "start": 5351500, "end": 5366500 }, - { - "name": "40m", + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 5480000, + "end": 5730000 + }, + { + "name": "49m-Broadcast", + "type": "broadcast", + "start": 5900000, + "end": 6200000 + }, + { + "name": "Maritime", + "type": "marine", + "start": 6200000, + "end": 6525000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 6525000, + "end": 6765000 + }, + { + "name": "40m-Amateur", "type": "amateur", "start": 7000000, "end": 7200000 + }, + { + "name": "41m-Broadcast", + "type": "broadcast", + "start": 7200000, + "end": 7450000 + }, + { + "name": "Maritime", + "type": "marine", + "start": 8195000, + "end": 8815000 + }, + { + "name": "31m-Broadcast", + "type": "broadcast", + "start": 9400000, + "end": 9900000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 8815000, + "end": 9040000 }, { - "name": "30m", + "name": "Aeronautical HF", + "type": "aviation", + "start": 10005000, + "end": 10100000 + }, + { + "name": "30m-Amateur", "type": "amateur", "start": 10100000, "end": 10150000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 11175000, + "end": 11400000 + }, + { + "name": "25m-Broadcast", + "type": "broadcast", + "start": 11600000, + "end": 12100000 + }, + { + "name": "Maritime", + "type": "marine", + "start": 12230000, + "end": 13200000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 13200000, + "end": 13360000 + }, + { + "name": "22m-Broadcast", + "type": "broadcast", + "start": 13570000, + "end": 13870000 }, { - "name": "20m", + "name": "20m-Amateur", "type": "amateur", "start": 14000000, "end": 14350000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 15010000, + "end": 15100000 + }, + { + "name": "Maritime", + "type": "marine", + "start": 16360000, + "end": 17410000 + }, + { + "name": "19m-Broadcast", + "type": "broadcast", + "start": 15100000, + "end": 15800000 + }, + { + "name": "16m-Broadcast", + "type": "broadcast", + "start": 17480000, + "end": 17900000 }, { - "name": "17m", + "name": "17m-Amateur", "type": "amateur", "start": 18068000, "end": 18168000 }, - { - "name": "15m", + { + "name": "Maritime - ship tx", + "type": "marine", + "start": 18780000, + "end": 18900000 + }, + { + "name": "15m-Broadcast", + "type": "broadcast", + "start": 18900000, + "end": 19020000 + }, + { + "name": "Maritime - coast tx", + "type": "marine", + "start": 19680000, + "end": 19990000 + }, + { + "name": "15m-Amateur", "type": "amateur", "start": 21000000, "end": 21450000 + }, + { + "name": "13m-Broadcast", + "type": "broadcast", + "start": 21450000, + "end": 21850000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 21870000, + "end": 22000000 + }, + { + "name": "Aeronautical HF", + "type": "aviation", + "start": 23200000, + "end": 23350000 }, { - "name": "12m", + "name": "12m-Amateur", "type": "amateur", "start": 24890000, "end": 24990000 + }, + { + "name": "11m-Broadcast", + "type": "broadcast", + "start": 25670000, + "end": 26100000 }, { "name": "CB", @@ -78,31 +294,55 @@ "end": 27405000 }, { - "name": "10m", + "name": "10m-Amateur", "type": "amateur", "start": 28000000, "end": 29700000 }, { - "name": "6m", + "name": "6m-Amateur", "type": "amateur", "start": 50030000, "end": 51000000 }, { - "name": "4m", + "name": "4m-Amateur", "type": "amateur", "start": 70150000, "end": 70200000 }, { - "name": "FM", + "name": "FM-Broadcast", "type": "broadcast", "start": 87500000, "end": 108000000 + }, + { + "name": "Air Band VOR/ILS", + "type": "aviation", + "start": 108000000, + "end": 118000000 + }, + { + "name": "Air Band Voice", + "type": "aviation", + "start": 118000000, + "end": 136700000 + }, + { + "name": "Air Band CPDLC/Datalink", + "type": "aviation", + "start": 136700000, + "end": 137000000 + }, + { + "name": "Earth orbiting Satellites", + "type": "satellite", + "start": 137000000, + "end": 138000000 }, { - "name": "2m", + "name": "2m-Amateur", "type": "amateur", "start": 144000000, "end": 146000000 @@ -112,9 +352,51 @@ "type": "other", "start": 149025000, "end": 149115625 + }, + { + "name": "Marine", + "type": "marine", + "start": 156000000, + "end": 162025000 + }, + { + "name": "Pager BOS", + "type": "other", + "start": 163000000, + "end": 174000000 + }, + { + "name": "DAB+ (digital broadcast)", + "type": "broadcast", + "start": 174000000, + "end": 225000000 + }, + { + "name": "Air Band Military", + "type": "military", + "start": 225000000, + "end": 380000000 + }, + { + "name": "TETRA BOS", + "type": "other", + "start": 388000000, + "end": 397000000 + }, + { + "name": "Weathersondes", + "type": "other", + "start": 401000000, + "end": 410000000 + }, + { + "name": "TETRA Civil", + "type": "other", + "start": 423000000, + "end": 430000000 }, { - "name": "70cm", + "name": "70cm-Amateur", "type": "amateur", "start": 430000000, "end": 440000000 @@ -124,18 +406,60 @@ "type": "other", "start": 446006250, "end": 446196875 + }, + { + "name": "Pager Civil", + "type": "other", + "start": 446500000, + "end": 470000000 + }, + { + "name": "DVB-T2 (TV)", + "type": "broadcast", + "start": 470000000, + "end": 690000000 + }, + { + "name": "868 MHz ISM-Devices", + "type": "other", + "start": 866500000, + "end": 871000000 }, { - "name": "23cm", + "name": "23cm-Amateur", "type": "amateur", "start": 1240000000, "end": 1300000000 + }, + { + "name": "L-Band", + "type": "other", + "start": 1300000000, + "end": 2000000000 }, { - "name": "13cm", + "name": "13cm-Amateur", "type": "amateur", "start": 2320000000, "end": 2450000000 + }, + { + "name": "9cm-Amateur", + "type": "amateur", + "start": 3400000000, + "end": 3475000000 + }, + { + "name": "6cm-Amateur", + "type": "amateur", + "start": 5650000000, + "end": 5850000000 + }, + { + "name": "3cm-Amateur", + "type": "amateur", + "start": 10000000000, + "end": 10500000000 } ] -} \ No newline at end of file +} From b1603f0e7261cb3f1322bd82fd0fcf77747c7d42 Mon Sep 17 00:00:00 2001 From: LEDFlighter <78096516+LEDFlighter@users.noreply.github.com> Date: Fri, 23 Feb 2024 23:26:36 +0100 Subject: [PATCH 32/56] Update germany.json Updated and extended the German bandplan --- root/res/bandplans/germany.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/res/bandplans/germany.json b/root/res/bandplans/germany.json index e4329ac4..65995f06 100644 --- a/root/res/bandplans/germany.json +++ b/root/res/bandplans/germany.json @@ -2,7 +2,7 @@ "name": "Germany", "country_name": "Germany", "country_code": "DE", - "author_name": "Johannes Kosfelder", + "author_name": "LEDFlighter", "author_url": "none", "bands": [ { From 9dc0196a16f43078ba23d47e4c758385934b7d6f Mon Sep 17 00:00:00 2001 From: LEDFlighter <78096516+LEDFlighter@users.noreply.github.com> Date: Sat, 24 Feb 2024 12:56:33 +0100 Subject: [PATCH 33/56] Update germany.json Added the Name after a "," recovered the "author_url" from the original author (I don't have an URL to refer to) --- root/res/bandplans/germany.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/res/bandplans/germany.json b/root/res/bandplans/germany.json index 65995f06..0e824e1a 100644 --- a/root/res/bandplans/germany.json +++ b/root/res/bandplans/germany.json @@ -2,8 +2,8 @@ "name": "Germany", "country_name": "Germany", "country_code": "DE", - "author_name": "LEDFlighter", - "author_url": "none", + "author_name": "Manawyrm, LEDFlighter", + "author_url": "https://tbspace.de", "bands": [ { "name": "LW-Amateur", From feb9789896b939202f180170fdda9f9f5bb6132a Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 20 Mar 2024 01:38:36 +0100 Subject: [PATCH 34/56] Update sdrplay api version for nightlies to 3.14.0 --- .github/workflows/build_all.yml | 4 ++-- docker_builds/debian_bookworm/do_build.sh | 6 +++--- docker_builds/debian_bullseye/do_build.sh | 6 +++--- docker_builds/debian_buster/do_build.sh | 6 +++--- docker_builds/debian_sid/do_build.sh | 6 +++--- docker_builds/ubuntu_bionic/do_build.sh | 6 +++--- docker_builds/ubuntu_focal/do_build.sh | 6 +++--- docker_builds/ubuntu_jammy/do_build.sh | 6 +++--- docker_builds/ubuntu_mantic/do_build.sh | 6 +++--- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 5792dd96..7949bf98 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -103,7 +103,7 @@ jobs: 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 ../../ - name: Install SDRplay API - run: wget https://www.sdrplay.com/software/SDRplayAPI-macos-installer-universal-3.12.1.pkg && sudo installer -pkg SDRplayAPI-macos-installer-universal-3.12.1.pkg -target / + run: wget https://www.sdrplay.com/software/SDRplayAPI-macos-installer-universal-3.14.0.pkg && sudo installer -pkg SDRplayAPI-macos-installer-universal-3.14.0.pkg -target / - name: Install libiio run: wget https://github.com/analogdevicesinc/libiio/archive/refs/tags/v0.25.zip && 7z x v0.25.zip && cd libiio-0.25 && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ @@ -157,7 +157,7 @@ jobs: 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 ../../ - name: Install SDRplay API - run: wget https://www.sdrplay.com/software/SDRplayAPI-macos-installer-universal-3.12.1.pkg && sudo installer -pkg SDRplayAPI-macos-installer-universal-3.12.1.pkg -target / + run: wget https://www.sdrplay.com/software/SDRplayAPI-macos-installer-universal-3.14.0.pkg && sudo installer -pkg SDRplayAPI-macos-installer-universal-3.14.0.pkg -target / - name: Install libiio run: wget https://github.com/analogdevicesinc/libiio/archive/refs/tags/v0.25.zip && 7z x v0.25.zip && cd libiio-0.25 && mkdir build && cd build && cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release .. && make -j3 && sudo make install && cd ../../ diff --git a/docker_builds/debian_bookworm/do_build.sh b/docker_builds/debian_bookworm/do_build.sh index 080604fd..bb68ce8d 100644 --- a/docker_builds/debian_bookworm/do_build.sh +++ b/docker_builds/debian_bookworm/do_build.sh @@ -9,9 +9,9 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libcodec2-dev autoconf libtool xxd # Install SDRPlay libraries -wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1 +wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0 cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ diff --git a/docker_builds/debian_bullseye/do_build.sh b/docker_builds/debian_bullseye/do_build.sh index 080604fd..bb68ce8d 100644 --- a/docker_builds/debian_bullseye/do_build.sh +++ b/docker_builds/debian_bullseye/do_build.sh @@ -9,9 +9,9 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libcodec2-dev autoconf libtool xxd # Install SDRPlay libraries -wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1 +wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0 cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ diff --git a/docker_builds/debian_buster/do_build.sh b/docker_builds/debian_buster/do_build.sh index 0392de02..fd07762d 100644 --- a/docker_builds/debian_buster/do_build.sh +++ b/docker_builds/debian_buster/do_build.sh @@ -9,9 +9,9 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk1-dev libcodec2-dev autoconf libtool xxd # Install SDRPlay libraries -wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1 +wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0 cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ diff --git a/docker_builds/debian_sid/do_build.sh b/docker_builds/debian_sid/do_build.sh index f4673de6..a08ca282 100644 --- a/docker_builds/debian_sid/do_build.sh +++ b/docker_builds/debian_sid/do_build.sh @@ -9,9 +9,9 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk-dev l libcodec2-dev autoconf libtool xxd # Install SDRPlay libraries -wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1 +wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0 cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ diff --git a/docker_builds/ubuntu_bionic/do_build.sh b/docker_builds/ubuntu_bionic/do_build.sh index f418a06a..4a3cb569 100644 --- a/docker_builds/ubuntu_bionic/do_build.sh +++ b/docker_builds/ubuntu_bionic/do_build.sh @@ -15,9 +15,9 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk1-dev libcodec2-dev libudev-dev autoconf libtool xxd # Install SDRPlay libraries -wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1 +wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0 cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ diff --git a/docker_builds/ubuntu_focal/do_build.sh b/docker_builds/ubuntu_focal/do_build.sh index 080604fd..bb68ce8d 100644 --- a/docker_builds/ubuntu_focal/do_build.sh +++ b/docker_builds/ubuntu_focal/do_build.sh @@ -9,9 +9,9 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libcodec2-dev autoconf libtool xxd # Install SDRPlay libraries -wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1 +wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0 cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ diff --git a/docker_builds/ubuntu_jammy/do_build.sh b/docker_builds/ubuntu_jammy/do_build.sh index 080604fd..bb68ce8d 100644 --- a/docker_builds/ubuntu_jammy/do_build.sh +++ b/docker_builds/ubuntu_jammy/do_build.sh @@ -9,9 +9,9 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libcodec2-dev autoconf libtool xxd # Install SDRPlay libraries -wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1 +wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0 cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ diff --git a/docker_builds/ubuntu_mantic/do_build.sh b/docker_builds/ubuntu_mantic/do_build.sh index f4673de6..a08ca282 100644 --- a/docker_builds/ubuntu_mantic/do_build.sh +++ b/docker_builds/ubuntu_mantic/do_build.sh @@ -9,9 +9,9 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk-dev l libcodec2-dev autoconf libtool xxd # Install SDRPlay libraries -wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1.run -7z x ./SDRplay_RSP_API-Linux-3.12.1 +wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0.run +7z x ./SDRplay_RSP_API-Linux-3.14.0 cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ From 67520ea45e57b17e815655c71713779a638d648a Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 20 Mar 2024 01:58:16 +0100 Subject: [PATCH 35/56] fix linux CI --- docker_builds/debian_bookworm/do_build.sh | 2 +- docker_builds/debian_bullseye/do_build.sh | 2 +- docker_builds/debian_buster/do_build.sh | 2 +- docker_builds/debian_sid/do_build.sh | 2 +- docker_builds/ubuntu_bionic/do_build.sh | 2 +- docker_builds/ubuntu_focal/do_build.sh | 2 +- docker_builds/ubuntu_jammy/do_build.sh | 2 +- docker_builds/ubuntu_mantic/do_build.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker_builds/debian_bookworm/do_build.sh b/docker_builds/debian_bookworm/do_build.sh index bb68ce8d..5172c72c 100644 --- a/docker_builds/debian_bookworm/do_build.sh +++ b/docker_builds/debian_bookworm/do_build.sh @@ -12,7 +12,7 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0 -cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so +cp x86_64/libsdrplay_api.so.3.14 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ # Install libperseus diff --git a/docker_builds/debian_bullseye/do_build.sh b/docker_builds/debian_bullseye/do_build.sh index bb68ce8d..5172c72c 100644 --- a/docker_builds/debian_bullseye/do_build.sh +++ b/docker_builds/debian_bullseye/do_build.sh @@ -12,7 +12,7 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0 -cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so +cp x86_64/libsdrplay_api.so.3.14 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ # Install libperseus diff --git a/docker_builds/debian_buster/do_build.sh b/docker_builds/debian_buster/do_build.sh index fd07762d..23e46af4 100644 --- a/docker_builds/debian_buster/do_build.sh +++ b/docker_builds/debian_buster/do_build.sh @@ -12,7 +12,7 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk1-dev wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0 -cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so +cp x86_64/libsdrplay_api.so.3.14 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ # Install libperseus diff --git a/docker_builds/debian_sid/do_build.sh b/docker_builds/debian_sid/do_build.sh index a08ca282..ecaaffb2 100644 --- a/docker_builds/debian_sid/do_build.sh +++ b/docker_builds/debian_sid/do_build.sh @@ -12,7 +12,7 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk-dev l wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0 -cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so +cp x86_64/libsdrplay_api.so.3.14 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ # Install libperseus diff --git a/docker_builds/ubuntu_bionic/do_build.sh b/docker_builds/ubuntu_bionic/do_build.sh index 4a3cb569..8124c352 100644 --- a/docker_builds/ubuntu_bionic/do_build.sh +++ b/docker_builds/ubuntu_bionic/do_build.sh @@ -18,7 +18,7 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk1-dev wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0 -cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so +cp x86_64/libsdrplay_api.so.3.14 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ # Install a more recent libusb version diff --git a/docker_builds/ubuntu_focal/do_build.sh b/docker_builds/ubuntu_focal/do_build.sh index bb68ce8d..5172c72c 100644 --- a/docker_builds/ubuntu_focal/do_build.sh +++ b/docker_builds/ubuntu_focal/do_build.sh @@ -12,7 +12,7 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0 -cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so +cp x86_64/libsdrplay_api.so.3.14 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ # Install libperseus diff --git a/docker_builds/ubuntu_jammy/do_build.sh b/docker_builds/ubuntu_jammy/do_build.sh index bb68ce8d..5172c72c 100644 --- a/docker_builds/ubuntu_jammy/do_build.sh +++ b/docker_builds/ubuntu_jammy/do_build.sh @@ -12,7 +12,7 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0 -cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so +cp x86_64/libsdrplay_api.so.3.14 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ # Install libperseus diff --git a/docker_builds/ubuntu_mantic/do_build.sh b/docker_builds/ubuntu_mantic/do_build.sh index a08ca282..ecaaffb2 100644 --- a/docker_builds/ubuntu_mantic/do_build.sh +++ b/docker_builds/ubuntu_mantic/do_build.sh @@ -12,7 +12,7 @@ apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk-dev l wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0.run 7z x ./SDRplay_RSP_API-Linux-3.14.0 -cp x86_64/libsdrplay_api.so.3.12 /usr/lib/libsdrplay_api.so +cp x86_64/libsdrplay_api.so.3.14 /usr/lib/libsdrplay_api.so cp inc/* /usr/include/ # Install libperseus From eb8b852ea6ea59e9bae98f4838bf297fab2c3fba Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 22 Mar 2024 02:06:11 +0100 Subject: [PATCH 36/56] fix macos build --- macos/bundle_utils.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macos/bundle_utils.sh b/macos/bundle_utils.sh index a14a1dd0..2116798a 100644 --- a/macos/bundle_utils.sh +++ b/macos/bundle_utils.sh @@ -26,7 +26,8 @@ bundle_is_not_to_be_installed() { if [ "$1" = "CFNetwork" ]; then echo 1; fi if [ "$1" = "SystemConfiguration" ]; then echo 1; fi if [ "$1" = "Security" ]; then echo 1; fi - if [ "$1" = "AppleFSCompression" ]; then echo 1; fi + if [ "$1" = "AppleFSCompression" ]; then echo 1; fi + if [ "$1" = "libsdrplay_api.so.3.14" ]; then echo 1; fi } # ========================= FOR INTERNAL USE ONLY ========================= From bf831e3a50dfa4fb0351259d20d72d093d1faf36 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 22 Mar 2024 18:48:27 +0100 Subject: [PATCH 37/56] attempt to fix the MacOS CI yet again --- .github/workflows/build_all.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 7949bf98..c96f990d 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -96,6 +96,9 @@ jobs: - name: Update brew repositories run: brew update + - name: Fix stuff + run: rm -f /usr/local/bin/2to3* /usr/local/bin/idle3* /usr/local/bin/pydoc3* /usr/local/bin/python3* /usr/local/bin/python3-config* && brew reinstall gettext + - name: Install dependencies run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako @@ -150,6 +153,9 @@ jobs: - name: Update brew repositories run: brew update + - name: Fix stuff + run: rm -f /usr/local/bin/2to3* /usr/local/bin/idle3* /usr/local/bin/pydoc3* /usr/local/bin/python3* /usr/local/bin/python3-config* && brew reinstall gettext + - name: Install dependencies run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako From 867a8680e12e3b42b7adfe4cf79a6a822e699038 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 22 Mar 2024 19:14:17 +0100 Subject: [PATCH 38/56] another MacOS CI fix attempt (this is getting ridiculous, fix your shit github) --- .github/workflows/build_all.yml | 40 +++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index c96f990d..5b7527e3 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -97,7 +97,25 @@ jobs: run: brew update - name: Fix stuff - run: rm -f /usr/local/bin/2to3* /usr/local/bin/idle3* /usr/local/bin/pydoc3* /usr/local/bin/python3* /usr/local/bin/python3-config* && brew reinstall gettext + run: | + # Workaround for https://github.com/actions/runner-images/issues/4020 + brew unlink python@3.12 + brew uninstall --force azure-cli + brew uninstall --force aws-sam-cli + brew uninstall --force pipx + brew uninstall --force python@3.11 + brew uninstall --force python@3.12 + rm -f '/usr/local/bin/2to3' + rm -f '/usr/local/bin/2to3-3.12' + rm -f '/usr/local/bin/idle3' + rm -f '/usr/local/bin/idle3.12' + rm -f '/usr/local/bin/pydoc3' + rm -f '/usr/local/bin/pydoc3.12' + rm -f '/usr/local/bin/python3' + rm -f '/usr/local/bin/python3-config' + rm -f '/usr/local/bin/python3.12' + rm -f '/usr/local/bin/python3.12-config' + brew install python@3 || brew link --overwrite python@3 - name: Install dependencies run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako @@ -154,7 +172,25 @@ jobs: run: brew update - name: Fix stuff - run: rm -f /usr/local/bin/2to3* /usr/local/bin/idle3* /usr/local/bin/pydoc3* /usr/local/bin/python3* /usr/local/bin/python3-config* && brew reinstall gettext + run: | + # Workaround for https://github.com/actions/runner-images/issues/4020 + brew unlink python@3.12 + brew uninstall --force azure-cli + brew uninstall --force aws-sam-cli + brew uninstall --force pipx + brew uninstall --force python@3.11 + brew uninstall --force python@3.12 + rm -f '/usr/local/bin/2to3' + rm -f '/usr/local/bin/2to3-3.12' + rm -f '/usr/local/bin/idle3' + rm -f '/usr/local/bin/idle3.12' + rm -f '/usr/local/bin/pydoc3' + rm -f '/usr/local/bin/pydoc3.12' + rm -f '/usr/local/bin/python3' + rm -f '/usr/local/bin/python3-config' + rm -f '/usr/local/bin/python3.12' + rm -f '/usr/local/bin/python3.12-config' + brew install python@3 || brew link --overwrite python@3 - name: Install dependencies run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako From e1c48e9a1f6eca5b7c0a9cc8e0029181ac6c5f2d Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Tue, 26 Mar 2024 00:30:31 +0100 Subject: [PATCH 39/56] try to fix macos CI again (fix your shit microsoft...) --- .github/workflows/build_all.yml | 48 --------------------------------- 1 file changed, 48 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 5b7527e3..a8922480 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -92,30 +92,6 @@ jobs: - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Update brew repositories - run: brew update - - - name: Fix stuff - run: | - # Workaround for https://github.com/actions/runner-images/issues/4020 - brew unlink python@3.12 - brew uninstall --force azure-cli - brew uninstall --force aws-sam-cli - brew uninstall --force pipx - brew uninstall --force python@3.11 - brew uninstall --force python@3.12 - rm -f '/usr/local/bin/2to3' - rm -f '/usr/local/bin/2to3-3.12' - rm -f '/usr/local/bin/idle3' - rm -f '/usr/local/bin/idle3.12' - rm -f '/usr/local/bin/pydoc3' - rm -f '/usr/local/bin/pydoc3.12' - rm -f '/usr/local/bin/python3' - rm -f '/usr/local/bin/python3-config' - rm -f '/usr/local/bin/python3.12' - rm -f '/usr/local/bin/python3.12-config' - brew install python@3 || brew link --overwrite python@3 - name: Install dependencies run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako @@ -167,30 +143,6 @@ jobs: - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Update brew repositories - run: brew update - - - name: Fix stuff - run: | - # Workaround for https://github.com/actions/runner-images/issues/4020 - brew unlink python@3.12 - brew uninstall --force azure-cli - brew uninstall --force aws-sam-cli - brew uninstall --force pipx - brew uninstall --force python@3.11 - brew uninstall --force python@3.12 - rm -f '/usr/local/bin/2to3' - rm -f '/usr/local/bin/2to3-3.12' - rm -f '/usr/local/bin/idle3' - rm -f '/usr/local/bin/idle3.12' - rm -f '/usr/local/bin/pydoc3' - rm -f '/usr/local/bin/pydoc3.12' - rm -f '/usr/local/bin/python3' - rm -f '/usr/local/bin/python3-config' - rm -f '/usr/local/bin/python3.12' - rm -f '/usr/local/bin/python3.12-config' - brew install python@3 || brew link --overwrite python@3 - name: Install dependencies run: brew install pkg-config libusb fftw glfw airspy airspyhf portaudio hackrf libbladerf codec2 zstd autoconf automake libtool && pip3 install mako From a2054ad780813a21abc99736c9d17bcafc1caa15 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 31 Mar 2024 23:00:50 +0200 Subject: [PATCH 40/56] fix #1367 --- core/src/gui/main_window.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 8ed95324..de690fc5 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -576,20 +576,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; } From 70f90fd57090e1342119d719fc3c318df9ed4c71 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 31 Mar 2024 23:27:07 +0200 Subject: [PATCH 41/56] MacOS CI workaround (I hate you microsoft) --- .github/workflows/build_all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ../../ From 065a5b4c409bcb9e563791893c55d33a09bf859b Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 1 Apr 2024 19:56:36 +0200 Subject: [PATCH 42/56] add audio source to readme --- readme.md | 1 + 1 file changed, 1 insertion(+) 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 | ✅ | ✅ | ✅ | From 12f7efed326d4a5ab5356906ce1b425dc09d245a Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 4 Apr 2024 19:25:02 +0200 Subject: [PATCH 43/56] Switch spectran http source module to use the remoteconfig endpoint as per #1354 --- .../spectran_http_source/src/main.cpp | 10 ++++++--- .../src/spectran_http_client.cpp | 22 ++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) 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..323336ad 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() { From 8eaa987d90271ccbde3aed88f9fe747d3a7eb486 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 4 Apr 2024 19:42:58 +0200 Subject: [PATCH 44/56] fix spectran http source samplerate detection --- .../spectran_http_source/src/spectran_http_client.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 323336ad..3708d518 100644 --- a/source_modules/spectran_http_source/src/spectran_http_client.cpp +++ b/source_modules/spectran_http_source/src/spectran_http_client.cpp @@ -113,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); From 17f698577fe700e8219e068529153b327f21fa30 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 5 Apr 2024 19:50:14 +0200 Subject: [PATCH 45/56] disable FLEX protocol from pager module since it's not implemented and add setBaudrate function --- decoder_modules/pager_decoder/src/main.cpp | 2 +- decoder_modules/pager_decoder/src/pocsag/dsp.h | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) 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/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 From fdfb1dbf5e0abe8191f9393b19f34b0427c98ed3 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Fri, 5 Apr 2024 20:15:21 +0200 Subject: [PATCH 46/56] remove useless menu item in pager decoder --- decoder_modules/pager_decoder/src/pocsag/decoder.h | 4 ---- 1 file changed, 4 deletions(-) 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(); } From db1682a2ac53fa8c58006ecf76e2d2b531a3a846 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 8 Apr 2024 16:21:33 +0200 Subject: [PATCH 47/56] fix #1034 --- core/src/gui/main_window.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index de690fc5..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); From d12021fc2fee92d76e9b7020785af62980d39cd4 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 8 Apr 2024 16:37:03 +0200 Subject: [PATCH 48/56] potential fix for #1361 --- source_modules/soapy_source/src/main.cpp | 26 +++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) 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); From 07eebd70182065fc7730af4a3c6ac091d1ffc787 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 8 Apr 2024 16:59:05 +0200 Subject: [PATCH 49/56] potential fix for #677 --- .../src/sdrpp_server_client.cpp | 18 +++++++++++++++--- .../src/sdrpp_server_client.h | 5 +++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/source_modules/sdrpp_server_source/src/sdrpp_server_client.cpp b/source_modules/sdrpp_server_source/src/sdrpp_server_client.cpp index 9b1e63d5..3480feab 100644 --- a/source_modules/sdrpp_server_source/src/sdrpp_server_client.cpp +++ b/source_modules/sdrpp_server_source/src/sdrpp_server_client.cpp @@ -42,8 +42,20 @@ namespace server { // Ask for a UI int res = getUI(); - if (res == -1) { throw std::runtime_error("Timed out"); } - else if (res == -2) { throw std::runtime_error("Server busy"); } + if (res < 0) { + // Close client + close(); + + // Throw error + switch (res) { + case CONN_ERR_TIMEOUT: + throw std::runtime_error("Timed out"); + case CONN_ERR_BUSY: + throw std::runtime_error("Server busy"); + default: + throw std::runtime_error("Unknown error"); + } + } } Client::~Client() { @@ -234,7 +246,7 @@ namespace server { else { if (!serverBusy) { flog::error("Timeout out after asking for UI"); }; waiter->handled(); - return serverBusy ? -2 : -1; + return serverBusy ? CONN_ERR_BUSY : CONN_ERR_TIMEOUT; } waiter->handled(); return 0; diff --git a/source_modules/sdrpp_server_source/src/sdrpp_server_client.h b/source_modules/sdrpp_server_source/src/sdrpp_server_client.h index d06c8499..e4f4b52f 100644 --- a/source_modules/sdrpp_server_source/src/sdrpp_server_client.h +++ b/source_modules/sdrpp_server_source/src/sdrpp_server_client.h @@ -71,6 +71,11 @@ namespace server { std::mutex handledMtx; }; + enum ConnectionError { + CONN_ERR_TIMEOUT = -1, + CONN_ERR_BUSY = -2 + }; + class Client { public: Client(std::shared_ptr sock, dsp::stream* out); From a2d49b2f877a5248d97633afcc203be001421df6 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 8 Apr 2024 17:17:16 +0200 Subject: [PATCH 50/56] update development status of various modules in the readme --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 33ff7ba9..0f99ea6d 100644 --- a/readme.md +++ b/readme.md @@ -345,7 +345,7 @@ Modules in beta are still included in releases for the most part but not enabled | sdrpp_server_source | Working | - | OPT_BUILD_SDRPP_SERVER_SOURCE | ✅ | ✅ | ✅ | | soapy_source | Working | soapysdr | OPT_BUILD_SOAPY_SOURCE | ✅ | ✅ | ✅ | | spectran_source | Unfinished | RTSA Suite | OPT_BUILD_SPECTRAN_SOURCE | ⛔ | ⛔ | ⛔ | -| spectran_http_source | Unfinished | - | OPT_BUILD_SPECTRAN_HTTP_SOURCE | ✅ | ✅ | ⛔ | +| spectran_http_source | Beta | - | OPT_BUILD_SPECTRAN_HTTP_SOURCE | ✅ | ✅ | ⛔ | | spyserver_source | Working | - | OPT_BUILD_SPYSERVER_SOURCE | ✅ | ✅ | ✅ | | usrp_source | Beta | libuhd | OPT_BUILD_USRP_SOURCE | ⛔ | ⛔ | ⛔ | @@ -366,7 +366,7 @@ Modules in beta are still included in releases for the most part but not enabled | atv_decoder | Unfinished | - | OPT_BUILD_ATV_DECODER | ⛔ | ⛔ | ⛔ | | falcon9_decoder | Unfinished | ffplay | OPT_BUILD_FALCON9_DECODER | ⛔ | ⛔ | ⛔ | | kgsstv_decoder | Unfinished | - | OPT_BUILD_KGSSTV_DECODER | ⛔ | ⛔ | ⛔ | -| m17_decoder | Beta | - | OPT_BUILD_M17_DECODER | ⛔ | ✅ | ⛔ | +| m17_decoder | Working | - | OPT_BUILD_M17_DECODER | ⛔ | ✅ | ⛔ | | meteor_demodulator | Working | - | OPT_BUILD_METEOR_DEMODULATOR | ✅ | ✅ | ⛔ | | pager_decoder | Unfinished | - | OPT_BUILD_PAGER_DECODER | ⛔ | ⛔ | ⛔ | | radio | Working | - | OPT_BUILD_RADIO | ✅ | ✅ | ✅ | @@ -378,7 +378,7 @@ Modules in beta are still included in releases for the most part but not enabled |---------------------|------------|--------------|-----------------------------|:----------------:|:----------------:|:---------------------------:| | discord_integration | Working | - | OPT_BUILD_DISCORD_PRESENCE | ✅ | ✅ | ⛔ | | frequency_manager | Working | - | OPT_BUILD_FREQUENCY_MANAGER | ✅ | ✅ | ✅ | -| iq_exporter | Beta | - | OPT_BUILD_IQ_EXPORTER | ✅ | ✅ | ⛔ | +| iq_exporter | Working | - | OPT_BUILD_IQ_EXPORTER | ✅ | ✅ | ⛔ | | recorder | Working | - | OPT_BUILD_RECORDER | ✅ | ✅ | ✅ | | rigctl_client | Unfinished | - | OPT_BUILD_RIGCTL_CLIENT | ✅ | ✅ | ⛔ | | rigctl_server | Working | - | OPT_BUILD_RIGCTL_SERVER | ✅ | ✅ | ✅ | From e118598f5763d29862cc3ff143e23a36868bffe4 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 10 Apr 2024 18:28:59 +0200 Subject: [PATCH 51/56] Fix waterfall size related crash described in #1230 --- core/src/gui/widgets/waterfall.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/src/gui/widgets/waterfall.cpp b/core/src/gui/widgets/waterfall.cpp index f2556905..8126ee6d 100644 --- a/core/src/gui/widgets/waterfall.cpp +++ b/core/src/gui/widgets/waterfall.cpp @@ -717,18 +717,23 @@ namespace ImGui { void WaterFall::onResize() { std::lock_guard lck(latestFFTMtx); std::lock_guard lck2(smoothingBufMtx); - // return if widget is too small - if (widgetSize.x < 100 || widgetSize.y < 100) { - return; - } + // Check if the size is valid. This is because some settings might be changed before being first displayed. + if (widgetSize.x < 1.0f || widgetSize.y < 1.0f) { return; } + + // Set a minimim size + widgetSize.x = std::max(widgetSize.x, 100.0f*style::uiScale); + widgetSize.y = std::max(widgetSize.y, 100.0f*style::uiScale); + + // Save last height int lastWaterfallHeight = waterfallHeight; + // Compute sizes if (waterfallVisible) { FFTAreaHeight = std::min(FFTAreaHeight, widgetSize.y - (50.0f * style::uiScale)); newFFTAreaHeight = FFTAreaHeight; fftHeight = FFTAreaHeight - (50.0f * style::uiScale); - waterfallHeight = widgetSize.y - fftHeight - (50.0f * style::uiScale) - 2; + waterfallHeight = std::max(1, widgetSize.y - fftHeight - (50.0f * style::uiScale) - 2); } else { fftHeight = widgetSize.y - (50.0f * style::uiScale); From 632a4eebab5be85b6a42c8e61d18895adc4065ff Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 10 Apr 2024 22:09:07 +0200 Subject: [PATCH 52/56] Deprecated SoapySDR support --- .github/workflows/build_all.yml | 4 ++-- CMakeLists.txt | 2 +- core/src/core.cpp | 2 -- docker_builds/debian_bookworm/do_build.sh | 2 +- docker_builds/debian_bullseye/do_build.sh | 2 +- docker_builds/debian_buster/do_build.sh | 2 +- docker_builds/debian_sid/do_build.sh | 2 +- docker_builds/ubuntu_bionic/do_build.sh | 2 +- docker_builds/ubuntu_focal/do_build.sh | 2 +- docker_builds/ubuntu_jammy/do_build.sh | 2 +- docker_builds/ubuntu_mantic/do_build.sh | 2 +- make_macos_bundle.sh | 1 - make_windows_package.ps1 | 2 -- readme.md | 15 ++++----------- 14 files changed, 15 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 427dbf85..d215bbd7 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -119,7 +119,7 @@ jobs: - name: Prepare CMake working-directory: ${{runner.workspace}}/build - run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release + run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release - name: Build working-directory: ${{runner.workspace}}/build @@ -170,7 +170,7 @@ jobs: - name: Prepare CMake working-directory: ${{runner.workspace}}/build - run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF -DOPT_BUILD_PERSEUS_SOURCE=OFF -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release + run: cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF -DOPT_BUILD_PERSEUS_SOURCE=OFF -DOPT_BUILD_AUDIO_SOURCE=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release - name: Build working-directory: ${{runner.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index 470b17cb..0d9b6b00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ option(OPT_BUILD_RTL_SDR_SOURCE "Build RTL-SDR Source Module (Dependencies: libr option(OPT_BUILD_RTL_TCP_SOURCE "Build RTL-TCP Source Module (no dependencies required)" ON) option(OPT_BUILD_SDRPP_SERVER_SOURCE "Build SDR++ Server Source Module (no dependencies required)" ON) option(OPT_BUILD_SDRPLAY_SOURCE "Build SDRplay Source Module (Dependencies: libsdrplay)" OFF) -option(OPT_BUILD_SOAPY_SOURCE "Build SoapySDR Source Module (Dependencies: soapysdr)" ON) +option(OPT_BUILD_SOAPY_SOURCE "Build SoapySDR Source Module (Dependencies: soapysdr)" OFF) option(OPT_BUILD_SPECTRAN_SOURCE "Build Spectran Source Module (Dependencies: Aaronia RTSA Suite)" OFF) option(OPT_BUILD_SPECTRAN_HTTP_SOURCE "Build Spectran HTTP Source Module (no dependencies required)" ON) option(OPT_BUILD_SPYSERVER_SOURCE "Build SpyServer Source Module (no dependencies required)" ON) diff --git a/core/src/core.cpp b/core/src/core.cpp index 09148d0a..0f5c3557 100644 --- a/core/src/core.cpp +++ b/core/src/core.cpp @@ -193,8 +193,6 @@ int sdrpp_main(int argc, char* argv[]) { defConfig["moduleInstances"]["SDRplay Source"]["enabled"] = true; defConfig["moduleInstances"]["SDR++ Server Source"]["module"] = "sdrpp_server_source"; defConfig["moduleInstances"]["SDR++ Server Source"]["enabled"] = true; - defConfig["moduleInstances"]["SoapySDR Source"]["module"] = "soapy_source"; - defConfig["moduleInstances"]["SoapySDR Source"]["enabled"] = true; defConfig["moduleInstances"]["SpyServer Source"]["module"] = "spyserver_source"; defConfig["moduleInstances"]["SpyServer Source"]["enabled"] = true; diff --git a/docker_builds/debian_bookworm/do_build.sh b/docker_builds/debian_bookworm/do_build.sh index 5172c72c..dcbc8552 100644 --- a/docker_builds/debian_bookworm/do_build.sh +++ b/docker_builds/debian_bookworm/do_build.sh @@ -4,7 +4,7 @@ cd /root # Install dependencies and tools apt update -apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \ +apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libairspyhf-dev libairspy-dev \ libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \ libcodec2-dev autoconf libtool xxd diff --git a/docker_builds/debian_bullseye/do_build.sh b/docker_builds/debian_bullseye/do_build.sh index 5172c72c..dcbc8552 100644 --- a/docker_builds/debian_bullseye/do_build.sh +++ b/docker_builds/debian_bullseye/do_build.sh @@ -4,7 +4,7 @@ cd /root # Install dependencies and tools apt update -apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \ +apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libairspyhf-dev libairspy-dev \ libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \ libcodec2-dev autoconf libtool xxd diff --git a/docker_builds/debian_buster/do_build.sh b/docker_builds/debian_buster/do_build.sh index 23e46af4..cd215e26 100644 --- a/docker_builds/debian_buster/do_build.sh +++ b/docker_builds/debian_buster/do_build.sh @@ -4,7 +4,7 @@ cd /root # Install dependencies and tools apt update -apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk1-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \ +apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk1-dev libzstd-dev libairspyhf-dev libairspy-dev \ libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \ libcodec2-dev autoconf libtool xxd diff --git a/docker_builds/debian_sid/do_build.sh b/docker_builds/debian_sid/do_build.sh index ecaaffb2..2c93bfa2 100644 --- a/docker_builds/debian_sid/do_build.sh +++ b/docker_builds/debian_sid/do_build.sh @@ -4,7 +4,7 @@ cd /root # Install dependencies and tools apt update -apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \ +apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk-dev libzstd-dev libairspyhf-dev libairspy-dev \ libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \ libcodec2-dev autoconf libtool xxd diff --git a/docker_builds/ubuntu_bionic/do_build.sh b/docker_builds/ubuntu_bionic/do_build.sh index 8124c352..ca7315ae 100644 --- a/docker_builds/ubuntu_bionic/do_build.sh +++ b/docker_builds/ubuntu_bionic/do_build.sh @@ -10,7 +10,7 @@ echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://ap apt update # Install dependencies and tools -apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk1-dev libzstd-dev libsoapysdr-dev libairspy-dev \ +apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk1-dev libzstd-dev libairspy-dev \ libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \ libcodec2-dev libudev-dev autoconf libtool xxd diff --git a/docker_builds/ubuntu_focal/do_build.sh b/docker_builds/ubuntu_focal/do_build.sh index 5172c72c..dcbc8552 100644 --- a/docker_builds/ubuntu_focal/do_build.sh +++ b/docker_builds/ubuntu_focal/do_build.sh @@ -4,7 +4,7 @@ cd /root # Install dependencies and tools apt update -apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \ +apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libairspyhf-dev libairspy-dev \ libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \ libcodec2-dev autoconf libtool xxd diff --git a/docker_builds/ubuntu_jammy/do_build.sh b/docker_builds/ubuntu_jammy/do_build.sh index 5172c72c..dcbc8552 100644 --- a/docker_builds/ubuntu_jammy/do_build.sh +++ b/docker_builds/ubuntu_jammy/do_build.sh @@ -4,7 +4,7 @@ cd /root # Install dependencies and tools apt update -apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \ +apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libairspyhf-dev libairspy-dev \ libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \ libcodec2-dev autoconf libtool xxd diff --git a/docker_builds/ubuntu_mantic/do_build.sh b/docker_builds/ubuntu_mantic/do_build.sh index ecaaffb2..2c93bfa2 100644 --- a/docker_builds/ubuntu_mantic/do_build.sh +++ b/docker_builds/ubuntu_mantic/do_build.sh @@ -4,7 +4,7 @@ cd /root # Install dependencies and tools apt update -apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \ +apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libvolk-dev libzstd-dev libairspyhf-dev libairspy-dev \ libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget portaudio19-dev \ libcodec2-dev autoconf libtool xxd diff --git a/make_macos_bundle.sh b/make_macos_bundle.sh index c557d5aa..4aa40588 100644 --- a/make_macos_bundle.sh +++ b/make_macos_bundle.sh @@ -45,7 +45,6 @@ bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/rtl_tcp_source/rtl_tcp_source.dylib bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/sdrplay_source/sdrplay_source.dylib bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/sdrpp_server_source/sdrpp_server_source.dylib -bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/soapy_source/soapy_source.dylib bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/spyserver_source/spyserver_source.dylib # bundle_install_binary $BUNDLE $BUNDLE/Contents/Plugins $BUILD_DIR/source_modules/usrp_source/usrp_source.dylib diff --git a/make_windows_package.ps1 b/make_windows_package.ps1 index 64b73466..c048490c 100644 --- a/make_windows_package.ps1 +++ b/make_windows_package.ps1 @@ -51,8 +51,6 @@ cp 'C:/Program Files/SDRplay/API/x64/sdrplay_api.dll' sdrpp_windows_x64/ -ErrorA cp $build_dir/source_modules/sdrpp_server_source/Release/sdrpp_server_source.dll sdrpp_windows_x64/modules/ -cp $build_dir/source_modules/soapy_source/Release/soapy_source.dll sdrpp_windows_x64/modules/ - cp $build_dir/source_modules/spyserver_source/Release/spyserver_source.dll sdrpp_windows_x64/modules/ # cp $build_dir/source_modules/usrp_source/Release/usrp_source.dll sdrpp_windows_x64/modules/ diff --git a/readme.md b/readme.md index 0f99ea6d..b0e0dbbf 100644 --- a/readme.md +++ b/readme.md @@ -44,7 +44,7 @@ Download the latest release from [the Releases page](https://github.com/Alexandr Then, run: ```sh -sudo apt install libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libsoapysdr-dev libairspyhf-dev libiio-dev libad9361-dev librtaudio-dev libhackrf-dev +sudo apt install libfftw3-dev libglfw3-dev libvolk2-dev libzstd-dev libairspyhf-dev libiio-dev libad9361-dev librtaudio-dev libhackrf-dev sudo dpkg -i sdrpp_debian_amd64.deb ``` @@ -135,7 +135,6 @@ As mentioned previously you need to edit `root_dev/config.json` to add the modul "./build/radio/Release/radio.dll", "./build/recorder/Release/recorder.dll", "./build/rtl_tcp_source/Release/rtl_tcp_source.dll", - "./build/soapy_source/Release/soapy_source.dll", "./build/audio_sink/Release/audio_sink.dll" ] ... @@ -166,7 +165,6 @@ The modules built will be some of the following (Repeat the instructions above f * `build/recorder/Release/` * `build/rtl_tcp_source/Release/` * `build/spyserver_source/Release/` -* `build/soapy_source/Release/` * `build/airspyhf_source/Release/` * `build/plutosdr_source/Release/` * `build/audio_sink/Release/` @@ -176,13 +174,9 @@ The modules built will be some of the following (Repeat the instructions above f ## Select which modules you wish to build Depending on which module you want to build, you will need to install some additional dependencies. -Here are listed every module that requires addition dependencies. If a module enabled by default and you do not wish to install a particular dependency (or can't, eg. the BladeRF module on Debian Buster), -you can disable it using the module parameter listed in the table below +Please refer to the module list table further down in this readme for the names, dependencies and build options of each module. -* soapy_source: SoapySDR + drivers for each SDRs (see SoapySDR docs) -* airspyhf_source: libairspyhf -* plutosdr_source: libiio, libad9361 -* audio_sink: librtaudio-dev +The build options are then passed to the cmake command as such `cmake .. -DOPTION_NAME_HERE=ON -DANOTHER_OPTION_HERE=OFF` etc... ## Install dependencies @@ -231,7 +225,6 @@ Then, you will need to edit the `root_dev/config.json` file to point to the modu "./build/radio/radio.so", "./build/recorder/recorder.so", "./build/rtl_tcp_source/rtl_tcp_source.so", - "./build/soapy_source/soapy_source.so", "./build/audio_sink/audio_sink.so" ] ... @@ -343,7 +336,7 @@ Modules in beta are still included in releases for the most part but not enabled | rtl_tcp_source | Working | - | OPT_BUILD_RTL_TCP_SOURCE | ✅ | ✅ | ✅ | | sdrplay_source | Working | SDRplay API | OPT_BUILD_SDRPLAY_SOURCE | ⛔ | ✅ | ✅ | | sdrpp_server_source | Working | - | OPT_BUILD_SDRPP_SERVER_SOURCE | ✅ | ✅ | ✅ | -| soapy_source | Working | soapysdr | OPT_BUILD_SOAPY_SOURCE | ✅ | ✅ | ✅ | +| soapy_source | Deprecated | soapysdr | OPT_BUILD_SOAPY_SOURCE | ⛔ | ⛔ | ⛔ | | spectran_source | Unfinished | RTSA Suite | OPT_BUILD_SPECTRAN_SOURCE | ⛔ | ⛔ | ⛔ | | spectran_http_source | Beta | - | OPT_BUILD_SPECTRAN_HTTP_SOURCE | ✅ | ✅ | ⛔ | | spyserver_source | Working | - | OPT_BUILD_SPYSERVER_SOURCE | ✅ | ✅ | ✅ | From ea08fac32e83cde5328b531eb0d2c939c599c11a Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 14 Apr 2024 03:41:00 +0200 Subject: [PATCH 53/56] handle deprecation of rotator in volk 3.1.0 --- core/src/dsp/channel/frequency_xlator.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/dsp/channel/frequency_xlator.h b/core/src/dsp/channel/frequency_xlator.h index d3713317..bfb3b94a 100644 --- a/core/src/dsp/channel/frequency_xlator.h +++ b/core/src/dsp/channel/frequency_xlator.h @@ -41,7 +41,11 @@ namespace dsp::channel { } inline int process(int count, const complex_t* in, complex_t* out) { +#if VOLK_VERSION >= 030100 + volk_32fc_s32fc_x2_rotator2_32fc((lv_32fc_t*)out, (lv_32fc_t*)in, &phaseDelta, &phase, count); +#else volk_32fc_s32fc_x2_rotator_32fc((lv_32fc_t*)out, (lv_32fc_t*)in, phaseDelta, &phase, count); +#endif return count; } From 6fdab5e0c2a83ad3f002ef7a8a433260495388ba Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 15 Apr 2024 06:23:39 +0200 Subject: [PATCH 54/56] undo problematic commit --- core/src/gui/widgets/waterfall.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/core/src/gui/widgets/waterfall.cpp b/core/src/gui/widgets/waterfall.cpp index 8126ee6d..f2556905 100644 --- a/core/src/gui/widgets/waterfall.cpp +++ b/core/src/gui/widgets/waterfall.cpp @@ -717,23 +717,18 @@ namespace ImGui { void WaterFall::onResize() { std::lock_guard lck(latestFFTMtx); std::lock_guard lck2(smoothingBufMtx); + // return if widget is too small + if (widgetSize.x < 100 || widgetSize.y < 100) { + return; + } - // Check if the size is valid. This is because some settings might be changed before being first displayed. - if (widgetSize.x < 1.0f || widgetSize.y < 1.0f) { return; } - - // Set a minimim size - widgetSize.x = std::max(widgetSize.x, 100.0f*style::uiScale); - widgetSize.y = std::max(widgetSize.y, 100.0f*style::uiScale); - - // Save last height int lastWaterfallHeight = waterfallHeight; - // Compute sizes if (waterfallVisible) { FFTAreaHeight = std::min(FFTAreaHeight, widgetSize.y - (50.0f * style::uiScale)); newFFTAreaHeight = FFTAreaHeight; fftHeight = FFTAreaHeight - (50.0f * style::uiScale); - waterfallHeight = std::max(1, widgetSize.y - fftHeight - (50.0f * style::uiScale) - 2); + waterfallHeight = widgetSize.y - fftHeight - (50.0f * style::uiScale) - 2; } else { fftHeight = widgetSize.y - (50.0f * style::uiScale); From 779ef7ecf11bfe180a3c1b15fc3c181b2b53cd3b Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 17 Apr 2024 01:20:17 +0200 Subject: [PATCH 55/56] fix memcpy erroneously used on overlapping buffer regions as described in #1379 --- core/src/dsp/filter/fir.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/dsp/filter/fir.h b/core/src/dsp/filter/fir.h index 51b377b2..22ad2aa1 100644 --- a/core/src/dsp/filter/fir.h +++ b/core/src/dsp/filter/fir.h @@ -41,10 +41,10 @@ namespace dsp::filter { // Move existing data to make transition seemless if (_taps.size < oldTC) { - memcpy(buffer, &buffer[oldTC - _taps.size], (_taps.size - 1) * sizeof(D)); + memmove(buffer, &buffer[oldTC - _taps.size], (_taps.size - 1) * sizeof(D)); } else if (_taps.size > oldTC) { - memcpy(&buffer[_taps.size - oldTC], buffer, (oldTC - 1) * sizeof(D)); + memmove(&buffer[_taps.size - oldTC], buffer, (oldTC - 1) * sizeof(D)); buffer::clear(buffer, _taps.size - oldTC); } From 2813aa7c93d232ed82d971fbe7b44a31853128e8 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 17 Apr 2024 01:31:49 +0200 Subject: [PATCH 56/56] fix some tables not scaled along with the rest of the UI as described in #1382 --- core/src/gui/menus/module_manager.cpp | 2 +- misc_modules/frequency_manager/src/main.cpp | 2 +- misc_modules/scheduler/src/main.cpp | 2 +- misc_modules/scheduler/src/sched_task.h | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/gui/menus/module_manager.cpp b/core/src/gui/menus/module_manager.cpp index f2314184..902f1974 100644 --- a/core/src/gui/menus/module_manager.cpp +++ b/core/src/gui/menus/module_manager.cpp @@ -39,7 +39,7 @@ namespace module_manager_menu { ImVec2 btnSize = ImVec2(lheight, lheight - 1); ImVec2 textOff = ImVec2(3.0f * style::uiScale, -5.0f * style::uiScale); - if (ImGui::BeginTable("Module Manager Table", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 200))) { + if (ImGui::BeginTable("Module Manager Table", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 200.0f * style::uiScale))) { ImGui::TableSetupColumn("Name"); ImGui::TableSetupColumn("Type"); ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, cellWidth); diff --git a/misc_modules/frequency_manager/src/main.cpp b/misc_modules/frequency_manager/src/main.cpp index f50f8bfd..c5704c2b 100644 --- a/misc_modules/frequency_manager/src/main.cpp +++ b/misc_modules/frequency_manager/src/main.cpp @@ -485,7 +485,7 @@ private: } // Bookmark list - if (ImGui::BeginTable(("freq_manager_bkm_table" + _this->name).c_str(), 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 200))) { + if (ImGui::BeginTable(("freq_manager_bkm_table" + _this->name).c_str(), 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 200.0f * style::uiScale))) { ImGui::TableSetupColumn("Name"); ImGui::TableSetupColumn("Bookmark"); ImGui::TableSetupScrollFreeze(2, 1); diff --git a/misc_modules/scheduler/src/main.cpp b/misc_modules/scheduler/src/main.cpp index 015b00eb..1c0f1869 100644 --- a/misc_modules/scheduler/src/main.cpp +++ b/misc_modules/scheduler/src/main.cpp @@ -89,7 +89,7 @@ private: } } - if (ImGui::BeginTable(("freq_manager_bkm_table" + _this->name).c_str(), 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 200))) { + if (ImGui::BeginTable(("freq_manager_bkm_table" + _this->name).c_str(), 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 200.0f * style::uiScale))) { ImGui::TableSetupColumn("Name"); ImGui::TableSetupColumn("Countdown"); ImGui::TableSetupScrollFreeze(2, 1); diff --git a/misc_modules/scheduler/src/sched_task.h b/misc_modules/scheduler/src/sched_task.h index df50772c..05bcb56e 100644 --- a/misc_modules/scheduler/src/sched_task.h +++ b/misc_modules/scheduler/src/sched_task.h @@ -52,7 +52,7 @@ public: } } - if (ImGui::BeginTable("scheduler_task_triggers", 1, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 100))) { + if (ImGui::BeginTable("scheduler_task_triggers", 1, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 100.0f * style::uiScale))) { ImGui::TableSetupColumn("Triggers"); ImGui::TableSetupScrollFreeze(1, 1); ImGui::TableHeadersRow(); @@ -65,7 +65,7 @@ public: ImGui::EndTable(); } - if (ImGui::BeginTable("scheduler_task_actions", 1, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 100))) { + if (ImGui::BeginTable("scheduler_task_actions", 1, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 100.0f * style::uiScale))) { ImGui::TableSetupColumn("Actions"); ImGui::TableSetupScrollFreeze(1, 1); ImGui::TableHeadersRow();