mirror of
https://github.com/kk7ds/chirp.git
synced 2024-09-21 10:37:15 +00:00
Driver Maintenance: tk760.py
1. Add to PEP8 manifest 2. Perform PEP8 cleanup in preperaton to address #8245
This commit is contained in:
parent
fe125ed6e9
commit
1eb4dccab5
@ -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 @@ from chirp.settings import RadioSettingGroup, RadioSetting, \
|
||||
RadioSettings
|
||||
from textwrap import dedent
|
||||
|
||||
import time
|
||||
import struct
|
||||
import logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
MEM_FORMAT = """
|
||||
#seekto 0x0000;
|
||||
struct {
|
||||
@ -92,7 +92,8 @@ KEYS = {
|
||||
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 @@ POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1),
|
||||
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 @@ def rawrecv(radio, amount):
|
||||
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 @@ def rawsend(radio, data):
|
||||
"""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 @@ def handshake(radio, msg="", full=False):
|
||||
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 @@ def open_radio(radio):
|
||||
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 @@ def do_download(radio):
|
||||
"""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 @@ def do_upload(radio):
|
||||
"""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 @@ def model_match(cls, data):
|
||||
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 @@ def model_match(cls, data):
|
||||
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 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa
|
||||
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 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa
|
||||
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 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa
|
||||
|
||||
# Apply al configs done
|
||||
# DEBUG
|
||||
#print("%s: %s" % (setting, value))
|
||||
# print("%s: %s" % (setting, value))
|
||||
setattr(obj, setting, value)
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user