[chirp_devel] [PATCH] [IP-620] DTCS Bug in KYD IP-620 Driver

Jim Unroe
Wed Mar 8 17:23:17 PST 2017


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1489022592 18000
# Node ID 1ca2298d96b82c6bec11b1a0cd3dea94d952f5ac
# Parent  baf4017eb2121f3c2b947b5a33132bc5c8d3b42a
[IP-620] DTCS Bug in KYD IP-620 Driver

This patch addresses the bug where the DTCS Tone value can't
but updated when Tone Mode is set to DTCS.

Related to #4585

diff -r baf4017eb212 -r 1ca2298d96b8 chirp/drivers/kyd_IP620.py
--- a/chirp/drivers/kyd_IP620.py	Wed Mar 08 20:11:03 2017 -0500
+++ b/chirp/drivers/kyd_IP620.py	Wed Mar 08 20:23:12 2017 -0500
@@ -436,33 +436,36 @@
                 val += 0x8000
             return val
 
-        if mem.tmode == "Cross":
+        rx_mode = tx_mode = None
+        rx_tone = tx_tone = 0xFFFF
+
+        if mem.tmode == "Tone":
+            tx_mode = "Tone"
+            rx_mode = None
+            tx_tone = int(mem.rtone * 10)
+        elif mem.tmode == "TSQL":
+            rx_mode = tx_mode = "Tone"
+            rx_tone = tx_tone = int(mem.ctone * 10)
+        elif mem.tmode == "DTCS":
+            tx_mode = rx_mode = "DTCS"
+            tx_tone = _set_dcs(mem.dtcs, mem.dtcs_polarity[0])
+            rx_tone = _set_dcs(mem.dtcs, mem.dtcs_polarity[1])
+        elif mem.tmode == "Cross":
             tx_mode, rx_mode = mem.cross_mode.split("->")
-        elif mem.tmode == "Tone":
-            tx_mode = mem.tmode
-            rx_mode = None
-        else:
-            tx_mode = rx_mode = mem.tmode
+            if tx_mode == "DTCS":
+                tx_tone = _set_dcs(mem.dtcs, mem.dtcs_polarity[0])
+            elif tx_mode == "Tone":
+                tx_tone = int(mem.rtone * 10)
+            if rx_mode == "DTCS":
+                rx_tone = _set_dcs(mem.rx_dtcs, mem.dtcs_polarity[1])
+            elif rx_mode == "Tone":
+                rx_tone = int(mem.ctone * 10)
 
-        if tx_mode == "DTCS":
-            _mem.tx_tone = mem.tmode != "DTCS" and \
-                _set_dcs(mem.dtcs, mem.dtcs_polarity[0]) or \
-                _set_dcs(mem.rx_dtcs, mem.dtcs_polarity[0])
-        elif tx_mode:
-            _mem.tx_tone = tx_mode == "Tone" and \
-                int(mem.rtone * 10) or int(mem.ctone * 10)
-        else:
-            _mem.tx_tone = 0xFFFF
+        _mem.rx_tone = rx_tone
+        _mem.tx_tone = tx_tone
 
-        if rx_mode == "DTCS":
-            _mem.rx_tone = _set_dcs(mem.rx_dtcs, mem.dtcs_polarity[1])
-        elif rx_mode:
-            _mem.rx_tone = int(mem.ctone * 10)
-        else:
-            _mem.rx_tone = 0xFFFF
-
-        LOG.debug("Set TX %s (%i) RX %s (%i)" % (tx_mode, _mem.tx_tone,
-                                              rx_mode, _mem.rx_tone))
+        LOG.debug("Set TX %s (%i) RX %s (%i)" %
+                  (tx_mode, _mem.tx_tone, rx_mode, _mem.rx_tone))
 
     def set_memory(self, mem):
         _mem = self._memobj.memory[mem.number - 1]



More information about the chirp_devel mailing list