# HG changeset patch # Parent 2d1d2bf03a4ae6f39b8dd2cb1fa83289ebaeadf1 [Yaesu FT-4, FT-65, FT-25] Automatic duplex value selection not working
When a user was programming radio manually and didn't explicitely select positive or negative offset, then the radio's automatic preselection was 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 or 2, not 5 for auto) was 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.
73 Bernhard AE6YN
Fixes: #7605
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"]
@@ -1030,6 +1031,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 @@ -1072,7 +1087,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[mem.tx_pwr] mem.mode = ["FM", "NFM"][_mem.tx_width]