# HG changeset patch # User Zach Welch zach@mandolincreekfarm.com # Fake Node ID 2976a057cf0af4155293d00a4d7f8f65fa217ebf
Fix style issues in tk8102.py (#2355)
diff --git a/chirp/drivers/tk8102.py b/chirp/drivers/tk8102.py index 4cf291e..50ea12b 100644 --- a/chirp/drivers/tk8102.py +++ b/chirp/drivers/tk8102.py @@ -58,19 +58,22 @@ MODES = ["NFM", "FM"] PTTID = ["", "BOT", "EOT", "Both"] SIGNAL = ["", "DTMF"]
+ def make_frame(cmd, addr, length, data=""): return struct.pack(">BHB", ord(cmd), addr, length) + data
+ def send(radio, frame): - #print "%04i P>R: %s" % (len(frame), util.hexprint(frame)) + # print "%04i P>R: %s" % (len(frame), util.hexprint(frame)) radio.pipe.write(frame)
+ def recv(radio, readdata=True): hdr = radio.pipe.read(4) cmd, addr, length = struct.unpack(">BHB", hdr) if readdata: data = radio.pipe.read(length) - #print " P<R: %s" % util.hexprint(hdr + data) + # print " P<R: %s" % util.hexprint(hdr + data) if len(data) != length: raise errors.RadioError("Radio sent %i bytes (expected %i)" % ( len(data), length)) @@ -79,6 +82,7 @@ def recv(radio, readdata=True): radio.pipe.write("\x06") return addr, data
+ def do_ident(radio): send(radio, "PROGRAM") ack = radio.pipe.read(1) @@ -93,6 +97,7 @@ def do_ident(radio): radio.pipe.write("\x06") ack = radio.pipe.read(1)
+ def do_download(radio): radio.pipe.setParity("E") radio.pipe.setTimeout(1) @@ -122,6 +127,7 @@ def do_download(radio): data) return memmap.MemoryMap(data)
+ def do_upload(radio): radio.pipe.setParity("E") radio.pipe.setTimeout(1) @@ -143,6 +149,7 @@ def do_upload(radio):
radio.pipe.write("\x45")
+ class KenwoodTKx102Radio(chirp_common.CloneModeRadio): """Kenwood TK-x102""" VENDOR = "Kenwood" @@ -320,8 +327,9 @@ class KenwoodTKx102Radio(chirp_common.CloneModeRadio): else: _mem.rx_tone = 0xFFFF
- LOG.debug("Set TX %s (%i) RX %s (%i)" % (tx_mode, _mem.tx_tone, - rx_mode, _mem.rx_tone)) + LOG.debug("Set TX %s (%i) RX %s (%i)" % + (tx_mode, _mem.tx_tone, rx_mode, _mem.rx_tone)) + def set_memory(self, mem): _mem = self._memobj.memory[mem.number - 1]
@@ -341,7 +349,6 @@ class KenwoodTKx102Radio(chirp_common.CloneModeRadio):
self._set_tone(mem, _mem)
- _mem.highpower = mem.power == POWER_LEVELS[1] _mem.wide = mem.mode == "FM" _mem.scan = mem.skip != "S" @@ -416,21 +423,23 @@ class KenwoodTK7102Radio(KenwoodTKx102Radio): _range = (136000000, 174000000) _upper = 4
+ @directory.register class KenwoodTK8102Radio(KenwoodTKx102Radio): MODEL = "TK-8102" _range = (400000000, 500000000) _upper = 4
+ @directory.register class KenwoodTK7108Radio(KenwoodTKx102Radio): MODEL = "TK-7108" _range = (136000000, 174000000) _upper = 8
+ @directory.register class KenwoodTK8108Radio(KenwoodTKx102Radio): MODEL = "TK-8108" _range = (400000000, 500000000) _upper = 8 - diff --git a/tools/cpep8.blacklist b/tools/cpep8.blacklist index 3b7a604..16d6347 100644 --- a/tools/cpep8.blacklist +++ b/tools/cpep8.blacklist @@ -31,7 +31,6 @@ ./chirp/drivers/th_uvf8d.py ./chirp/drivers/thd72.py ./chirp/drivers/thuv1f.py -./chirp/drivers/tk8102.py ./chirp/drivers/tmv71.py ./chirp/drivers/tmv71_ll.py ./chirp/drivers/vx170.py