[chirp_devel] [PATCH] [ft4] Automatic duplex value selection not working. Fixes #7605
# HG changeset patch # User Bernhard Hailer ham73tux@gmail.com # Date 1582233249 28800 # Thu Feb 20 13:14:09 2020 -0800 # Node ID 8a707d754ab01f5b6d16ae1416d54dc79cca70bb # Parent 6633e053349f1371b43a81773a7aad1478a80920 [ft4] Automatic duplex value selection not working. Fixes #7605
This family of radios (like other brands and models) has a feature which automatically determines whether an offset is to be applied in positive or negative direction. When a user programmed the radio manually and didn't explicitly select positive or negative offset, then the radio saved the fact that it was automatically pre-selected, and not the actual selection. The driver was able to read that, but didn't know what to do with it.
Data from an FT-65R (for North America models) and a FT-4XE (for European models) was obtained, and a table built from it. Code to determine the correct value for "duplex" (0 for +, or 2 for -, instead of 5 for auto) has been added. Now, instead of saving "auto", the image will be saved with the correct selection for duplex (something Yaesu should have done in the first place).
Mentioned in #6677.
diff --git a/chirp/drivers/ft4.py b/chirp/drivers/ft4.py --- a/chirp/drivers/ft4.py +++ b/chirp/drivers/ft4.py @@ -469,10 +469,23 @@ # the values in these lists must also be in the canonical UI list # we can re-arrange the order, and we don't need to have all # the values, but we cannot add our own values here. -DUPLEX = ["+", "", "-", "", "off", "", "split"] # (0,2,4,5)= (+,-,0, auto) -# the radio implements duplex "auto" as 5. we map to "" It appears to be -# a convienience function in the radio that affects the offset, but I do not -# understand it. + +DUPLEX = ["+", "", "-", "", "off", "", "split"] # (0,2,4,5) = (+, -, 0, auto) +# The radio implements duplex "auto" as 5. We map to "". It is a convenience +# function in the radio that affects the offset, which sets the duplex value +# according to the frequency in use. Yaesu doesn't entirely adhere to the band +# plans; but worse, they save the value 'auto' instead of + or -. Why Yaesu +# is doing such a thing is beyond me. [AE6YN] +DUPLEX_AUTO_US = [ + [145100000, 145495000, 2], + [146000000, 146395000, 0], + [146600000, 146995000, 2], + [147000000, 147395000, 0], + [147600000, 147995000, 2]] +# (There are no automatic duplex values in IARU-2 70CM.) +DUPLEX_AUTO_EU = [ + [145600000, 145800000, 2], + [438200000, 439425000, 2]]
SKIPS = ["", "S"]
@@ -1047,6 +1060,17 @@ name += chr(y) return name.rstrip()
+ def get_duplex(freq): # auto duplex to real duplex + """ + Select the duplex direction if duplex == 'auto'. + 0 is +, 2 is -, and 4 is none. + """ + return_value = 4 # off, if not in auto range + for x in self.DUPLEX_AUTO: + if freq in range(x[0], x[1]): + return_value = x[2] + return return_value + mem = chirp_common.Memory() _mem, ndx, num, regtype, sname = self.slotloc(memref) mem.number = num @@ -1081,12 +1105,14 @@ 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" + if _mem.duplex == 5: # auto offset + mem.duplex = DUPLEX[get_duplex(mem.freq)] + else: + mem.duplex = DUPLEX[_mem.duplex] + if _mem.duplex == 6: # split: offset is tx frequency 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[2 - _mem.tx_pwr] mem.mode = ["FM", "NFM"][_mem.tx_width] @@ -1137,7 +1163,6 @@ self._memobj.names[ndx].chrs = bytearray(nametrim, "ascii") if mem.duplex == "split": txfreq = mem.offset / 10 - duplex = "off" # radio ignores when tx != rx self._memobj.txfreqs[num-1].freq = txfreq _mem.duplex = DUPLEX.index(duplex) if regtype in ["vfo", "home"]: @@ -1210,6 +1235,7 @@ MODEL = "FT-4XR" id_str = b'IFT-35R\x00\x00V100\x00\x00' valid_bands = VALID_BANDS_DUAL + DUPLEX_AUTO = DUPLEX_AUTO_US legal_steps = US_LEGAL_STEPS BAND_ASSIGNMENTS = BAND_ASSIGNMENTS_DUALBAND
@@ -1222,6 +1248,7 @@ MODEL = "FT-4XE" id_str = b'IFT-35R\x00\x00V100\x00\x00' valid_bands = VALID_BANDS_DUAL + DUPLEX_AUTO = DUPLEX_AUTO_EU legal_steps = STEP_CODE BAND_ASSIGNMENTS = BAND_ASSIGNMENTS_DUALBAND
@@ -1234,6 +1261,7 @@ MODEL = "FT-4VR" id_str = b'IFT-15R\x00\x00V100\x00\x00' valid_bands = VALID_BANDS_VHF + DUPLEX_AUTO = DUPLEX_AUTO_US legal_steps = US_LEGAL_STEPS BAND_ASSIGNMENTS = BAND_ASSIGNMENTS_MONO_VHF
@@ -1247,6 +1275,7 @@ # MODEL = "FT-4VE" # id_str = b'IFT-15R\x00\x00V100\x00\x00' # valid_bands = VALID_BANDS_VHF +# DUPLEX_AUTO = DUPLEX_AUTO_EU # legal_steps = STEP_CODE # BAND_ASSIGNMENTS = BAND_ASSIGNMENTS_MONO_VHF
@@ -1259,6 +1288,7 @@ MODEL = "FT-65R" id_str = b'IH-420\x00\x00\x00V100\x00\x00' valid_bands = VALID_BANDS_DUAL + DUPLEX_AUTO = DUPLEX_AUTO_US legal_steps = US_LEGAL_STEPS BAND_ASSIGNMENTS = BAND_ASSIGNMENTS_DUALBAND
@@ -1271,6 +1301,7 @@ MODEL = "FT-65E" id_str = b'IH-420\x00\x00\x00V100\x00\x00' valid_bands = VALID_BANDS_DUAL + DUPLEX_AUTO = DUPLEX_AUTO_EU legal_steps = STEP_CODE BAND_ASSIGNMENTS = BAND_ASSIGNMENTS_DUALBAND
@@ -1283,6 +1314,7 @@ MODEL = "FT-25R" id_str = b'IFT-25R\x00\x00V100\x00\x00' valid_bands = VALID_BANDS_VHF + DUPLEX_AUTO = DUPLEX_AUTO_US legal_steps = US_LEGAL_STEPS BAND_ASSIGNMENTS = BAND_ASSIGNMENTS_MONO_VHF
@@ -1296,5 +1328,6 @@ # MODEL = "FT-25E" # id_str = b'IFT-25R\x00\x00V100\x00\x00' # valid_bands = VALID_BANDS_VHF +# DUPLEX_AUTO = DUPLEX_AUTO_EU # legal_steps = STEP_CODE # BAND_ASSIGNMENTS = BAND_ASSIGNMENTS_MONO_VHF
participants (1)
-
Bernhard Hailer