[chirp_devel] VFO Frequency Presets
Marco IZ3GME
Sun Jan 20 01:32:17 PST 2013
On 20/01/2013 01:32, Jim Unroe wrote:
>
>
> 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
>
>
> I think I have it working for the 'get' side. I have a problem with the
> 'helper function' code. As it is written above, it is specific to 'vfob'
> (self._memobj.vfob.freq). Is there a simple way to make it for this one
> block of code work for both VFOs? Also, where is the best place to put
> this 'helper function'? I currently have it just above my code for the
> menu selection.
>
> Jim
>
It's a typo for sure :)
here's the function Dan had in mind ;)
def convert_bytes_to_freq(bytes):
real_freq = 0
for byte in bytes:
real_freq = (real_freq * 10) + byte
return real_freq / 1000.0
I think "just above the code that needs it" is a good place for it.
73 de IZ3GME Marco
More information about the chirp_devel
mailing list