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 09:07:55 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

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

Attachment: Screenshot from 2018-03-06 08-58-11.png
Description: PNG image


reply via email to

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