[chirp_devel] [PATCH 0 of 3] Kenwood TH-D72 live driver
The first patch implements a live driver for the Kenwood TH-D72. I found the existing TH-D72 clone driver was erroring during uploads and leaving garbage in the new memory channels. The live driver allows the TH-D72 to reject bad memory data, so corruption is significantly less likely. The live driver currently does not support cross-tones, but I plan to implement this within the next few weeks.
The next two patches are a charset and valid_skips fix for the TM-D710 driver, which also affect the TM-V71 and TH-D72.
Tom KD7LXL
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1331766827 21600 # Node ID 4a424067aa620bd2c1b288bdb8b20f6576cf6127 # Parent d2c57a9b04bae58dc3ff8094b040597148c80ca3 [thd72] Add live driver for Kenwood TH-D72 and disable broken clone driver.
diff -r d2c57a9b04ba -r 4a424067aa62 chirp/kenwood_live.py --- a/chirp/kenwood_live.py Tue Mar 20 19:36:57 2012 -0600 +++ b/chirp/kenwood_live.py Wed Mar 14 17:13:47 2012 -0600 @@ -612,6 +612,63 @@ return spec
@directory.register +class THD72Radio(TMD710Radio): + MODEL = "TH-D72" + HARDWARE_FLOW = True + + def _parse_mem_spec(self, spec): + mem = chirp_common.Memory() + + mem.number = int(spec[0]) + mem.freq = int(spec[1]) + mem.tuning_step = D710_STEPS[int(spec[2], 16)] + mem.duplex = D710_DUPLEX[int(spec[3])] + # Reverse + if int(spec[5]): + mem.tmode = "Tone" + elif int(spec[6]): + mem.tmode = "TSQL" + elif int(spec[7]): + mem.tmode = "DTCS" + mem.rtone = chirp_common.TONES[int(spec[9])] + mem.ctone = chirp_common.TONES[int(spec[10])] + mem.dtcs = chirp_common.DTCS_CODES[int(spec[11])] + mem.offset = int(spec[13]) + mem.mode = D710_MODES[int(spec[14])] + # TX Frequency + if int(spec[15]): + mem.duplex = "split" + mem.offset = int(spec[15]) + # Lockout + mem.skip = D710_SKIP[int(spec[17])] # Memory Lockout + + return mem + + def _make_mem_spec(self, mem): + print "Index %i for step %.2f" % (chirp_common.TUNING_STEPS.index(mem.tuning_step), mem.tuning_step) + spec = ( \ + "%010i" % mem.freq, + "%X" % D710_STEPS.index(mem.tuning_step), + "%i" % (0 if mem.duplex == "split" else D710_DUPLEX.index(mem.duplex)), + "0", # Reverse + "%i" % (mem.tmode == "Tone" and 1 or 0), + "%i" % (mem.tmode == "TSQL" and 1 or 0), + "%i" % (mem.tmode == "DTCS" and 1 or 0), + "0", + "%02i" % (chirp_common.TONES.index(mem.rtone)), + "%02i" % (chirp_common.TONES.index(mem.ctone)), + "%03i" % (chirp_common.DTCS_CODES.index(mem.dtcs)), + "0", + "%08i" % (0 if mem.duplex == "split" else mem.offset), # Offset + "%i" % D710_MODES.index(mem.mode), + "%010i" % (mem.offset if mem.duplex == "split" else 0), # TX Frequency + "0", # Unknown + "%i" % D710_SKIP.index(mem.skip), # Memory Lockout + ) + + return spec + +@directory.register class TMV71Radio(TMD710Radio): MODEL = "TM-V71"
diff -r d2c57a9b04ba -r 4a424067aa62 chirp/thd72.py --- a/chirp/thd72.py Tue Mar 20 19:36:57 2012 -0600 +++ b/chirp/thd72.py Wed Mar 14 17:13:47 2012 -0600 @@ -160,7 +160,9 @@ EXCH_W = "W\x00\x00\x00\x00"
-@directory.register +# Uploads result in "MCP Error" and garbage data in memory +# Clone driver disabled in favor of error-checking live driver. +#@directory.register class THD72Radio(chirp_common.CloneModeRadio): BAUD_RATE = 9600 VENDOR = "Kenwood"
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1332294775 21600 # Node ID c44a133c3fee07aea1440243b080cd52f6cada3e # Parent 4a424067aa620bd2c1b288bdb8b20f6576cf6127 [tmd710] Expand charset to all ASCII except , which isn't supported in the live driver.
diff -r 4a424067aa62 -r c44a133c3fee chirp/kenwood_live.py --- a/chirp/kenwood_live.py Wed Mar 14 17:13:47 2012 -0600 +++ b/chirp/kenwood_live.py Tue Mar 20 19:52:55 2012 -0600 @@ -544,7 +544,7 @@ rf.valid_modes = D710_MODES rf.valid_duplexes = D710_DUPLEX rf.valid_tuning_steps = D710_STEPS - rf.valid_characters = chirp_common.CHARSET_ALPHANUMERIC + rf.valid_characters = chirp_common.CHARSET_ASCII.replace(',','') rf.valid_name_length = 8 rf.memory_bounds = (0, 999) return rf
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1332294910 21600 # Node ID 4d4f6840175f6bd7aa0e7a81a676b912b0c63456 # Parent c44a133c3fee07aea1440243b080cd52f6cada3e [tmd710] Define valid_skips to avoid errors during imports.
diff -r c44a133c3fee -r 4d4f6840175f chirp/kenwood_live.py --- a/chirp/kenwood_live.py Tue Mar 20 19:52:55 2012 -0600 +++ b/chirp/kenwood_live.py Tue Mar 20 19:55:10 2012 -0600 @@ -546,6 +546,7 @@ rf.valid_tuning_steps = D710_STEPS rf.valid_characters = chirp_common.CHARSET_ASCII.replace(',','') rf.valid_name_length = 8 + rf.valid_skips = D710_SKIP rf.memory_bounds = (0, 999) return rf
The first patch implements a live driver for the Kenwood TH-D72. I found the existing TH-D72 clone driver was erroring during uploads and leaving garbage in the new memory channels. The live driver allows the TH-D72 to reject bad memory data, so corruption is significantly less likely. The live driver currently does not support cross-tones, but I plan to implement this within the next few weeks.
The next two patches are a charset and valid_skips fix for the TM-D710 driver, which also affect the TM-V71 and TH-D72.
Thanks, applied. I also put those into the stable branch since the first one should enable use of the D72, which was broken in 0.2.0 and the latter are clearly fixes.
When you get a chance, could you test the stable_0_2_x branch and make sure they work there properly? After you confirm, I'll snap and post 0.2.1.
Thanks!
participants (2)
-
Dan Smith
-
Tom Hayward