No, the Head block tells the framework that it is 'Done' after the
specified number of items have been processed. The 'Done' state propagates
through the flowgraph, block threads exit, etc. The only way to get things
restarted is to rerun the flowgraph.

On Sun, Dec 13, 2020 at 7:21 AM Marcin Wachowiak <
[email protected]> wrote:

> Hello,
> 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})
> callbacks:
> - 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:
>
> templates:
> imports: from gnuradio import blocks
> make: blocks.head(${type.size}*${vlen}, ${num_items})
> callbacks:
> - 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:
> [image: image.png]
> Triggering the measurement code: the reset() does not make any effect
>
> def set_trigger_measurment(self, trigger_measurment):
> self.trigger_measurment = trigger_measurment
> self._trigger_measurment_callback(self.trigger_measurment)
>
> if trigger_measurment == True:
> self.blocks_head_0.reset()
> self.blocks_file_sink_0.open(testbench_setup_pymodule.get_meas_path(self.distance,
> self.rx_gain, self.src_att, self.physical_aoa))
>
> self.blocks_selector_1.set_output_index(self.trigger_measurment)
>
> Kind regards,
> Marcin Wachowiak
>
>
>
>
>
>

Reply via email to