# HG changeset patch # Parent 53cd045bbf8253d32b43a528b245caff243e4c02 [Yaesu FT-25] has been added to FT-4 driver.
Thanks to Dan Clemmensen for all his work to prepare for it! A test image is attached.
A few issues with the FT-4 driver were discovered while the work for the FT-25 was carried out; see #7601, #7603, #7605. Additional patches will be provided.
73 Bernhard AE6YN
Fixes: #7543
diff --git a/chirp/drivers/ft4.py b/chirp/drivers/ft4.py --- a/chirp/drivers/ft4.py +++ b/chirp/drivers/ft4.py @@ -2,6 +2,7 @@ # Derives loosely from two sources released under GPLv2: # ./template.py, Copyright 2012 Dan Smith dsmith@danplanet.com # ./ft60.py, Copyright 2011 Dan Smith dsmith@danplanet.com +# Edited 2020 Bernhard Hailer ham73tux@gmail.com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -261,7 +262,8 @@ msg = "Bad echo. Sent:" + util.hexprint(cmd) + ", " msg += "Received:" + util.hexprint(echo) LOG.debug(msg) - raise errors.RadioError("Incorrect echo on serial port. Bad cable?") + raise errors.RadioError( + "Incorrect echo on serial port. Radio off? Bad cable?") if response_len is None: return variable_len_resp(pipe) if response_len > 0: @@ -475,7 +477,7 @@ SKIPS = ["", "S"]
BASETYPE_FT4 = ["FT-4XR", "FT-4XE"] -BASETYPE_FT65 = ["FT-65R"] +BASETYPE_FT65 = ["FT-65R", "FT-25R"] POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=0.5), chirp_common.PowerLevel("Mid", watts=2.5), chirp_common.PowerLevel("High", watts=5.0)] @@ -569,6 +571,12 @@ BAND_ASSIGNMENTS = [2, 1, 0, 1, 2, 0, 1, 2] # bands for the vfos and homes FT65_PROGS = ("prog", ["P1", "P2", "P3", "P4"]) FT65_SPECIALS = list(SPECIALS) # a shallow copy works here +FT25_SPECIALS = [ + ("pms", PMSNAMES), + ("vfo", ["VFO A UHF", "VFO A VHF", "VFO B FM"]), + ("home", ["HOME FM", "HOME VHF"]), + ("prog", ["P1", "P2"]) + ] FT65_SPECIALS[-1] = FT65_PROGS # replace the last entry (P key names)
@@ -669,8 +677,6 @@ rf.has_dtcs_polarity = False # REV TN reverses the tone, not the dcs rf.has_cross = True rf.has_settings = True - rf.valid_tuning_steps = self.legal_steps - return rf
def get_bank_model(self): @@ -1027,31 +1033,50 @@ mem = chirp_common.Memory() _mem, ndx, num, regtype, sname = self.slotloc(memref) mem.number = num - mem.freq = int(_mem.freq) * 10 - mem.offset = int(_mem.offset) * self.freq_offset_scale - mem.duplex = DUPLEX[_mem.duplex]
- self.decode_sql(mem, _mem) - mem.power = POWER_LEVELS[_mem.tx_pwr] - mem.mode = ["FM", "NFM"][_mem.tx_width] - mem.tuning_step = STEP_CODE[_mem.step] - + """ + First, we need to know whether a channel is enabled, + then we can process any channel parameters. + It was found (at least on an FT-25) that channels might be + uninitialized and memory is just completely filled with 0xFF. + """ if regtype == "pms": mem.extd_number = sname + if regtype in ["memory", "pms"]: ndx = num - 1 mem.name = clean_name(self._memobj.names[ndx].chrs) mem.empty = not retrieve_bit(self._memobj.enable, ndx) mem.skip = SKIPS[retrieve_bit(self._memobj.scan, ndx)] - txfreq = int(self._memobj.txfreqs[ndx].freq) * 10 - if (txfreq != 0) and (txfreq != mem.freq): - mem.duplex = "split" - mem.offset = txfreq else: mem.empty = False mem.extd_number = sname mem.immutable = ["number", "extd_number", "name", "skip"]
+ """ + So, now if channel is not empty, we can do the evaluation of + all parameters. Otherwise we set them to defaults. + """ + if mem.empty: + mem.freq = 0 + mem.offset = 0 + mem.duplex = "off" + mem.power = POWER_LEVELS[2] # "High" + mem.mode = "FM" + mem.tuning_step = 0 + else: + mem.freq = int(_mem.freq) * 10 + txfreq = int(self._memobj.txfreqs[ndx].freq) * 10 + if (txfreq != 0) and (txfreq != mem.freq): + mem.duplex = "split" + mem.offset = txfreq + else: + mem.offset = int(_mem.offset) * self.freq_offset_scale + mem.duplex = DUPLEX[_mem.duplex] + self.decode_sql(mem, _mem) + mem.power = POWER_LEVELS[mem.tx_pwr] + mem.mode = ["FM", "NFM"][_mem.tx_width] + mem.tuning_step = STEP_CODE[_mem.step] return mem
def enforce_band(self, memloc, freq, mem_num, sname): @@ -1117,7 +1142,7 @@ # UHF, RX (400000000, 480000000) ] _valid_chars = chirp_common.CHARSET_ASCII - numblocks = 0x215 # number of 16-byte blocks in the radio + numblocks = 0x215 # number of 16-byte blocks in the radio _memsize = 16 * numblocks # used by CHIRP file loader to guess radio type MAX_MEM_SLOT = 200 Pkeys = 2 # number of programmable keys on the FT-4 @@ -1180,3 +1205,40 @@ "step", "tot", "tx pwr", "tx save", "vfo.spl", # 30-34 "vox", "wfm.rcv", "wide/nar", "wx alert", "scramble" # 35-39 ] + + +@directory.register +class YaesuFT25Radio(YaesuSC35GenericRadio): + MODEL = "FT-25R" + _basetype = BASETYPE_FT65 + valid_bands = [ + (65000000, 108000000), # broadcast FM, receive only + (144000000, 148000000), # VHF, US version, TX and RX + # VHF, RX (136000000, 174000000) + ] + _valid_chars = chirp_common.CHARSET_ASCII + numblocks = 0x215 # number of 16-byte blocks in the radio + _memsize = 16 * numblocks # used by CHIRP file loader to guess radio type + MAX_MEM_SLOT = 200 + Pkeys = 4 # number of programmable keys on the FT-65 + namelen = 8 # length of the mem name display on the FT-65 front panel + id_str = b'IFT-25R\x00\x00V100\x00\x00' + freq_offset_scale = 50000 + legal_steps = US_LEGAL_STEPS + # we need a deep copy here because we are adding deeper than the top level. + class_group_descs = copy.deepcopy(YaesuSC35GenericRadio.group_descriptions) + add_paramdesc( + class_group_descs, "misc", ("compander", "Compander", ["OFF", "ON"])) + class_specials = FT25_SPECIALS + # names for the setmode function for the programmable keys. Mode zero means + # that the key is programmed for a memory not a setmode. + SETMODES = [ + "mem", "apo", "arts", "battsave", "b-ch.l/o", # 00-04 + "beep", "bell", "compander", "ctcss", "cw id", # 05-09 + "dc volt", "dcs code", "dtmf set", "dtmf wrt", "edg bep", # 10-14 + "key lock", "lamp", "ledbsy", "mem del", "mon/t-cl", # 15-19 + "name tag", "pager", "password", "pri.rvt", "repeater", # 20-24 + "resume", "rf.sql", "scn.lamp", "skip", "sql type", # 25-29 + "step", "tot", "tx pwr", "tx save", "vfo.spl", # 30-34 + "vox", "wfm.rcv", "wide/nar", "wx alert", "scramble" # 35-39 + ]