[chirp_devel] [PATCH 0 of 2 ] Add cross dtcs support - second try
After comment from Dan here is a second try. This patches replaces the two "Add cross dtcs support" of yesterday
# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1337797175 -7200 # Node ID 5c7f25fd25b8e5ab6e7b01616d30c60402085cf2 # Parent ec4361ad770faedf0e25f697e9f74a3a80beb475 Add rx_dtcs and additional tone/dtcs modes support in UI needed for Feature #100
diff -r ec4361ad770f -r 5c7f25fd25b8 chirp/chirp_common.py --- a/chirp/chirp_common.py mar mag 22 18:23:51 2012 +0200 +++ 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 ec4361ad770f -r 5c7f25fd25b8 chirpui/memedit.py --- a/chirpui/memedit.py mar mag 22 18:23:51 2012 +0200 +++ 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 94c362f89ed9c67d13d14a224d34feac09a9de45 # Parent 5c7f25fd25b8e5ab6e7b01616d30c60402085cf2 [FT857] Add Dtcs cross modes support and other tones related features last part of Feature #100
diff -r 5c7f25fd25b8 -r 94c362f89ed9 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
With the patches applied:
Yaesu FT-857/897 CopyAll FAILED: <25>: Field `dtcs' is `23', expected `32' Yaesu FT-857/897 BruteForce FAILED: Field `dtcs' is `23', expected `25' Yaesu FT-857/897 Edges PASSED: All tests Yaesu FT-857/897 Banks SKIPPED: Banks not supported Yaesu FT-857/897 (U Detect PASSED: All tests Yaesu FT-857/897 (U CopyAll FAILED: <25>: Field `dtcs' is `23', expected `32' Yaesu FT-857/897 (U BruteForce FAILED: Field `dtcs' is `23', expected `25'
I also noticed:
Wouxun KG-UVD1P BruteForce FAILED: Field `tmode' is `DTCS',
expected `Cross'
This seams to be introduced by my patch to the UI ... I will check ...
I'm sure I had run test_all before to send the patches, I probably need a better pair of glasses ;)
I will send a third try
73 de IZ3GME Marco
On 25/05/2012 02:40, Dan Smith wrote:
With the patches applied:
Yaesu FT-857/897 CopyAll FAILED:<25>: Field `dtcs' is `23', expected `32' Yaesu FT-857/897 BruteForce FAILED: Field `dtcs' is `23', expected `25' Yaesu FT-857/897 Edges PASSED: All tests Yaesu FT-857/897 Banks SKIPPED: Banks not supported Yaesu FT-857/897 (U Detect PASSED: All tests Yaesu FT-857/897 (U CopyAll FAILED:<25>: Field `dtcs' is `23', expected `32' Yaesu FT-857/897 (U BruteForce FAILED: Field `dtcs' is `23', expected `25'
chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
participants (3)
-
Dan Smith
-
IZ3GME Marco
-
Marco Filippi IZ3GME