discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Rounding values in QT Number


From: John Ackermann N8UR
Subject: Re: [Discuss-gnuradio] Rounding values in QT Number
Date: Tue, 6 Mar 2018 10:41:48 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

I must now reflect and ponder to wisely choose my path.  All options suck.

I'd actually like most to go back to the build-gnuradio script but I haven't been able to verify that the issue I had last summer was addressed -- I don't know what broke or where, but with changes to librtlsdr around the time "bias_t" support was added, I had all sorts of issues getting dongles to work properly, with segfaults and apparent memory allocation errors.

Going back to the Ubuntu builds (actually, Linux Mint) solved that. I posted some messages both here and to the osmosdr list at the time reporting the issue, but never got any indication that it was addressed.

So I am reluctant to go that way unless I'm sure that whatever happened has been corrected. I suppose I really should set up another machine and test build-gnuradio on it.

John
----

On 03/06/2018 10:01 AM, Müller, Marcus (CEL) wrote:
Indeed, I was misjudging the syntax of QString.arg(double, int);
the second thing is just a minimal width to be filled up with spaces.
The optional precision argument is never specified, so Qt just does
whatever the hell it feels like. Splendid functionality.

Regarding moving things out-of-tree: In fact, that's possible, but I'd
argue that as interwoven as it is, gr-qtgui is the worst candidate for
that. The most likely-to-work solution would be getting the Ubuntu
package sources, fixing the things you need fixed, and rebuilding the
Ubuntu package, to be completely honest :(

Or, you can build GNU Radio from source, and we fix that bug upstream
ASAP; that'd require you to

"sudo apt-get remove gnuradio && sudo apt-get build-dep gnuradio",
"git clone https://github.com/gnuradio/gnuradio";,
"cd gnuradio; mkdir build; cd build; cmake .." and finally
"make -j8; make install"

as well as to recompile anything that uses GNU Radio, and never to
install Ubuntu's GNU Radio again, lest you want to end up in conflict
hell.

Best regards,
Marcus

On Tue, 2018-03-06 at 09:07 -0500, John Ackermann N8UR wrote:
Thanks, Marcus!

First, there's something goofy because I am getting 6 decimal places,
not 4.  See the attached screen shot.

Second, unfortunately at the moment I'm using the Ubuntu packages.  I
used to always use the build-gnuradio script, but last summer I started
having problems with librtlsdr when I did that, so I reverted to the
packaged version because it still worked.  So I'm not set up to build
gnuradio from sources without going back to ground zero. (Though I
suppose I could do the whole deb-source thing.  *Shudder*)

Is there a reasonable process to take an existing GRC block and convert
it to an OOT module?  I'd be happy to do that but don't know how to go
about it.

Thanks,
John
----

On 03/06/2018 08:47 AM, Müller, Marcus (CEL) wrote:
Hi John,

there's no dumb questions, maybe badly researched ones, and you
definitely don't have the habit of posting the latter, so: Good
question!

It all boils down to this line in gnuradio/gr-
qtgui/lib/numberdisplayform.cc:

        d_text_box[i]->setText(QString("%1 %2").arg(f, 4, ' ').\
                               arg(QString(d_unit[i].c_str())));

in which the current value `f` is displayed with four digits after the
decimal dot.

I'd agree this is probably not what's desirable in any application.

Now, this can be changed; for example, we could add a way to set the
number of digits variably instead of to 4. However, that'll be a source
code and API change, so it'll require recompilation of GNU Radio and
relinking of everything that use gr-qtgui. Does that help you?

Best regards,
Marcus

On Mon, 2018-03-05 at 16:36 -0500, John Ackermann N8UR wrote:
I hate to put such a dumb question to the list, but I'm going nuts
trying to do something that ought to be simple.

I am using a QT Number Sink to display dB values in float format.  It is
showing many more decimal places than have any meaning.  I'd like to
round the display to one or two decimal places.

I tried making an embedded python block to do the rounding and finally
succeeded (it was a long and painful process, and frankly I don't
understand why I had to do what I did to get it to work), but the number
sink is still printing all the extra decimal places, they're just now
set to zero.

Is there any trick to round or even just truncate the number of decimal
places shown in the QT Number Sink?

Thanks,
John

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



reply via email to

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