Saturday, July 1, 2017

Re: [Discuss-gnuradio] Change value of a Variable defined in the flowgraph from a block

Hi Cristian,

So, that's an architectural problem:

These variables are really just that: Python variables in the generated python program. Setting things when that variable changes works, because if your block defined a <callback> element in the GRC XML, then that method will be called whenever you change the Qt Range's value manually. This only works because the Qt Range is not actually a block or so, it's just Python code that gets inserted into the generated Python.

We do not consider that to be "clean design", because it's damn near impossible to do the same from within a block (especially if that block lives in C++ land).

What would be much easier is to give all the blocks that you need to change at runtime a message port input and handlers for messages, and then connect them to a "controller" block centrally.

Best regards,

Marcus


On 01.07.2017 06:39, Cristian Rodríguez wrote:
Hi everyone.

I created a variable in the flowgraph called freq_Tx.



This is assigned as the central freq of the block USRP source and is used by several blocks to do signal processing.

I need to listen two different frequencies in my application. For example one minute, 2.4 GHz and other minute 2.5GHz, depending of a specific logic. How can I, from a block, modify this variable? I mean, something like

set_freq_Tx(new value)

In this moment i'm doing it through a QT GUI RANGE,  but i need to set it automatically, then I think it must be a variable in the flowgraph, but I don't know if it can be modified from a block in the flowgraph.

Do you think is it possible?

If yes, may anyone please shares me a reference page or an example.

If not, my other option is to create the variable in my block, send it as an input to the blocks which use it, and to the USRP as a command. But it looks longer in time.

Thanks in advance.

Best regards,

Cristian


_______________________________________________  Discuss-gnuradio mailing list  Discuss-gnuradio@gnu.org  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio  

No comments:

Post a Comment