[chirp_devel] [PATCH][UV-5R] Add VFO Frequency Presets to Work Mode Tab [#467]
Jim Unroe
Mon Jan 28 02:33:44 PST 2013
I'm don't believe I understand what "try with integers" means.
Here's the portion of code that I think the problem is in. More
specifically the 'def convert_freq_to_bytes(real_freq) part.
+ def convert_bytes_to_freq(bytes):
+ real_freq = 0
+ for byte in bytes:
+ real_freq = (real_freq * 10) + byte
+ return real_freq / 100000.0
+
+ def convert_freq_to_bytes(real_freq):
+ bytes = [ 0 for x in range(0,8) ] # init list with 8 times 0
+ real_freq = int(freq * 100000) # it has to be integer
+ for i in range(7, -1, -1): # go from 7 to 0
+ bytes[i] = real_freq%10 # extract last digit
+ real_freq /= 10 # throw away last digit
+ return bytes
+
So would integer mean, don't do the division and multiplication by 100000?
I've attached the original patch in case someone wants to take a look at it.
Jim
On Mon, Jan 28, 2013 at 4:16 AM, IZ3GME Marco <iz3gme.marco at gmail.com>wrote:
> Hi Jim
> I really dont like this solution, did you try with integers as Andrew
> suggested?
>
> 73 de IZ3GME Marco
>
> On 27/01/2013 16:58, Jim Unroe wrote:
> > All,
> >
> > I gave up on using the RadioSettingValueFloat(RadioSettingValue)
> > feature. So none of that code supplied by Dan has been included.
> >
> > Being able to enter a floating point frequency looked nice but even
> > after quite a bit of research, I wasn't able to overcome the floating
> > point to binary conversion error (setting a frequency of 146.940 always
> > resulted in 146.390 (actually 146.39999 but I have step set to 10.0KHz)).
> >
> > I think what I have provided here is very usable. I wish there was a way
> > to limit the 100's of MHz selections to 1, 4 & 5 and the 100's of Hz
> > settings to 0, 2, 5 and 7. At list I have them limited to their lowest
> > and highest settings.
> >
> > I'd be willing to revisit this, but for now I'd like to review my todo
> > list and see what additional things I can add to CHIRP for the UV-5R.
> >
> > Thanks for everyone's help. I learned a lot from everyone.
> >
> > Jim Unroe
> >
> >
> >
> > _______________________________________________
> > chirp_devel mailing list
> > chirp_devel at intrepid.danplanet.com
> > http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
> > Developer docs:
> http://chirp.danplanet.com/projects/chirp/wiki/Developers
> >
>
> _______________________________________________
> chirp_devel mailing list
> chirp_devel at intrepid.danplanet.com
> http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
> Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20130128/8254d462/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: workmode_vfo_test.patch
Type: application/octet-stream
Size: 12373 bytes
Desc: not available
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20130128/8254d462/attachment-0001.obj
More information about the chirp_devel
mailing list