[chirp_devel] [PATCH 1 of 1] [FT857] Fixed cross tone usage with UI columns

Marco Filippi IZ3GME
Mon May 14 10:33:03 PDT 2012


# HG changeset patch
# User Marco Filippi <iz3gme.marco at gmail.com>
# Date 1337016020 -7200
# Node ID 604b109f24e7edcedcbb4da56cb0404856ead2fa
# Parent  4d987d0d687e740ef8849138014112e2d80c331a
[FT857] Fixed cross tone usage with UI columns
DTCS not tested in cross yet, will test when we'll have second dtcs column
part of Feature #100

diff -r 4d987d0d687e -r 604b109f24e7 chirp/ft817.py
--- a/chirp/ft817.py	gio mag 10 06:34:31 2012 -0700
+++ b/chirp/ft817.py	lun mag 14 19:20:20 2012 +0200
@@ -316,6 +316,8 @@
 
     def _get_tmode(self, mem, _mem):
         mem.tmode = self.TMODES[_mem.tmode]
+        mem.rtone = chirp_common.TONES[_mem.tone]
+        mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs]
 
     def _set_duplex(self, mem, _mem):
         _mem.duplex = self.DUPLEX.index(mem.duplex)
@@ -323,6 +325,11 @@
 
     def _set_tmode(self, mem, _mem):
         _mem.tmode = self.TMODES.index(mem.tmode)
+        # have to put this bit to 0 otherwise we get strange display in tone
+        # frequency (menu 83). See bug #88 and #163
+        _mem.unknown_toneflag = 0
+        _mem.tone = chirp_common.TONES.index(mem.rtone)
+        _mem.dcs = chirp_common.DTCS_CODES.index(mem.dtcs)
 
     def get_memory(self, number):
         if isinstance(number, str):
@@ -497,8 +504,6 @@
                 pass
         mem.skip = _mem.skip and "S" or ""
         self._get_tmode(mem, _mem)
-        mem.rtone = chirp_common.TONES[_mem.tone]
-        mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs]
 
         if _mem.tag_on_off == 1:
             for i in _mem.name:
@@ -564,11 +569,6 @@
             _mem.fm_step = self.STEPSFM.index(mem.tuning_step)
         except ValueError:
             pass
-        # have to put this bit to 0 otherwise we get strange display in tone
-        # frequency (menu 83). See bug #88 and #163
-        _mem.unknown_toneflag = 0
-        _mem.tone = chirp_common.TONES.index(mem.rtone)
-        _mem.dcs = chirp_common.DTCS_CODES.index(mem.dtcs)
         _mem.rit = 0	# not supported in chirp
         _mem.freq = mem.freq / 10
         _mem.offset = mem.offset / 10
diff -r 4d987d0d687e -r 604b109f24e7 chirp/ft857.py
--- a/chirp/ft857.py	gio mag 10 06:34:31 2012 -0700
+++ b/chirp/ft857.py	lun mag 14 19:20:20 2012 +0200
@@ -34,12 +34,13 @@
     TMODES_REV = dict(zip(TMODES.values(), TMODES.keys()))
 
     CROSS_MODES = {
-        0x05 : "Tone->Tone",
-        0x08 : "DTCS->",
-        0x06 : "Tone->DTCS",
-        0x09 : "DTCS->Tone",
         0x01 : "->Tone",
         0x02 : "->DTCS",
+        # 0x04 : "Tone->", not supported bi chirp UI
+        0x05 : "Tone->Tone",
+        0x06 : "Tone->DTCS",
+        0x08 : "DTCS->",
+        0x09 : "DTCS->Tone",
     }
     CROSS_MODES_REV = dict(zip(CROSS_MODES.values(), CROSS_MODES.keys()))
 
@@ -82,11 +83,12 @@
             unknown_toneflag:1,
             tone:6;
         u8   unknown6:1,
-            unknown_txtoneflag:1,
-            txtone:6;
+            unknown_rxtoneflag:1,
+            rxtone:6;
         u8   unknown7:1,
             dcs:7;
-        u8   unknown8:8;
+        u8   unknown8:1,
+            rxdcs:7;
         ul16 rit;
         u32 freq;
         u32 offset;
@@ -202,11 +204,28 @@
         else:
             mem.tmode = "Cross"
             mem.cross_mode = self.CROSS_MODES[int(_mem.tmode)]
-        # don't want to fail for this
-        try:
-            mem.ctone = chirp_common.TONES[_mem.txtone]
-        except IndexError:
-            mem.ctone = chirp_common.TONES[0]
+
+        if mem.tmode == "Tone":
+             mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone]
+        elif mem.tmode == "TSQL":
+             mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone]
+        elif mem.tmode == "DTCS":
+             mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs]
+        elif mem.tmode == "Cross":
+            mem.ctone = chirp_common.TONES[_mem.rxtone]
+            # don't want to fail for this
+            try:
+                mem.rtone = chirp_common.TONES[_mem.tone]
+            except IndexError:
+                mem.rtone = chirp_common.TONES[0]
+            if mem.cross_mode == "DTCS->":
+                mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs]
+            elif mem.cross_mode == "Tone->DTCS":
+                mem.dtcs = chirp_common.DTCS_CODES[_mem.rxdcs]
+            elif mem.cross_mode == "DTCS->Tone":
+                mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs]
+            elif mem.cross_mode == "->DTCS":
+                mem.dtcs = chirp_common.DTCS_CODES[_mem.rxdcs]
 
 
     def _set_tmode(self, mem, _mem):
@@ -216,10 +235,22 @@
         else:
             _mem.tmode = self.CROSS_MODES_REV[mem.cross_mode]
             _mem.is_split_tone = 1
-        # should be safe to put this also when it's not needed
-        _mem.txtone = chirp_common.TONES.index(mem.ctone)
-        # dunno if ther's the same problem here but to be safe ...
-        _mem.unknown_txtoneflag = 0
+
+        if mem.tmode == "Tone":
+            _mem.tone = _mem.rxtone = chirp_common.TONES.index(mem.rtone)
+        elif mem.tmode == "TSQL":
+            _mem.tone = _mem.rxtone = chirp_common.TONES.index(mem.ctone)
+        elif mem.tmode == "DTCS":
+            _mem.dcs = _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.dtcs)
+        elif mem.tmode == "Cross":
+            _mem.tone = chirp_common.TONES.index(mem.rtone)
+            _mem.rxtone = chirp_common.TONES.index(mem.ctone)
+            _mem.dcs = _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.dtcs)
+        # have to put this bit to 0 otherwise we get strange display in tone
+        # frequency (menu 83). See bug #88 and #163
+        _mem.unknown_toneflag = 0
+        # dunno if there's the same problem here but to be safe ...
+        _mem.unknown_rxtoneflag = 0
 
 @directory.register
 class FT857USRadio(FT857Radio):



More information about the chirp_devel mailing list