[idrp] Fix idrp driver and rpttool for intHz

This commit is contained in:
Dan Smith 2011-05-26 07:47:10 -07:00
parent 630a9d800f
commit ed2ae300fe
3 changed files with 11 additions and 12 deletions

View file

@ -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

16
rpttool
View file

@ -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()

View file

@ -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"])],