[chirp_devel] [PATCH 1 of 1] [FT857] Support for cross tones

Marco Filippi
Tue May 1 15:12:25 PDT 2012


# HG changeset patch
# User Filippi Marco <iz3gme.marco at gmail.com>
# Date 1335898797 -7200
# Node ID 1c4497c4dbd2d3cc2f6e4786b8ccea386241d60c
# Parent  95b0a2ac92588353ab1d97f329cf7b1f08825c35
[FT857] Support for cross tones
part of Feature #100

diff -r 95b0a2ac9258 -r 1c4497c4dbd2 chirp/ft817.py
--- a/chirp/ft817.py	Sun Apr 29 20:33:55 2012 +0200
+++ b/chirp/ft817.py	Tue May 01 20:59:57 2012 +0200
@@ -496,7 +496,7 @@
                 pass
         mem.skip = _mem.skip and "S" or ""
         self._get_tmode(mem, _mem)
-        mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone]
+        mem.rtone = chirp_common.TONES[_mem.tone]
         mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs]
 
         if _mem.tag_on_off == 1:
diff -r 95b0a2ac9258 -r 1c4497c4dbd2 chirp/ft857.py
--- a/chirp/ft857.py	Sun Apr 29 20:33:55 2012 +0200
+++ b/chirp/ft857.py	Tue May 01 20:59:57 2012 +0200
@@ -31,29 +31,17 @@
         0xff : "Cross",
         0x00 : "",
     }
-    TMODES_REV = {
-        ""      : 0x00,
-        "Cross" : 0xff,
-        "DTCS"  : 0x0a,
-        "TSQL"  : 0x05,
-        "Tone"  : 0x04,
-    }
+    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",
     }
-
-    CROSS_MODES_REV = {
-        "DTCS->"   : 0x08,
-        "Tone->DTCS"  : 0x06,
-        "DTCS->Tone" : 0x09,
-        "->Tone"  : 0x01,
-        "->DTCS"   : 0x02,
-    }
+    CROSS_MODES_REV = dict(zip(CROSS_MODES.values(), CROSS_MODES.keys()))
 
     _memsize = 7341
     # block 9 (140 Bytes long) is to be repeted 40 times 
@@ -91,9 +79,11 @@
             tx_mode:3,
             tx_freq_range:3;
         u8   unknown5:1,
-            unknown_flag:1,
+            unknown_toneflag:1,
             tone:6;
-        u8   unknown6:8;
+        u8   unknown6:1,
+            unknown_txtoneflag:1,
+            txtone:6;
         u8   unknown7:1,
             dcs:7;
         u8   unknown8:8;
@@ -195,6 +185,7 @@
     def get_features(self):
         rf = ft817.FT817Radio.get_features(self)
         rf.has_cross = True
+        rf.has_ctone = True
         rf.valid_tmodes = self.TMODES_REV.keys()
         rf.valid_cross_modes = self.CROSS_MODES_REV.keys()
         return rf
@@ -206,24 +197,27 @@
         mem.duplex = self.DUPLEX[_mem.duplex]
 
     def _get_tmode(self, mem, _mem):
-        # I do not use is_split_tone here because the radio sometimes set it
-        # also for standard tone mode
-        try:
+        if not _mem.is_split_tone:
             mem.tmode = self.TMODES[int(_mem.tmode)]
-        except KeyError:
+        else:
             mem.tmode = "Cross"
             mem.cross_mode = self.CROSS_MODES[int(_mem.tmode)]
+        mem.ctone = chirp_common.TONES[_mem.txtone]
 
     def _set_tmode(self, mem, _mem):
         # have to put this bit to 0 otherwise we get strange display in tone
         # frequency (menu 83). See bug #88
-        _mem.unknown_flag = 0
+        _mem.unknown_toneflag = 0
         if mem.tmode != "Cross":
             _mem.is_split_tone = 0
             _mem.tmode = self.TMODES_REV[mem.tmode]
         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
 
 @directory.register
 class FT857USRadio(FT857Radio):



More information about the chirp_devel mailing list