[chirp_devel] [PATCH 3 of 8] [ft4] Automatic duplex value selection not working. Fixes #7605
Bernhard Hailer
Wed Feb 5 22:26:13 PST 2020
# HG changeset patch
# User Bernhard Hailer <ham73tux at gmail.com>
# Date 1580962623 28800
# Wed Feb 05 20:17:03 2020 -0800
# Node ID 9fdd2b612c6e82eb01e9a776130486273ca09ea1
# Parent 5bb4c48c5231a760c0bc62b01274901fb0804333
[ft4] Automatic duplex value selection not working. Fixes #7605
When user programs radio manually and doesn't explicitly select positive or negative offset, then the radio's automatic pre-selection is being saved to the radio's memory. The driver was able to read that, but didn't know what to do with it. Some code to determine the correct value for "duplex" (0 for +, or 2 for -, not 5 for auto) has now been added. This will work for 2m only; for 70cm, the rules in the band plans (at least the ones offered by ARRL) are not specific enough. (The FT-4 / FT-65 might still use auto on 70cm; if observed, please contact me.). 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
@@ -470,9 +470,10 @@
# 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.
+# 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. Ham band plans
+# prescribe + or - depending on the location in the spectrum.
SKIPS = ["", "S"]
@@ -1069,6 +1070,20 @@
name += chr(y)
return name.rstrip()
+ def get_duplex(freq): # auto duplex to real duplex
+ return_value = 4 # off
+ # 2M frequencies (according to ARRL)
+ if freq in range(145200000, 145500000):
+ return_value = 2 # negative
+ if freq in range(146610000, 146970000):
+ return_value = 2 # negative
+ if freq in range(147600000, 147990000):
+ return_value = 0 # positive
+ # ARRL band plan for 70cm does define repeater
+ # frequency ranges, but it allows local entities
+ # to make them input or output channels.
+ return return_value
+
mem = chirp_common.Memory()
_mem, ndx, num, regtype, sname = self.slotloc(memref)
mem.number = num
@@ -1108,7 +1123,10 @@
mem.offset = txfreq
else:
mem.offset = int(_mem.offset) * self.freq_offset_scale
- mem.duplex = DUPLEX[_mem.duplex]
+ if _mem.duplex == 5: # auto offset
+ mem.duplex = DUPLEX[get_duplex(mem.freq)]
+ else:
+ 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]
More information about the chirp_devel
mailing list