[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Resetting Head block via callback

From: Marcin Wachowiak
Subject: Resetting Head block via callback
Date: Sun, 13 Dec 2020 13:15:52 +0100

I would like to ask if there is any possibility to reset Head block after it has signaled Done - after collecting a number of samples. A simple callback would be most preferred but only:  set_length is defined:

make: blocks.head(${type.size}*${vlen}, ${num_items})
- set_length(${num_items})
While there is a reset method defined in head_impl.h
void reset() { d_ncopied_items = 0; }
void set_length(uint64_t nitems) { d_nitems = nitems; }

I am unable to call it via call in flowgraph.py generated file due to lack of registered callback. (I already tried setting length to 0 and then back again, but it didn't reset the block). Should I simply register the callback like:

imports: from gnuradio import blocks
make: blocks.head(${type.size}*${vlen}, ${num_items})
- set_length(${num_items})
- reset()

and then rebuild gr-blocks? (and later commit it to GNU Radio github) Or is there a better solution?

What I am trying to achieve is triggering a measurement of N samples and saving it to a generated filename via QT GUI checkbox using a Selector and Head sink.
The renaming and file generation is already solved via callbacks, but after a single measurement trigger it only generates empty files - no data is fed into them.
Flowgraph img:
Triggering the measurement code: the reset() does not make any effect

def set_trigger_measurment(self, trigger_measurment):
self.trigger_measurment = trigger_measurment

if trigger_measurment == True:
self.blocks_file_sink_0.open(testbench_setup_pymodule.get_meas_path(self.distance, self.rx_gain, self.src_att, self.physical_aoa))


Kind regards,
Marcin Wachowiak

reply via email to

[Prev in Thread] Current Thread [Next in Thread]