Skip to content

Commit

Permalink
Make Arithmetic a normal GR block
Browse files Browse the repository at this point in the history
  • Loading branch information
frankosterfeld committed Jan 31, 2024
1 parent 57bdc1a commit f11c5b0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/service/dashboard/defaultDashboard.flowgraph
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ blocks:
- name: FFT
id: FFT
- name: sum sigs
id: Arithmetic
id: opendigitizer::Arithmetic
- name: sine source 1
id: opendigitizer::SineSource
parameters:
Expand Down
1 change: 0 additions & 1 deletion src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ set(sources
flowgraphitem.cpp
dashboard.cpp
flowgraph/datasink.cpp
flowgraph/arithmetic_block.cpp
dashboardpage.cpp
opendashboardpage.cpp
imguiutils.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/ui/assets/sampleDashboards/DemoDashboard.grc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
blocks:
- name: sum sigs
id: Arithmetic
id: opendigitizer::Arithmetic
- name: FFT
id: FFT
- name: sine source 1
Expand Down
6 changes: 3 additions & 3 deletions src/ui/assets/sampleDashboards/ExtendedDemoDashboard.grc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
blocks:
- name: sum sigs1
id: Arithmetic
id: opendigitizer::Arithmetic
- name: sum sigs2
id: Arithmetic
id: opendigitizer::Arithmetic
- name: sum sigs3
id: Arithmetic
id: opendigitizer::Arithmetic
- name: FFT
id: FFT
- name: sine source 3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#include "arithmetic_block.h"
#ifndef OPENDIGITIZER_ARITHMETIC_HPP
#define OPENDIGITIZER_ARITHMETIC_HPP

#include <type_traits>
#include <gnuradio-4.0/Block.hpp>

#include "../flowgraph.h"
namespace opendigitizer {

template<typename T>
requires std::is_arithmetic_v<T>
struct MathNode : public gr::Block<MathNode<T>> {
gr::PortIn<T> in1{};
gr::PortIn<T> in2{};
struct Arithmetic : public gr::Block<Arithmetic<T>> {
gr::PortIn<T> in1;
gr::PortIn<T> in2;

gr::PortOut<T> out{};
gr::PortOut<T> out;

gr::Annotated<std::string, "operation"> operation = std::string("+");

Expand All @@ -33,12 +34,8 @@ struct MathNode : public gr::Block<MathNode<T>> {
}
};

ENABLE_REFLECTION_FOR_TEMPLATE_FULL((typename T), (MathNode<T>), in1, in2, out, operation);
} // namespace opendigitizer

namespace DigitizerUi {
ENABLE_REFLECTION_FOR_TEMPLATE(opendigitizer::Arithmetic, in1, in2, out, operation)

void ArithmeticBlock::registerBlockType() {
BlockType::registry().addBlockType<MathNode>("Arithmetic");
}

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

This file was deleted.

4 changes: 2 additions & 2 deletions src/ui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
#include <gnuradio-4.0/Scheduler.hpp>

#include "app.h"
#include "blocks/Arithmetic.hpp"
#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 "flowgraphitem.h"
#include "utils/TouchHandler.hpp"
Expand Down Expand Up @@ -239,9 +239,9 @@ int main(int argc, char **argv) {

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<opendigitizer::Arithmetic>("opendigitizer::Arithmetic");
DigitizerUi::BlockType::registry().addBlockType<SpecFFT>("FFT");

loadFonts(app);
Expand Down

0 comments on commit f11c5b0

Please sign in to comment.