[chirp_devel] Fwd: [PATCH 1 of 2] Driver Maintenance: tk760.py
An image to run tests against is attached.
Jim KC9HI
---------- Forwarded message --------- From: Jim Unroe kc9hi@comcast.net Date: Tue, Feb 23, 2021 at 9:37 PM Subject: [PATCH 1 of 2] Driver Maintenance: tk760.py To: Rock.Unroe@gmail.com
# HG changeset patch # User Jim Unroe rock.unroe@gmail.com # Date 1614133664 18000 # Tue Feb 23 21:27:44 2021 -0500 # Node ID 91985c182076023b6172634c2910fa050d119f0b # Parent b4a7f3f45f2894428173a7c9d3f3a345ce11246c Driver Maintenance: tk760.py
1. Add to PEP8 manifest 2. Perform PEP8 cleanup
in preperaton to address #8245
diff -r b4a7f3f45f28 -r 91985c182076 chirp/drivers/tk760.py --- a/chirp/drivers/tk760.py Tue Feb 23 20:05:24 2021 -0500 +++ b/chirp/drivers/tk760.py Tue Feb 23 21:27:44 2021 -0500 @@ -13,12 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
-import time -import struct -import logging - -LOG = logging.getLogger(__name__) - from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util from chirp.settings import RadioSettingGroup, RadioSetting, \ @@ -27,6 +21,12 @@ RadioSettings from textwrap import dedent
+import time +import struct +import logging + +LOG = logging.getLogger(__name__) + MEM_FORMAT = """ #seekto 0x0000; struct { @@ -92,7 +92,8 @@ 0x06: "Scan", 0x07: "Scan Del/Add", 0x08: "Home Channel", - 0x09: "Operator Selectable Tone" + 0x09: "Operator Selectable Tone", + 0x0C: "Unknown" }
MEM_SIZE = 0x400 @@ -108,7 +109,7 @@ MODES = ["NFM", "FM"] SKIP_VALUES = ["", "S"] TONES = chirp_common.TONES -#TONES.remove(254.1) +# TONES.remove(254.1) DTCS_CODES = chirp_common.DTCS_CODES
TOT = ["off"] + ["%s" % x for x in range(30, 330, 30)] @@ -120,7 +121,7 @@ data = "" try: data = radio.pipe.read(amount) - #print("<= %02i: %s" % (len(data), util.hexprint(data))) + # print("<= %02i: %s" % (len(data), util.hexprint(data))) except: raise errors.RadioError("Error reading data from radio")
@@ -131,7 +132,7 @@ """Raw send to the radio device""" try: radio.pipe.write(data) - #print("=> %02i: %s" % (len(data), util.hexprint(data))) + # print("=> %02i: %s" % (len(data), util.hexprint(data))) except: raise errors.RadioError("Error sending data from radio")
@@ -162,7 +163,7 @@ ack = rawrecv(radio, 1) # check ACK if ack != ACK_CMD: - #close_radio(radio) + # close_radio(radio) mesg = "Handshake failed: " + msg raise errors.RadioError(mesg)
@@ -229,7 +230,7 @@ ident = rawrecv(radio, 8)
# validate the input - if len(ident) != 8: + if len(ident) != 8: LOG.debug("Wrong ID, get only %s bytes, we expect 8" % len(ident)) LOG.debug(hexprint(ident)) msg = "Bad ID received, just %s bytes, we want 8" % len(ident) @@ -253,7 +254,7 @@ """This is your download function""" open_radio(radio)
- # UI progress + # UI progress status = chirp_common.Status() status.cur = 0 status.max = MEM_SIZE / BLOCK_SIZE @@ -280,7 +281,7 @@ """Upload info to radio""" open_radio(radio)
- # UI progress + # UI progress status = chirp_common.Status() status.cur = 0 status.max = MEM_SIZE / BLOCK_SIZE @@ -324,7 +325,7 @@ rid = get_rid(data)
# DEBUG - #print("Full ident string is %s" % util.hexprint(rid)) + # print("Full ident string is %s" % util.hexprint(rid))
if (rid in cls.VARIANTS): # correct model @@ -333,7 +334,8 @@ return False
-class Kenwood_M60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): +class Kenwood_M60_Radio(chirp_common.CloneModeRadio, + chirp_common.ExperimentalRadio): """Kenwood Mobile Family 60 Radios""" VENDOR = "Kenwood" _range = [136000000, 500000000] # don't mind, it will be overwritten @@ -346,7 +348,7 @@ rp = chirp_common.RadioPrompts() rp.experimental = \ ('This driver is experimental; not all features have been ' - 'implemented, but it has those features most used by hams.\n' + 'implemented, but it has those features most used by hams.\n' '\n' 'This radios are able to work slightly outside the OEM ' 'frequency limits. After testing, the limit in Chirp has ' @@ -736,28 +738,28 @@ basic.append(clone)
# front keys - mon = RadioSetting("settings.kMON", "MON", - RadioSettingValueList(KEYS.values(), - KEYS.values()[KEYS.keys().index( - int(sett.kMON))])) + rs = RadioSettingValueList(KEYS.values(), + KEYS.values()[KEYS.keys().index( + int(sett.kMON))]) + mon = RadioSetting("settings.kMON", "MON", rs) fkeys.append(mon)
- a = RadioSetting("settings.kA", "A", - RadioSettingValueList(KEYS.values(), - KEYS.values()[KEYS.keys().index( - int(sett.kA))])) + rs = RadioSettingValueList(KEYS.values(), + KEYS.values()[KEYS.keys().index( + int(sett.kA))]) + a = RadioSetting("settings.kA", "A", rs) fkeys.append(a)
- scn = RadioSetting("settings.kSCN", "SCN", - RadioSettingValueList(KEYS.values(), - KEYS.values()[KEYS.keys().index( - int(sett.kSCN))])) + rs = RadioSettingValueList(KEYS.values(), + KEYS.values()[KEYS.keys().index( + int(sett.kSCN))]) + scn = RadioSetting("settings.kSCN", "SCN", rs) fkeys.append(scn)
- da = RadioSetting("settings.kDA", "D/A", - RadioSettingValueList(KEYS.values(), - KEYS.values()[KEYS.keys().index( - int(sett.kDA))])) + rs = RadioSettingValueList(KEYS.values(), + KEYS.values()[KEYS.keys().index( + int(sett.kDA))]) + da = RadioSetting("settings.kDA", "D/A", rs) fkeys.append(da)
return top @@ -803,7 +805,7 @@
# Apply al configs done # DEBUG - #print("%s: %s" % (setting, value)) + # print("%s: %s" % (setting, value)) setattr(obj, setting, value)
diff -r b4a7f3f45f28 -r 91985c182076 tools/cpep8.manifest --- a/tools/cpep8.manifest Tue Feb 23 20:05:24 2021 -0500 +++ b/tools/cpep8.manifest Tue Feb 23 21:27:44 2021 -0500 @@ -92,6 +92,7 @@ ./chirp/drivers/th_uvf8d.py ./chirp/drivers/thd72.py ./chirp/drivers/thuv1f.py +./chirp/drivers/tk760.py ./chirp/drivers/tk8102.py ./chirp/drivers/tk8180.py ./chirp/drivers/tmd710.py
participants (1)
-
Jim Unroe