# HG changeset patch # User Jim Unroe rock.unroe@gmail.com # Date 1489021560 18000 # Node ID 4272a99f8376000aa4791aa6bb0be117740bb547 # Parent 75eea458e10dc98f6876a1d8ff60ad2228702f08 [KG-UV8D] DTCS Bug in Wouxun KG-UV8D Driver
This patch addresses the bug where the DTCS Tone value can't but updated when Tone Mode is set to DTCS.
Related to #4585
diff -r 75eea458e10d -r 4272a99f8376 chirp/drivers/kguv8d.py --- a/chirp/drivers/kguv8d.py Wed Mar 08 19:43:33 2017 -0500 +++ b/chirp/drivers/kguv8d.py Wed Mar 08 20:06:00 2017 -0500 @@ -589,34 +589,33 @@ val += 0x8000 return val
- if mem.tmode == "Cross": + rx_mode = tx_mode = None + rxtone = txtone = 0xFFFF + + if mem.tmode == "Tone": + tx_mode = "Tone" + rx_mode = None + txtone = int(mem.rtone * 10) + elif mem.tmode == "TSQL": + rx_mode = tx_mode = "Tone" + rxtone = txtone = int(mem.ctone * 10) + elif mem.tmode == "DTCS": + tx_mode = rx_mode = "DTCS" + txtone = _set_dcs(mem.dtcs, mem.dtcs_polarity[0]) + rxtone = _set_dcs(mem.dtcs, mem.dtcs_polarity[1]) + elif mem.tmode == "Cross": tx_mode, rx_mode = mem.cross_mode.split("->") - elif mem.tmode == "Tone": - tx_mode = mem.tmode - rx_mode = None - else: - tx_mode = rx_mode = mem.tmode + if tx_mode == "DTCS": + txtone = _set_dcs(mem.dtcs, mem.dtcs_polarity[0]) + elif tx_mode == "Tone": + txtone = int(mem.rtone * 10) + if rx_mode == "DTCS": + rxtone = _set_dcs(mem.rx_dtcs, mem.dtcs_polarity[1]) + elif rx_mode == "Tone": + rxtone = int(mem.ctone * 10)
- if tx_mode == "DTCS": - _mem.txtone = mem.tmode != "DTCS" and \ - _set_dcs(mem.dtcs, mem.dtcs_polarity[0]) or \ - _set_dcs(mem.rx_dtcs, mem.dtcs_polarity[0]) - _mem.txtone += 0x4000 - elif tx_mode: - _mem.txtone = tx_mode == "Tone" and \ - int(mem.rtone * 10) or int(mem.ctone * 10) - _mem.txtone += 0x8000 - else: - _mem.txtone = 0 - - if rx_mode == "DTCS": - _mem.rxtone = _set_dcs(mem.rx_dtcs, mem.dtcs_polarity[1]) - _mem.rxtone += 0x4000 - elif rx_mode: - _mem.rxtone = int(mem.ctone * 10) - _mem.rxtone += 0x8000 - else: - _mem.rxtone = 0 + _mem.rxtone = rxtone + _mem.txtone = txtone
LOG.debug("Set TX %s (%i) RX %s (%i)" % (tx_mode, _mem.txtone, rx_mode, _mem.rxtone))