Hi again GNURADIOers,
I have a set member function which is also used as a callback from GRC.
It
looks like this:
void
test_file_sink::set_sensitivity(double milisecond)
{
d_n_samples = (unsigned
int)(milisecond*d_sample_rate/1000.0)*d_itemsize;
printf("\nd_n_samples: %d\n", d_n_samples);
init_old_data_buff();
}
When I run flowgraph, and change “sensitivity”, my callback function is
called twice.
Is this normal action?
Best
Was any nonsense in previous post?
Hi guys,
this is kind of very old thread, but the same problem. I started
changing
my blocks for 3.7.0 and callbacks are called twice. Is there any
explanation for this acting?
thanks,
Nemanja
Actually it is not a big deal at all, I am just curious.
Yes, I am using WXGui slider.
Thank you Tom
Nemanja
On Wed, Jul 24, 2013 at 5:17 PM, Nemanja S. [email protected]
wrote:
Actually it is not a big deal at all, I am just curious.
Yes, I am using WXGui slider.
Thank you Tom
Nemanja
Great. Just wanted to make sure it wasn’t doing something else to your
code.
Probably just something like it responding to the ‘button press’ and
‘button release’ events or just jitter when moving the slider. Those
are pretty common in GUI apps.
Tom
On Wed, Jul 24, 2013 at 8:51 AM, Nemanja S. [email protected]
wrote:
On Thu, Feb 28, 2013 at 9:53 AM, Nemanja S. [email protected] wrote:
called twice.
–
Nemanja Savi
–
Nemanja Savi
Nemanja,
It’s unclear what you are doing when changing the sensitivity? Is this
in GRC and using a GUI slider or something? Or are you triggering the
callback function some other way? If it’s a GUI element, it could just
be that the system calls it based on a change in the state, which
could mean when you press and release or when you hit a button is one
update and when the update to the slider happens it gets triggered
again.
Is this really a big deal or are you just curious?
Tom
On Fri, Jul 26, 2013 at 10:21 AM, Marcus L. [email protected]
wrote:
On some GUI slider widgets, there’s a “call callback only on motion
finished” option. I don’t know whether that’s available in WxGUI, and
whether we use it (and whether the option to use it should be exposed within
GRC).
Yeah. There are various ways to handle motion and actions in most GUI
tools. I’m with you, though: I’m not sure what’s really available in
WxGUI. But we probably want it to call the callback when the sliders
are changed (sometimes when tuning, it’s nice to be able to grab the
slider and move it back and forth to see what happens) and when the
action finishes to make sure it’s called with the most recent value.
Also, doesn’t the callback get called on first instantiation to set the
default value?
No, it doesn’t. We have to add a specific call to the function in the
section of the XML file to do this initialization. Sometimes,
we don’t have a default value set for the parameter in the callback,
so calling this by default upon instantiation is probably a bad idea.
Tom