Skip to content

Commit

Permalink
Turn SineSource into a regular GP block
Browse files Browse the repository at this point in the history
  • Loading branch information
frankosterfeld committed Jan 31, 2024
1 parent 232abc4 commit 57bdc1a
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/service/dashboard/defaultDashboard.flowgraph
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ blocks:
- name: sum sigs
id: Arithmetic
- name: sine source 1
id: sine_source
id: opendigitizer::SineSource
parameters:
frequency: 0.100000
- name: source for sink 1
Expand Down
23 changes: 11 additions & 12 deletions src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_VERBOSE_MAKEFILE OFF)

set(sources
main.cpp
app.cpp
flowgraph.cpp
flowgraphitem.cpp
dashboard.cpp
flowgraph/datasource.cpp
flowgraph/datasink.cpp
flowgraph/arithmetic_block.cpp
dashboardpage.cpp
opendashboardpage.cpp
imguiutils.cpp
remotesignalsources.cpp)
main.cpp
app.cpp
flowgraph.cpp
flowgraphitem.cpp
dashboard.cpp
flowgraph/datasink.cpp
flowgraph/arithmetic_block.cpp
dashboardpage.cpp
opendashboardpage.cpp
imguiutils.cpp
remotesignalsources.cpp)

set(GNURADIO_PREFIX
"/usr/"
Expand Down
4 changes: 2 additions & 2 deletions src/ui/assets/sampleDashboards/DemoDashboard.grc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ blocks:
- name: FFT
id: FFT
- name: sine source 1
id: sine_source
id: opendigitizer::SineSource
parameters:
frequency: 1.000000
- name: sine source 3
id: sine_source
id: opendigitizer::SineSource
parameters:
frequency: 1.300000
- name: sink 1
Expand Down
8 changes: 4 additions & 4 deletions src/ui/assets/sampleDashboards/ExtendedDemoDashboard.grc
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ blocks:
- name: FFT
id: FFT
- name: sine source 3
id: sine_source
id: opendigitizer::SineSource
parameters:
frequency: 0.100000
- name: sine source 4
id: sine_source
id: opendigitizer::SineSource
parameters:
frequency: 0.200000
- name: sine source 5
id: sine_source
id: opendigitizer::SineSource
parameters:
frequency: 0.300000
- name: sine source 6
id: sine_source
id: opendigitizer::SineSource
parameters:
frequency: 0.400000
- name: source for sink 1
Expand Down
File renamed without changes.
23 changes: 8 additions & 15 deletions src/ui/flowgraph/datasource.cpp → src/ui/blocks/SineSource.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#include "datasource.h"

#include <fmt/format.h>
#include <math.h>
#include <mutex>
#ifndef OPENDIGITIZER_SINESOURCE_HPP
#define OPENDIGITIZER_SINESOURCE_HPP

#include <fmt/format.h>
#include <gnuradio-4.0/Block.hpp>

#include "../flowgraph.h"
#include <mutex>

namespace opendigitizer {

template<typename T>
requires std::is_arithmetic_v<T>
Expand Down Expand Up @@ -57,14 +56,8 @@ struct SineSource : public gr::Block<SineSource<T>, gr::BlockingIO<true>> {
}
};

ENABLE_REFLECTION_FOR_TEMPLATE_FULL((typename T), (SineSource<T>), out, frequency);
static_assert(gr::traits::block::can_processOne<SineSource<float>>);
static_assert(gr::traits::block::can_processOne<SineSource<double>>);

namespace DigitizerUi {
} // namespace opendigitizer

void DataSource::registerBlockType() {
BlockType::registry().addBlockType<SineSource>("sine_source");
}
ENABLE_REFLECTION_FOR_TEMPLATE(opendigitizer::SineSource, out, frequency)

} // namespace DigitizerUi
#endif
14 changes: 0 additions & 14 deletions src/ui/flowgraph/datasource.h

This file was deleted.

2 changes: 0 additions & 2 deletions src/ui/flowgraphitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include "flowgraph.h"
#include "imguiutils.h"

#include "flowgraph/datasource.h"

namespace DigitizerUi {

FlowGraphItem::FlowGraphItem() {
Expand Down
6 changes: 3 additions & 3 deletions src/ui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
#include <gnuradio-4.0/Scheduler.hpp>

#include "app.h"
#include "blocks/RemoteSource.hpp"
#include "blocks/SineSource.hpp"
#include "dashboard.h"
#include "dashboardpage.h"
#include "fair_header.h"
#include "flowgraph.h"
#include "flowgraph/arithmetic_block.h"
#include "flowgraph/datasink.h"
#include "flowgraph/datasource.h"
#include "flowgraphitem.h"
#include "RemoteSource.hpp"
#include "utils/TouchHandler.hpp"

CMRC_DECLARE(ui_assets);
Expand Down Expand Up @@ -237,10 +237,10 @@ int main(int argc, char **argv) {
DigitizerUi::BlockType::registry().loadBlockDefinitions(BLOCKS_DIR);
#endif

DigitizerUi::DataSource::registerBlockType();
DigitizerUi::DataSink::registerBlockType();
DigitizerUi::DataSinkSource::registerBlockType();
DigitizerUi::ArithmeticBlock::registerBlockType();
DigitizerUi::BlockType::registry().addBlockType<opendigitizer::SineSource>("opendigitizer::SineSource");
DigitizerUi::BlockType::registry().addBlockType<opendigitizer::RemoteSource>("opendigitizer::RemoteSource");
DigitizerUi::BlockType::registry().addBlockType<SpecFFT>("FFT");

Expand Down

0 comments on commit 57bdc1a

Please sign in to comment.