[chirp_devel] [PATCH] [VV-898] Add Support for TX Inhibited Memories #2123

Jim Unroe
Tue Dec 23 19:51:30 PST 2014


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1419392883 18000
# Node ID df4bf0b791cf682ad22a8549a442adac81b287e5
# Parent  6fa4741ec27b377cde2d5a916325d15ec11a6198
[VV-898] Add Support for TX Inhibited Memories #2123

Update Duplex to allow the "off" setting.

Enabled programming of "odd split" memories.

diff -r 6fa4741ec27b -r df4bf0b791cf chirp/leixen.py
--- a/chirp/leixen.py	Tue Dec 23 21:39:24 2014 -0500
+++ b/chirp/leixen.py	Tue Dec 23 22:48:03 2014 -0500
@@ -189,6 +189,7 @@
         rf.has_cross = True
         rf.has_bank = False
         rf.has_tuning_step = False
+        rf.can_odd_split = True
         rf.has_rx_dtcs = True
         rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross']
         rf.valid_modes = MODES
@@ -203,6 +204,7 @@
         rf.valid_characters = chirp_common.CHARSET_ASCII
         rf.valid_name_length = 7
         rf.valid_power_levels = POWER_LEVELS
+        rf.valid_duplexes = ["", "-", "+", "split", "off"]
         rf.valid_skips = ["", "S"]
         rf.valid_bands = [(136000000, 174000000),
                           (400000000, 470000000)]
@@ -255,6 +257,12 @@
         chirp_common.split_tone_decode(mem, (tx_tmode, tx_tone, tx_pol),
                                             (rx_tmode, rx_tone, rx_pol))
 
+    def _is_txinh(self, _mem):
+        raw_tx = ""
+        for i in range(0, 4):
+            raw_tx += _mem.tx_freq[i].get_raw()
+        return raw_tx == "\xFF\xFF\xFF\xFF"
+
     def get_memory(self, number):
         _mem = self._memobj.memory[number - 1]
         _name = self._memobj.name[number - 1]
@@ -267,15 +275,19 @@
             return mem
 
         mem.freq = int(_mem.rx_freq) * 10
-        offset = (int(_mem.tx_freq) * 10) - mem.freq
-        if offset < 0:
-            mem.offset = abs(offset)
-            mem.duplex = "-"
-        elif offset > 0:
-            mem.offset = offset
-            mem.duplex = "+"
+
+        if self._is_txinh(_mem):
+            mem.duplex = "off"
+            mem.offset = 0
+        elif int(_mem.rx_freq) == int(_mem.tx_freq):
+            mem.duplex = ""
+            mem.offset = 0
+        elif abs(int(_mem.rx_freq) * 10 - int(_mem.tx_freq) * 10) > 70000000:
+            mem.duplex = "split"
+            mem.offset = int(_mem.tx_freq) * 10
         else:
-            mem.offset = 0
+            mem.duplex = int(_mem.rx_freq) > int(_mem.tx_freq) and "-" or "+"
+            mem.offset = abs(int(_mem.rx_freq) - int(_mem.tx_freq)) * 10
 
         mem.name = str(_name.name).rstrip()
 
@@ -314,7 +326,13 @@
             _mem.set_raw("\xFF" * 8 + "\xFF\x00\xFF\x00\xFF\xFE\xF0\xFC")
 
         _mem.rx_freq = mem.freq / 10
-        if mem.duplex == "+":
+
+        if mem.duplex == "off":
+            for i in range(0, 4):
+                _mem.tx_freq[i].set_raw("\xFF")
+        elif mem.duplex == "split":
+            _mem.tx_freq = mem.offset / 10
+        elif mem.duplex == "+":
             _mem.tx_freq = (mem.freq + mem.offset) / 10
         elif mem.duplex == "-":
             _mem.tx_freq = (mem.freq - mem.offset) / 10
@@ -323,7 +341,7 @@
 
         self._set_tone(mem, _mem)
 
-        _mem.power = POWER_LEVELS.index(mem.power)
+        _mem.power = mem.power and POWER_LEVELS.index(mem.power) or 0
         _mem.mode = MODES.index(mem.mode)
         _mem.skip = mem.skip == "S"
         _name.name = mem.name.ljust(7)



More information about the chirp_devel mailing list