[chirp_devel] [PATCH 0 of 4 ] Add cross dtcs support - third try
I added two patches to correct side effects of adding new dtcs cross modes. To make things simple I include here the previous "Add cross dtcs support" patches so this patchbomb can be applied directly on official repository version.
# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1337797175 -7200 # Node ID bb14698be7638c9c6ac535581db52bde8d425ba0 # Parent e7cbbe3465f1994d64463b1405eaa7edd8f7b834 Add rx_dtcs and additional tone/dtcs modes support in UI needed for Feature #100
diff -r e7cbbe3465f1 -r bb14698be763 chirp/chirp_common.py --- a/chirp/chirp_common.py mer mag 23 16:14:31 2012 -0700 +++ b/chirp/chirp_common.py mer mag 23 20:19:35 2012 +0200 @@ -56,6 +56,7 @@ "DTCS->", "->Tone", "->DTCS", + "DTCS->DTCS", ]
MODES = ["WFM", "FM", "NFM", "AM", "NAM", "DV", "USB", "LSB", "CW", "RTTY", @@ -213,6 +214,7 @@ rtone = 88.5 ctone = 88.5 dtcs = 23 + rx_dtcs = 23 tmode = "" cross_mode = "Tone->Tone" dtcs_polarity = "NN" @@ -242,6 +244,7 @@ self.rtone = 88.5 self.ctone = 88.5 self.dtcs = 23 + self.rx_dtcs = 23 self.tmode = "" self.cross_mode = "Tone->Tone" self.dtcs_polarity = "NN" @@ -262,6 +265,7 @@ "rtone" : TONES, "ctone" : TONES, "dtcs" : DTCS_CODES + DTCS_EXTRA_CODES, + "rx_dtcs" : DTCS_CODES + DTCS_EXTRA_CODES, "tmode" : TONE_MODES, "dtcs_polarity" : ["NN", "NR", "RN", "RR"], "cross_mode" : CROSS_MODES, @@ -444,6 +448,13 @@ if self.dtcs not in DTCS_CODES: raise errors.InvalidDataError("DTCS code is not valid")
+ try: + self.rx_dtcs = int(vals[8], 10) + except: + raise errors.InvalidDataError("DTCS Rx code is not a valid number") + if self.rx_dtcs not in DTCS_CODES: + raise errors.InvalidDataError("DTCS Rx code is not valid") + if vals[9] in ["NN", "NR", "RN", "RR"]: self.dtcs_polarity = vals[9] else: @@ -614,6 +625,7 @@ # General "has_bank_index" : BOOLEAN, "has_dtcs" : BOOLEAN, + "has_rx_dtcs" : BOOLEAN, "has_dtcs_polarity" : BOOLEAN, "has_mode" : BOOLEAN, "has_offset" : BOOLEAN, @@ -702,6 +714,8 @@ "an order other than in main memory") self.init("has_dtcs", True, "Indicates that DTCS tone mode is available") + self.init("has_rx_dtcs", False, + "Indicates that radio can use two different DTCS codes for rx and tx") self.init("has_dtcs_polarity", True, "Indicates that the DTCS polarity can be changed") self.init("has_mode", True, diff -r e7cbbe3465f1 -r bb14698be763 chirpui/memedit.py --- a/chirpui/memedit.py mer mag 23 16:14:31 2012 -0700 +++ b/chirpui/memedit.py mer mag 23 20:19:35 2012 +0200 @@ -60,56 +60,59 @@
class MemoryEditor(common.Editor): cols = [ - (_("Loc") , TYPE_INT, gtk.CellRendererText, ), - (_("Frequency") , TYPE_INT64, gtk.CellRendererText, ), - (_("Name") , TYPE_STRING, gtk.CellRendererText, ), - (_("Tone Mode") , TYPE_STRING, gtk.CellRendererCombo, ), - (_("Tone") , TYPE_FLOAT, gtk.CellRendererCombo, ), - (_("ToneSql") , TYPE_FLOAT, gtk.CellRendererCombo, ), - (_("DTCS Code") , TYPE_INT, gtk.CellRendererCombo, ), - (_("DTCS Pol") , TYPE_STRING, gtk.CellRendererCombo, ), - (_("Cross Mode"), TYPE_STRING, gtk.CellRendererCombo, ), - (_("Duplex") , TYPE_STRING, gtk.CellRendererCombo, ), - (_("Offset") , TYPE_INT64, gtk.CellRendererText, ), - (_("Mode") , TYPE_STRING, gtk.CellRendererCombo, ), - (_("Power") , TYPE_STRING, gtk.CellRendererCombo, ), - (_("Tune Step") , TYPE_FLOAT, gtk.CellRendererCombo, ), - (_("Skip") , TYPE_STRING, gtk.CellRendererCombo, ), - (_("Comment") , TYPE_STRING, gtk.CellRendererText, ), - ("_filled" , TYPE_BOOLEAN, None, ), - ("_hide_cols" , TYPE_PYOBJECT,None, ), - ("_extd" , TYPE_STRING, None, ), + (_("Loc") , TYPE_INT, gtk.CellRendererText, ), + (_("Frequency") , TYPE_INT64, gtk.CellRendererText, ), + (_("Name") , TYPE_STRING, gtk.CellRendererText, ), + (_("Tone Mode") , TYPE_STRING, gtk.CellRendererCombo, ), + (_("Tone") , TYPE_FLOAT, gtk.CellRendererCombo, ), + (_("ToneSql") , TYPE_FLOAT, gtk.CellRendererCombo, ), + (_("DTCS Code") , TYPE_INT, gtk.CellRendererCombo, ), + (_("DTCS Rx Code") , TYPE_INT, gtk.CellRendererCombo, ), + (_("DTCS Pol") , TYPE_STRING, gtk.CellRendererCombo, ), + (_("Cross Mode") , TYPE_STRING, gtk.CellRendererCombo, ), + (_("Duplex") , TYPE_STRING, gtk.CellRendererCombo, ), + (_("Offset") , TYPE_INT64, gtk.CellRendererText, ), + (_("Mode") , TYPE_STRING, gtk.CellRendererCombo, ), + (_("Power") , TYPE_STRING, gtk.CellRendererCombo, ), + (_("Tune Step") , TYPE_FLOAT, gtk.CellRendererCombo, ), + (_("Skip") , TYPE_STRING, gtk.CellRendererCombo, ), + (_("Comment") , TYPE_STRING, gtk.CellRendererText, ), + ("_filled" , TYPE_BOOLEAN, None, ), + ("_hide_cols" , TYPE_PYOBJECT,None, ), + ("_extd" , TYPE_STRING, None, ), ]
defaults = { - _("Name") : "", - _("Frequency") : 146010000, - _("Tone") : 88.5, - _("ToneSql") : 88.5, - _("DTCS Code") : 23, - _("DTCS Pol") : "NN", - _("Cross Mode"): "Tone->Tone", - _("Duplex") : "", - _("Offset") : 0, - _("Mode") : "FM", - _("Power") : "", - _("Tune Step") : 5.0, - _("Tone Mode") : "", - _("Skip") : "", - _("Comment") : "", + _("Name") : "", + _("Frequency") : 146010000, + _("Tone") : 88.5, + _("ToneSql") : 88.5, + _("DTCS Code") : 23, + _("DTCS Rx Code") : 23, + _("DTCS Pol") : "NN", + _("Cross Mode") : "Tone->Tone", + _("Duplex") : "", + _("Offset") : 0, + _("Mode") : "FM", + _("Power") : "", + _("Tune Step") : 5.0, + _("Tone Mode") : "", + _("Skip") : "", + _("Comment") : "", }
choices = { - _("Tone") : chirp_common.TONES, - _("ToneSql") : chirp_common.TONES, - _("DTCS Code") : chirp_common.DTCS_CODES, - _("DTCS Pol") : ["NN", "NR", "RN", "RR"], - _("Mode") : chirp_common.MODES, - _("Power") : [], - _("Duplex") : ["", "-", "+", "split"], - _("Tune Step") : chirp_common.TUNING_STEPS, - _("Tone Mode") : ["", "Tone", "TSQL", "DTCS"], - _("Cross Mode") : chirp_common.CROSS_MODES, + _("Tone") : chirp_common.TONES, + _("ToneSql") : chirp_common.TONES, + _("DTCS Code") : chirp_common.DTCS_CODES, + _("DTCS Rx Code") : chirp_common.DTCS_CODES, + _("DTCS Pol") : ["NN", "NR", "RN", "RR"], + _("Mode") : chirp_common.MODES, + _("Power") : [], + _("Duplex") : ["", "-", "+", "split"], + _("Tune Step") : chirp_common.TUNING_STEPS, + _("Tone Mode") : ["", "Tone", "TSQL", "DTCS"], + _("Cross Mode") : chirp_common.CROSS_MODES, }
def ed_name(self, _, __, new, ___): @@ -206,19 +209,24 @@ if tmode == "Tone": hide += [self.col(_("ToneSql")), self.col(_("DTCS Code")), + self.col(_("DTCS Rx Code")), self.col(_("DTCS Pol"))] elif tmode == "TSQL": if self._features.has_ctone: hide += [self.col(_("Tone"))]
hide += [self.col(_("DTCS Code")), + self.col(_("DTCS Rx Code")), self.col(_("DTCS Pol"))] elif tmode == "DTCS": - hide += [self.col(_("Tone")), self.col(_("ToneSql"))] + hide += [self.col(_("Tone")), + self.col(_("DTCS Rx Code")), + self.col(_("ToneSql"))] elif tmode == "" or tmode == "(None)": hide += [self.col(_("Tone")), self.col(_("ToneSql")), self.col(_("DTCS Code")), + self.col(_("DTCS Rx Code")), self.col(_("DTCS Pol"))]
if duplex == "" or duplex == "(None)": @@ -303,7 +311,7 @@
if colnum == self.col(_("Frequency")): val = chirp_common.format_freq(val) - elif colnum == self.col(_("DTCS Code")): + elif colnum in [self.col(_("DTCS Code")), self.col(_("DTCS Rx Code"))]: val = "%03i" % int(val) elif colnum == self.col(_("Offset")): val = chirp_common.format_freq(val) @@ -890,6 +898,7 @@ self.col(_("Tone")), memory.rtone, self.col(_("ToneSql")), memory.ctone, self.col(_("DTCS Code")), memory.dtcs, + self.col(_("DTCS Rx Code")), memory.rx_dtcs, self.col(_("DTCS Pol")), memory.dtcs_polarity, self.col(_("Cross Mode")), memory.cross_mode, self.col(_("Duplex")), memory.duplex, @@ -944,6 +953,7 @@ mem.rtone = vals[self.col(_("Tone"))] mem.ctone = vals[self.col(_("ToneSql"))] mem.dtcs = vals[self.col(_("DTCS Code"))] + mem.rx_dtcs = vals[self.col(_("DTCS Rx Code"))] mem.tmode = vals[self.col(_("Tone Mode"))] mem.cross_mode = vals[self.col(_("Cross Mode"))] mem.dtcs_polarity = vals[self.col(_("DTCS Pol"))] @@ -1076,6 +1086,7 @@ def get_unsupported_columns(self): maybe_hide = [ ("has_dtcs", _("DTCS Code")), + ("has_rx_dtcs", _("DTCS Rx Code")), ("has_dtcs_polarity", _("DTCS Pol")), ("has_mode", _("Mode")), ("has_offset", _("Offset")),
# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1337797463 -7200 # Node ID d4c1e515ca427694cac2b1eba401bcd8f1e9f897 # Parent bb14698be7638c9c6ac535581db52bde8d425ba0 [FT857] Add Dtcs cross modes support and other tones related features last part of Feature #100
diff -r bb14698be763 -r d4c1e515ca42 chirp/ft857.py --- a/chirp/ft857.py mer mag 23 20:19:35 2012 +0200 +++ b/chirp/ft857.py mer mag 23 20:24:23 2012 +0200 @@ -27,6 +27,7 @@ TMODES = { 0x04 : "Tone", 0x05 : "TSQL", + # 0x08 : "DTCS Enc", not supported in UI yet 0x0a : "DTCS", 0xff : "Cross", 0x00 : "", @@ -36,11 +37,12 @@ CROSS_MODES = { 0x01 : "->Tone", 0x02 : "->DTCS", - # 0x04 : "Tone->", not supported bi chirp UI + # 0x04 : "Tone->", not supported in UI yet 0x05 : "Tone->Tone", 0x06 : "Tone->DTCS", 0x08 : "DTCS->", 0x09 : "DTCS->Tone", + 0x0a : "DTCS->DTCS", } CROSS_MODES_REV = dict(zip(CROSS_MODES.values(), CROSS_MODES.keys()))
@@ -188,6 +190,7 @@ rf = ft817.FT817Radio.get_features(self) rf.has_cross = True rf.has_ctone = True + rf.has_rx_dtcs = True rf.valid_tmodes = self.TMODES_REV.keys() rf.valid_cross_modes = self.CROSS_MODES_REV.keys() return rf @@ -209,8 +212,11 @@ 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 Enc": # UI does not support it yet but + # this code has alreay been tested + mem.dtcs = mem.rx_dtcs = chirp_common.DTCS_CODES[_mem.dcs] elif mem.tmode == "DTCS": - mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs] + mem.dtcs = mem.rx_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 @@ -218,15 +224,8 @@ 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] - + mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs] + mem.rx_dtcs = chirp_common.DTCS_CODES[_mem.rxdcs]
def _set_tmode(self, mem, _mem): if mem.tmode != "Cross": @@ -240,12 +239,16 @@ _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 Enc": # UI does not support it yet but + # this code has alreay been tested + _mem.dcs = _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.dtcs) elif mem.tmode == "DTCS": - _mem.dcs = _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.dtcs) + _mem.dcs = _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.rx_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) + _mem.dcs = chirp_common.DTCS_CODES.index(mem.dtcs) + _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.rx_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
# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1338021815 -7200 # Node ID 29fa7ff1a8d8deac2cfa50811e71b808614bd997 # Parent d4c1e515ca427694cac2b1eba401bcd8f1e9f897 [KG-UVD1P] Add support for DTCS->DTCS tone cross mode side effect of UI improvement from Feature #100
diff -r d4c1e515ca42 -r 29fa7ff1a8d8 chirp/wouxun.py --- a/chirp/wouxun.py mer mag 23 20:24:23 2012 +0200 +++ b/chirp/wouxun.py sab mag 26 10:43:35 2012 +0200 @@ -188,6 +188,15 @@ def get_features(self): rf = chirp_common.RadioFeatures() rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = [ + "Tone->Tone", + "Tone->DTCS", + "DTCS->Tone", + "DTCS->", + "->Tone", + "->DTCS", + "DTCS->DTCS", + ] rf.valid_modes = ["FM", "NFM"] rf.valid_power_levels = POWER_LEVELS rf.valid_bands = [(136000000, 174000000), (216000000, 520000000)] @@ -195,6 +204,7 @@ rf.valid_name_length = 6 rf.valid_duplexes = ["", "+", "-", "split"] rf.has_ctone = True + rf.has_rx_dtcs = True rf.has_cross = True rf.has_tuning_step = False rf.has_bank = False @@ -223,7 +233,7 @@
if _mem.rx_tone != 0xFFFF and _mem.rx_tone > 0x2800: rcode, rpol = _get_dcs(_mem.rx_tone) - mem.dtcs = rcode + mem.rx_dtcs = rcode rxmode = "DTCS" elif _mem.rx_tone != 0xFFFF: mem.ctone = _mem.rx_tone / 10.0 @@ -235,7 +245,7 @@ mem.tmode = "Tone" elif txmode == rxmode and txmode == "Tone" and mem.rtone == mem.ctone: mem.tmode = "TSQL" - elif txmode == rxmode and txmode == "DTCS": + elif txmode == rxmode and txmode == "DTCS" and mem.dtcs == mem.rx_dtcs: mem.tmode = "DTCS" elif rxmode or txmode: mem.tmode = "Cross" @@ -307,7 +317,8 @@
if tx_mode == "DTCS": - _mem.tx_tone = _set_dcs(mem.dtcs, mem.dtcs_polarity[0]) + _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) @@ -315,7 +326,7 @@ _mem.tx_tone = 0xFFFF
if rx_mode == "DTCS": - _mem.rx_tone = _set_dcs(mem.dtcs, mem.dtcs_polarity[1]) + _mem.rx_tone = _set_dcs(mem.rx_dtcs, mem.dtcs_polarity[1]) elif rx_mode: _mem.rx_tone = int(mem.ctone * 10) else:
# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1337946960 -7200 # Node ID a5fa9ba1f9b68db0f9ecae1a9500cdcc7e650739 # Parent 29fa7ff1a8d8deac2cfa50811e71b808614bd997 Make test more smart on tone and dtcs usage needed to follow improvement from Feature #100
diff -r 29fa7ff1a8d8 -r a5fa9ba1f9b6 tests/run_tests --- a/tests/run_tests sab mag 26 10:43:35 2012 +0200 +++ b/tests/run_tests ven mag 25 13:56:00 2012 +0200 @@ -148,6 +148,9 @@
def compare_mem(self, a, b): rf = self._wrapper.do("get_features") + + if a.tmode == "Cross": + tx_mode, rx_mode = a.cross_mode.split("->")
for k, v in a.__dict__.items(): if k == "power": @@ -160,15 +163,34 @@ else: # Name mismatch fair if filter_name() is right v = self._wrapper.do("filter_name", v).rstrip() - elif k == "ctone" and not rf.has_ctone: - continue elif k == "tuning_step" and not rf.has_tuning_step: continue - elif k == "rtone" and a.tmode != "Tone": + elif k == "rtone" and not ( + a.tmode == "Tone" or + (a.tmode == "TSQL" and not rf.has_ctone) or + (a.tmode == "Cross" and tx_mode == "Tone") or + (a.tmode == "Cross" and rx_mode == "Tone" and not rf.has_ctone) + ): continue - elif k == "ctone" and a.tmode != "TSQL": + elif k == "ctone" and (not rf.has_ctone or + not ( + a.tmode == "TSQL" or + (a.tmode == "Cross" and rx_mode == "Tone") + ) + ): continue - elif k == "dtcs" and a.tmode != "DTCS": + elif k == "dtcs" and not ( + (a.tmode == "DTCS" and not rf.has_rx_dtcs) or + (a.tmode == "Cross" and tx_mode == "DTCS") or + (a.tmode == "Cross" and rx_mode == "DTCS" and not rf.has_rx_dtcs) + ): + continue + elif k == "rx_dtcs" and (not rf.has_rx_dtcs or + not ( + a.tmode == "DTCS" or + (a.tmode == "Cross" and rx_mode == "DTCS") + ) + ): continue elif k == "offset" and not a.duplex: continue @@ -323,6 +345,8 @@ # of TSQL m.rtone = 100.0 m.ctone = 107.2 + m.dtcs = 506 + m.rx_dtcs = 516 for cross_mode in rf.valid_cross_modes: m.cross_mode = cross_mode self.set_and_compare(m)
participants (2)
-
Dan Smith
-
Marco Filippi IZ3GME