Skip to content

Commit

Permalink
gr-util: fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Suciu <[email protected]>
  • Loading branch information
adisuciu committed Sep 16, 2024
1 parent 4f7d5c8 commit dac8f74
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 50 deletions.
2 changes: 2 additions & 0 deletions gr-util/include/gr-util/grsignalsrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "scopy-gr-util_export.h"

#include <gnuradio/analog/sig_source.h>
#include <gnuradio/blocks/stream_to_vector.h>

namespace scopy::grutil {
class SCOPY_GR_UTIL_EXPORT GRSignalSrc : public GRProxyBlock
Expand All @@ -26,6 +27,7 @@ class SCOPY_GR_UTIL_EXPORT GRSignalSrc : public GRProxyBlock
protected:
gr::analog::sig_source_f::sptr sig;
gr::analog::gr_waveform_t m_waveform;
gr::blocks::stream_to_vector::sptr s2v;
double m_sampling_frequency;
double m_freq;
double m_phase;
Expand Down
7 changes: 5 additions & 2 deletions gr-util/src/grsignalsrc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "grsignalsrc.h"

#include "grtopblock.h"
#include "grlog.h"

using namespace scopy::grutil;
Expand Down Expand Up @@ -55,8 +55,11 @@ void GRSignalSrc::build_blks(GRTopBlock *top)
{
qDebug(SCOPY_GR_UTIL) << "Building GRSignalSrc";
sig = gr::analog::sig_source_f::make(m_sampling_frequency, m_waveform, m_freq, m_amplitude, m_offset, m_phase);
s2v = gr::blocks::stream_to_vector::make(sizeof(float), top->vlen());
top->connect(sig,0,s2v,0);
start_blk.append(sig);
end_blk = sig;
start_blk.append(s2v);
end_blk = s2v;
}

void GRSignalSrc::destroy_blks(GRTopBlock *top)
Expand Down
2 changes: 1 addition & 1 deletion gr-util/src/grtopblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GRTopBlock::GRTopBlock(QString name, QObject *parent)
QString topblockname = m_name + QString::number(topblockid);
topblockid++;
qInfo() << "building" << topblockname;
top = gr::make_top_block(topblockname.toStdString());
top = gr::make_top_block(topblockname.toStdString(),false);
QObject::connect(this, SIGNAL(requestRebuild()), this, SLOT(rebuild()), Qt::QueuedConnection);
}

Expand Down
Loading

0 comments on commit dac8f74

Please sign in to comment.