[chirp_devel] [Yaesu FT-25] has been added to FT-4 driver.
# 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 + ]
@@ -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
Here, you stop setting valid_tuning_steps, and thus stop looking at self.legal_steps. See below.
"""
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.
"""
This is a docstring in python, and doesn't belong here despite being allowed. If you want to insert a comment, please use the comment prefix (#).
"""
So, now if channel is not empty, we can do the evaluation of
all parameters. Otherwise we set them to defaults.
"""
Same here.
@@ -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
This is non-functional noise in the patch, which we should try to avoid to keep the history clean.
+@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
Looks like you still expect legal_steps to be used, but you removed the reference above.
I was going to apply this despite the docstring thing because you have patches above and just ask you to fix the comments later. However, I'm not sure about the legal_steps thing, so let me know if I'm missing something and we can go from there.
Thanks!
--Dan
Thanks Dan,
I missed the legal_steps bug, indeed. Also found another issue with addressing VFO memories, which needs fixing. While working on the fixes, I'll convert the doc strings to comments.
Please hold the patches until I got this straight - I might actually go an entirely different way and prepare for more radios, making the implementation of new radios in this driver easier.
(Still have a problem with the test script not including added radios such as the FT-25. But that's another thing I need to figure out.)
73, Bernhard
On 28-Jan-20 09:57, Dan Smith via chirp_devel wrote:
@@ -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
Here, you stop setting valid_tuning_steps, and thus stop looking at self.legal_steps. See below.
"""
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.
"""
This is a docstring in python, and doesn't belong here despite being allowed. If you want to insert a comment, please use the comment prefix (#).
"""
So, now if channel is not empty, we can do the evaluation of
all parameters. Otherwise we set them to defaults.
"""
Same here.
@@ -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
This is non-functional noise in the patch, which we should try to avoid to keep the history clean.
+@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
Looks like you still expect legal_steps to be used, but you removed the reference above.
I was going to apply this despite the docstring thing because you have patches above and just ask you to fix the comments later. However, I'm not sure about the legal_steps thing, so let me know if I'm missing something and we can go from there.
Thanks!
--Dan _______________________________________________ chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
Hi Dan,
On 28-Jan-20 09:57, Dan Smith via chirp_devel wrote:
@@ -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
Here, you stop setting valid_tuning_steps, and thus stop looking at self.legal_steps. See below.
Turns out, this isn't a bug. I just had removed a duplicate line (see a few lines up in ft4.py, not visible in patch).
But it's good that the patch wasn't applied: it gives me the opportunity to attack this from a different angle. There are a total of four new radios I'd like to add (FT-25R, FT-4VR, FT-65E, FT-4XE), and that's much easier after a patch with some restructuring has been applied. I will send this patch first and see what your verdict is (I appreciate your checking!), before sending patches which apply a series of fixes for issues and add the four radios.
73, Bernhard
On 1/28/20 3:56 PM, Bernhard Hailer wrote:
Thanks Dan,
I missed the legal_steps bug, indeed. Also found another issue with addressing VFO memories, which needs fixing. While working on the fixes, I'll convert the doc strings to comments.
Please hold the patches until I got this straight - I might actually go an entirely different way and prepare for more radios, making the implementation of new radios in this driver easier.
(Still have a problem with the test script not including added radios such as the FT-25. But that's another thing I need to figure out.)
73, Bernhard
On 28-Jan-20 09:57, Dan Smith via chirp_devel wrote:
@@ -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
Here, you stop setting valid_tuning_steps, and thus stop looking at self.legal_steps. See below.
"""
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.
"""
This is a docstring in python, and doesn't belong here despite being allowed. If you want to insert a comment, please use the comment prefix (#).
"""
So, now if channel is not empty, we can do the evaluation of
all parameters. Otherwise we set them to defaults.
"""
Same here.
@@ -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
This is non-functional noise in the patch, which we should try to avoid to keep the history clean.
+@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
Looks like you still expect legal_steps to be used, but you removed the reference above.
I was going to apply this despite the docstring thing because you have patches above and just ask you to fix the comments later. However, I'm not sure about the legal_steps thing, so let me know if I'm missing something and we can go from there.
Thanks!
--Dan _______________________________________________ chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel Developer docs:http://chirp.danplanet.com/projects/chirp/wiki/Developers
participants (2)
-
Bernhard Hailer
-
Dan Smith