It's a rounding problem due to the internal representation of float.
I tried the following version of convert_freq_to_bytes which seems to works but may be Dan or some other python expert have a better solution.
def convert_freq_to_bytes(freq): bytes = [ 0 for x in range(0,8) ] # init list with 8 times 0 real_freq = "%3.5f" % freq # now is a string real_freq = int(real_freq[0:3]+ real_freq[4:]) # and now an int 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
73 de IZ3GME Marco
On 25/01/2013 05:04, Jim Unroe wrote:
On Tue, Jan 22, 2013 at 8:12 PM, Jim Unroe <rock.unroe@gmail.com mailto:rock.unroe@gmail.com> wrote:
Marco, Wow! After a long day at work I finally got a chance to apply your patch and it works perfectly! Thank you very much.
Marco, After doing some additional testing today, I discovered a problem and I can't figure out what might be causing it or how to fix it.
Here's the problem.... If I enter the VFO frequency of 146.52000, it saves to an image file and uploads to the UV-5R just fine. If I enter the VFO frequency of 146.64000, it saves to an image file and uploads to the UV-5R as 146.63999
I also noticed that if I enter 146.640 into the UV-5R VFO using the keypad, download to CHIRP and then upload back to the UV-5R, the frequency is correct.
Any thoughts as to what may be causing this and how I might fix it? I have attached a single patch file that includes my 3 test patches plus your cleanup patch.
Thanks, Jim
chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers