Skip to content

Commit

Permalink
Picoscope: Replace port array by port vector
Browse files Browse the repository at this point in the history
gets around a restriction for the process bulk variant.
Tests with actual hardware still fail, but it builds again.

Signed-off-by: Alexander Krimm <A.Krimm@gsi.de>
  • Loading branch information
wirew0rm committed Oct 11, 2024
1 parent 6751e5c commit f97ff4a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
6 changes: 4 additions & 2 deletions blocklib/picoscope/Picoscope4000a.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ class Picoscope4000a : public fair::picoscope::Picoscope<T, acquisitionMode, Pic
public:
using super_t = fair::picoscope::Picoscope<T, acquisitionMode, Picoscope4000a<T, acquisitionMode>>;

Picoscope4000a(gr::property_map props) : super_t(std::move(props)) {}
Picoscope4000a(gr::property_map props) : super_t(std::move(props)) {
analog_out.resize(8);
}

std::array<gr::PortOut<T>, 8> analog_out;
std::vector<gr::PortOut<T>> analog_out{};

using ChannelType = PS4000A_CHANNEL;
using ConditionType = PS4000A_CONDITION;
Expand Down
6 changes: 4 additions & 2 deletions blocklib/picoscope/Picoscope5000a.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ class Picoscope5000a : public fair::picoscope::Picoscope<T, acquisitionMode, Pic
public:
using super_t = fair::picoscope::Picoscope<T, acquisitionMode, Picoscope5000a<T, acquisitionMode>>;

Picoscope5000a(gr::property_map props) : super_t(std::move(props)) {}
Picoscope5000a(gr::property_map props) : super_t(std::move(props)) {
analog_out.resize(4);
}

std::array<gr::PortOut<T>, 4> analog_out;
std::vector<gr::PortOut<T>> analog_out{};

GR_MAKE_REFLECTABLE(Picoscope5000a, analog_out);

Expand Down
14 changes: 7 additions & 7 deletions blocklib/picoscope/test/qa_Picoscope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ testRapidBlockBasic(std::size_t nrCaptures) {

auto &sink = flowGraph.emplaceBlock<testing::TagSink<T, testing::ProcessFunction::USE_PROCESS_BULK>>({{{"log_samples", false }, {"log_tags", false}}});

expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out0">(ps).template to<"in">(sink)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out", 0>(ps).template to<"in">(sink)));

scheduler::Simple sched{ std::move(flowGraph) };
sched.runAndWait();
Expand Down Expand Up @@ -78,7 +78,7 @@ testStreamingBasics() {
auto &tagMonitor = flowGraph.emplaceBlock<testing::TagMonitor<T, testing::ProcessFunction::USE_PROCESS_BULK>>({{{"log_samples", false }}});
auto &sink = flowGraph.emplaceBlock<testing::TagSink<T, testing::ProcessFunction::USE_PROCESS_BULK>>({{{"log_samples", false }, {"log_tags", false}}});

expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out0">(ps).template to<"in">(tagMonitor)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out", 0>(ps).template to<"in">(tagMonitor)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"out">(tagMonitor).template to<"in">(sink)));

// Explicitly start unit because it takes quite some time
Expand Down Expand Up @@ -164,10 +164,10 @@ const boost::ut::suite PicoscopeTests = [] {
auto &sink2 = flowGraph.emplaceBlock<testing::TagSink<float, testing::ProcessFunction::USE_PROCESS_BULK>>({{{"log_samples", false }, {"log_tags", false}}});
auto &sink3 = flowGraph.emplaceBlock<testing::TagSink<float, testing::ProcessFunction::USE_PROCESS_BULK>>({{{"log_samples", false }, {"log_tags", false}}});

expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out0">(ps).to<"in">(sink0)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out1">(ps).to<"in">(sink1)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out2">(ps).to<"in">(sink2)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out3">(ps).to<"in">(sink3)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out", 0>(ps).to<"in">(sink0)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out", 1>(ps).to<"in">(sink1)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out", 2>(ps).to<"in">(sink2)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out", 3>(ps).to<"in">(sink3)));

scheduler::Simple sched{ std::move(flowGraph) };
sched.runAndWait();
Expand All @@ -191,7 +191,7 @@ const boost::ut::suite PicoscopeTests = [] {

auto &sink0 = flowGraph.emplaceBlock<testing::TagSink<float, testing::ProcessFunction::USE_PROCESS_BULK>>({{{"log_samples", false }, {"log_tags", false}}});

expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out0">(ps).to<"in">(sink0)));
expect(eq(ConnectionResult::SUCCESS, flowGraph.connect<"analog_out", 0>(ps).to<"in">(sink0)));

scheduler::Simple<scheduler::ExecutionPolicy::multiThreaded> sched{ std::move(flowGraph) };
expect(sched.changeStateTo(lifecycle::State::INITIALISED).has_value());
Expand Down

0 comments on commit f97ff4a

Please sign in to comment.