From ed2ae300fe4e91ea3c96001c74781fca3754b28a Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 26 May 2011 07:47:10 -0700 Subject: [PATCH] [idrp] Fix idrp driver and rpttool for intHz --- chirp/idrp.py | 5 +---- rpttool | 16 +++++++++------- setup.py | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/chirp/idrp.py b/chirp/idrp.py index 8f5e2566..5870d007 100644 --- a/chirp/idrp.py +++ b/chirp/idrp.py @@ -66,9 +66,7 @@ def drain(pipe): break def set_freq(pipe, freq): - freq *= 1000000 - - freqbcd = util.bcd_encode(int(freq), bigendian=False, width=9) + freqbcd = util.bcd_encode(freq, bigendian=False, width=9) buf = "\x01\x7f\x05" + freqbcd drain(pipe) @@ -97,7 +95,6 @@ def get_freq(pipe): ord(els[2]), ord(els[1]), ord(els[0]))) - freq = freq / 1000000.0 if DEBUG_IDRP: print "Freq: %f" % freq return freq diff --git a/rpttool b/rpttool index b5948d4b..786ba59c 100755 --- a/rpttool +++ b/rpttool @@ -20,7 +20,7 @@ import sys import serial import commands -from chirp import idrp +from chirp import idrp, chirp_common def open_device(): try: @@ -57,7 +57,7 @@ def _set_freq(rp): print "Unable to read memory from device: %s" % e return False - print "\nNew frequency [%.5f]: " % mem.freq, + print "\nNew frequency [%s]: " % chirp_common.format_freq(mem.freq), input = sys.stdin.readline().strip() if not input: @@ -65,7 +65,7 @@ def _set_freq(rp): return False try: - mem.freq = float(input) + mem.freq = chirp_common.parse_freq(input) except Exception: print "Invalid entry `%s'" % input return False @@ -73,10 +73,12 @@ def _set_freq(rp): try: rp.set_memory(mem) except Exception, e: - print "Failed to set frequency to %.5f: %s" % (mem.freq, e) + print "Failed to set frequency to %s: %s" % \ + (chirp_common.format_freq(mem.freq), e) return False - print "Successfully set frequency to %.5f" % mem.freq + print "Successfully set frequency to %s" % \ + chirp_common.format_freq(mem.freq) return True def set_freq(): @@ -105,13 +107,13 @@ def main_menu(): while cmd != "3": print """ KK7DS ID-RP* Frequency Tool -Current Setting: %.5f +Current Setting: %s -------------------------------- 1. Set repeater frequency 2. Re-read current frequency 3. Quit -------------------------------- -> """ % freq, +> """ % chirp_common.format_freq(freq), cmd = sys.stdin.readline().strip() diff --git a/setup.py b/setup.py index 17b4613a..da7d70e4 100644 --- a/setup.py +++ b/setup.py @@ -97,7 +97,7 @@ def rpttool_build(): setup(name="rpttool", packages=["chirp"], - version="0.2", + version="0.3", scripts=["rpttool"], description="A frequency tool for ICOM D-STAR Repeaters", data_files=[('/usr/sbin', ["tools/icomsio.sh"])],