Skip to content

Commit

Permalink
windows debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreRouma committed Jun 8, 2024
1 parent bb9024f commit 936c99d
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ jobs:

- name: Prepare CMake
working-directory: ${{runner.workspace}}/build
run: cmake "$Env:GITHUB_WORKSPACE" "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
run: cmake "$Env:GITHUB_WORKSPACE" "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE=Debug -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_PERSEUS_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON

- name: Build
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config Release --verbose
run: cmake --build . --config Debug --verbose

- name: Create Archive
working-directory: ${{runner.workspace}}
Expand Down
11 changes: 11 additions & 0 deletions core/src/gui/widgets/symbol_diagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,15 @@ namespace ImGui {
bufferMtx.unlock();
}

void SymbolDiagram::setCount(int count) {
std::lock_guard<std::mutex> lck(bufferMtx);
delete[] buffer;
buffer = new float[count];
sampleCount = count;
memset(buffer, 0, sampleCount * sizeof(float));
}

int SymbolDiagram::getCount() {
return sampleCount;
}
}
4 changes: 4 additions & 0 deletions core/src/gui/widgets/symbol_diagram.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ namespace ImGui {

void releaseBuffer();

void setCount(int count);

int getCount();

std::vector<float> lines;

private:
Expand Down
29 changes: 20 additions & 9 deletions decoder_modules/pager_decoder/src/pocsag/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@
#include "dsp.h"
#include "pocsag.h"

#define BAUDRATE 2400
#define SAMPLERATE (BAUDRATE*10)

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, 2400) {
this->name = name;
this->vfo = vfo;

// Default baudrate (TODO: Load from config)
baudrate = 2400;

// Define baudrate options
baudrates.define(512, "512 Baud", 512);
baudrates.define(1200, "1200 Baud", 1200);
baudrates.define(2400, "2400 Baud", 2400);

// Init DSP
vfo->setBandwidthLimits(12500, 12500, true);
vfo->setSampleRate(SAMPLERATE, 12500);
dsp.init(vfo->output, SAMPLERATE, BAUDRATE);
reshape.init(&dsp.soft, BAUDRATE, (BAUDRATE / 30.0) - BAUDRATE);
vfo->setSampleRate(baudrate*10.0, 12500);
dsp.init(vfo->output, baudrate*10.0, baudrate);
reshape.init(&dsp.soft, baudrate, (baudrate / 30.0) - baudrate);
dataHandler.init(&dsp.out, _dataHandler, this);
diagHandler.init(&reshape.out, _diagHandler, this);

Expand All @@ -42,7 +42,7 @@ class POCSAGDecoder : public Decoder {
ImGui::LeftLabel("Baudrate");
ImGui::FillWidth();
if (ImGui::Combo(("##pager_decoder_pocsag_br_" + name).c_str(), &brId, baudrates.txt)) {
// TODO
setBaudrate(baudrates.value(brId));
}

ImGui::FillWidth();
Expand Down Expand Up @@ -79,14 +79,24 @@ class POCSAGDecoder : public Decoder {
static void _diagHandler(float* data, int count, void* ctx) {
POCSAGDecoder* _this = (POCSAGDecoder*)ctx;
float* buf = _this->diag.acquireBuffer();
memcpy(buf, data, count * sizeof(float));
int maxCount = std::min<int>(count, _this->diag.getCount());
memcpy(buf, data, maxCount * sizeof(float));
_this->diag.releaseBuffer();
}

void messageHandler(pocsag::Address addr, pocsag::MessageType type, const std::string& msg) {
flog::debug("[{}]: '{}'", (uint32_t)addr, msg);
}

void setBaudrate(double baudrate) {
vfo->setSampleRate(baudrate*10.0, 12500);
stop();
reshape.setKeep(baudrate);
reshape.setSkip((baudrate / 30.0) - baudrate);
diag.setCount(baudrate);
start();
}

std::string name;
VFOManager::VFO* vfo;

Expand All @@ -100,6 +110,7 @@ class POCSAGDecoder : public Decoder {
ImGui::SymbolDiagram diag;

int brId = 2;
double baudrate = 2400;

OptionList<int, int> baudrates;
};
2 changes: 1 addition & 1 deletion docker_builds/ubuntu_bionic/do_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ make VERBOSE=1 -j2

# Generate package
cd ..
sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libvolk1-dev, librtaudio-dev, libzstd-dev'
sh make_debian_package.sh ./build 'libfftw3-bin, libglfw3, libvolk1-bin, librtaudio6, libzstd1'
2 changes: 1 addition & 1 deletion docker_builds/ubuntu_focal/do_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
make VERBOSE=1 -j2

cd ..
sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libvolk2-dev, librtaudio-dev, libzstd-dev'
sh make_debian_package.sh ./build 'libfftw3-bin, libglfw3, libvolk2-bin, librtaudio6, libzstd1'
2 changes: 1 addition & 1 deletion docker_builds/ubuntu_jammy/do_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
make VERBOSE=1 -j2

cd ..
sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libvolk2-dev, librtaudio-dev, libzstd-dev'
sh make_debian_package.sh ./build 'libfftw3-bin, libglfw3, libvolk2-bin, librtaudio6, libzstd1'
2 changes: 1 addition & 1 deletion docker_builds/ubuntu_mantic/do_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
make VERBOSE=1 -j2

cd ..
sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libvolk-dev, librtaudio-dev, libzstd-dev'
sh make_debian_package.sh ./build 'libfftw3-bin, libglfw3, libvolk-bin, librtaudio6, libzstd1'
2 changes: 1 addition & 1 deletion docker_builds/ubuntu_noble/do_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD
make VERBOSE=1 -j2

cd ..
sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libvolk-dev, librtaudio-dev, libzstd-dev'
sh make_debian_package.sh ./build 'libfftw3-bin, libglfw3, libvolk-bin, librtaudio6, libzstd1'
21 changes: 20 additions & 1 deletion source_modules/rfnm_source/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class RFNMSourceModule : public ModuleManager::Instance {
}

private:
void refresh() {
void refresh() {
#ifndef __ANDROID__
devices.clear();
auto list = librfnm::find(librfnm_transport::LIBRFNM_TRANSPORT_USB);
for (const auto& info : list) {
Expand All @@ -75,6 +76,16 @@ class RFNMSourceModule : public ModuleManager::Instance {
// Save device
devices.define((char*)info.motherboard.serial_number, devName, (char*)info.motherboard.serial_number);
}
#else
// Check for device presence
int vid, pid;
devFd = backend::getDeviceFD(vid, pid, backend::RFNM_VIDPIDS);
if (devFd < 0) { return; }

// Get device info
std::string fakeName = "RFNM USB";
devices.define(fakeName, fakeName, fakeName);
#endif
}

void select(const std::string& serial) {
Expand Down Expand Up @@ -142,7 +153,11 @@ class RFNMSourceModule : public ModuleManager::Instance {
if (_this->running) { return; }

// Open the device
#ifndef __ANDROID__
_this->openDev = new librfnm(librfnm_transport::LIBRFNM_TRANSPORT_USB, _this->selectedSerial);
#else
_this->openDev = new librfnm(_this->devFd);
#endif

// Configure the device
_this->openDev->librfnm_s->rx.ch[0].enable = RFNM_CH_ON;
Expand Down Expand Up @@ -323,6 +338,10 @@ class RFNMSourceModule : public ModuleManager::Instance {
int bufferSize = -1;
librfnm_rx_buf rxBuf[LIBRFNM_MIN_RX_BUFCNT];

#ifdef __ANDROID__
int devFd = 0;
#endif

std::thread workerThread;
};

Expand Down

0 comments on commit 936c99d

Please sign in to comment.