[chirp_devel] VFO Frequency Presets
Dan Smith
Sat Jan 19 15:08:22 PST 2013
> + real_freq = 0
> + for byte in self._memobj.vfoa.freq:
> + real_freq = (real_freq * 10) + byte
> + real_freq /= 100000
I think if you change this to the following it will do what you want:
real_freq /= 1000.0
You need at least one side to be a float to get a float in return. Then
I think that this will work:
> + val1a = RadioSettingValueFloat(136, 512, real_freq)
> + val1a.set_callback(my_validate)
> + rs = RadioSetting("footest", "VFO A Frequency", val1a)
> + workmode.append(rs)
Since you have to do this twice, I'd like you to make it a helper
function, like this:
def convert_bytes_to_freq(bytes):
real_freq = 0
for byte in self._memobj.vfob.freq:
real_freq = (real_freq * 10) + byte
return real_freq / 1000.0
Then you can do this:
val1b = RadioSettingValueFloat(136, 512,
convert_bytes_to_freq(self._memobj.vfoa.freq))
On the set side, you'll need to do the opposite of the above,
potentially with a special-case for those two values (I forget how that
code is organized). I imagine getting the "get" side working first is
your priority, so we can work on that after you're happy with this.
--
Dan Smith
www.danplanet.com
KK7DS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20130119/60239b37/attachment-0001.bin
More information about the chirp_devel
mailing list