[chirp_devel] [PATCH] [UV-25X2] Add Support for new BTech Color Display Mobile Radios
Jim Unroe
Fri Mar 17 14:24:02 PDT 2017
# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1489785081 14400
# Node ID 6a37192481c837ea49a60d121dde3de3ec8fc521
# Parent e1113c7da2f3eb00a5b1585ea92a8d164df0d60b
[UV-25X2] Add Support for new BTech Color Display Mobile Radios
This patch modifies the btech.py driver to support additional
mobile radios that have an OLED color display.
Additional radio models supported:
BTech UV-25X4 (quad band)
BTech UV-25X2 (dual band)
BTech UV-50X2 (dual band)
New Model #4269
diff -r e1113c7da2f3 -r 6a37192481c8 chirp/drivers/btech.py
--- a/chirp/drivers/btech.py Wed Mar 08 15:05:23 2017 -0800
+++ b/chirp/drivers/btech.py Fri Mar 17 17:11:21 2017 -0400
@@ -167,6 +167,15 @@
# B-TECH UV-5001 third generation (3G)
UV5001G3_fp = "BTG304"
+# B-TECH UV-25X2
+UV25X2_fp = "UC2012"
+
+# B-TECH UV-25X4
+UV25X4_fp = "UC4014"
+
+# B-TECH UV-50X2
+UV50X2_fp = "UC2M12"
+
# special var to know when we found a BTECH Gen 3
BTECH3 = [UV2501G3_fp, UV2501_220G3_fp, UV5001G3_fp]
@@ -226,6 +235,10 @@
MSTRING = "\x55\x20\x15\x09\x20\x45\x4d\x02"
# for the QYT KT7900D & KT8900D
MSTRING_KT8900D = "\x55\x20\x16\x08\x01\xFF\xDC\x02"
+# for the BTECH UV-25X2 and UV-50X2
+MSTRING_UV25X2 = "\x55\x20\x16\x12\x28\xFF\xDC\x02"
+# for the BTECH UV-25X4
+MSTRING_UV25X4 = "\x55\x20\x16\x11\x18\xFF\xDC\x02"
def _clean_buffer(radio):
@@ -852,10 +865,12 @@
# Extra
mem.extra = RadioSettingGroup("extra", "Extra")
- scramble = RadioSetting("scramble", "Scramble",
- RadioSettingValueBoolean(bool(
- _mem.scramble)))
- mem.extra.append(scramble)
+ if not self.COLOR_LCD or \
+ (self.COLOR_LCD and not self.VENDOR == "BTECH"):
+ scramble = RadioSetting("scramble", "Scramble",
+ RadioSettingValueBoolean(bool(
+ _mem.scramble)))
+ mem.extra.append(scramble)
bcl = RadioSetting("bcl", "Busy channel lockout",
RadioSettingValueBoolean(bool(_mem.bcl)))
@@ -1061,11 +1076,18 @@
_mem.settings.pttlt))
basic.append(pttlt)
- emctp = RadioSetting("settings.emctp", "Alarm mode",
- RadioSettingValueList(
- LIST_EMCTP,
- LIST_EMCTP[_mem.settings.emctp]))
- basic.append(emctp)
+ if self.VENDOR == "BTECH" and self.COLOR_LCD:
+ emctp = RadioSetting("settings.emctp", "Alarm mode",
+ RadioSettingValueList(
+ LIST_EMCTPX,
+ LIST_EMCTPX[_mem.settings.emctp]))
+ basic.append(emctp)
+ else:
+ emctp = RadioSetting("settings.emctp", "Alarm mode",
+ RadioSettingValueList(
+ LIST_EMCTP,
+ LIST_EMCTP[_mem.settings.emctp]))
+ basic.append(emctp)
emcch = RadioSetting("settings.emcch", "Alarm channel",
RadioSettingValueInteger(0, 199,
@@ -1119,10 +1141,17 @@
basic.append(langua)
if self.VENDOR == "BTECH":
- sync = RadioSetting("settings.sync", "A/B channel sync",
- RadioSettingValueBoolean(
- _mem.settings.sync))
- basic.append(sync)
+ if self.COLOR_LCD:
+ sync = RadioSetting("settings.sync", "Channel display sync",
+ RadioSettingValueList(
+ LIST_SYNC,
+ LIST_SYNC[_mem.settings.sync]))
+ basic.append(sync)
+ else:
+ sync = RadioSetting("settings.sync", "A/B channel sync",
+ RadioSettingValueBoolean(
+ _mem.settings.sync))
+ basic.append(sync)
else:
autolk = RadioSetting("settings.sync", "Auto keylock",
RadioSettingValueBoolean(
@@ -1289,6 +1318,24 @@
_mem.settings.dtmfg))
basic.append(dtmfg)
+ if self.VENDOR == "BTECH" and self.COLOR_LCD:
+ mgain = RadioSetting("settings.mgain", "Mic gain",
+ RadioSettingValueInteger(0, 120,
+ _mem.settings.mgain))
+ basic.append(mgain)
+
+ skiptx = RadioSetting("settings.skiptx", "Skip TX",
+ RadioSettingValueList(
+ LIST_SKIPTX,
+ LIST_SKIPTX[_mem.settings.skiptx]))
+ basic.append(skiptx)
+
+ scmode = RadioSetting("settings.scmode", "Scan mode",
+ RadioSettingValueList(
+ LIST_SCMODE,
+ LIST_SCMODE[_mem.settings.scmode]))
+ basic.append(scmode)
+
# Advanced
def _filter(name):
filtered = ""
@@ -1802,17 +1849,19 @@
SPMUTE_LIST[_mem.vfo.d.spmute]))
work.append(vfodspmute)
- vfoascr = RadioSetting("vfo.a.scramble", "VFO A scramble",
- RadioSettingValueBoolean(
- _mem.vfo.a.scramble))
- work.append(vfoascr)
-
- vfobscr = RadioSetting("vfo.b.scramble", "VFO B scramble",
- RadioSettingValueBoolean(
- _mem.vfo.b.scramble))
- work.append(vfobscr)
-
- if self.COLOR_LCD:
+ if not self.COLOR_LCD or \
+ (self.COLOR_LCD and not self.VENDOR == "BTECH"):
+ vfoascr = RadioSetting("vfo.a.scramble", "VFO A scramble",
+ RadioSettingValueBoolean(
+ _mem.vfo.a.scramble))
+ work.append(vfoascr)
+
+ vfobscr = RadioSetting("vfo.b.scramble", "VFO B scramble",
+ RadioSettingValueBoolean(
+ _mem.vfo.b.scramble))
+ work.append(vfobscr)
+
+ if self.COLOR_LCD and not self.VENDOR == "BTECH":
vfocscr = RadioSetting("vfo.c.scramble", "VFO C scramble",
RadioSettingValueBoolean(
_mem.vfo.c.scramble))
@@ -3537,7 +3586,7 @@
LOG.info("Radio ranges: UHF %d to %d" % uhf)
# the additional bands
- if self.MODEL in ["KT7900D", ]:
+ if self.MODEL in ["UV-25X4", "KT7900D"]:
# 200Mhz band
vhf2 = _decode_ranges(ranges.vhf2_low, ranges.vhf2_high)
LOG.info("Radio ranges: VHF(220) %d to %d" % vhf2)
@@ -3554,6 +3603,43 @@
@directory.register
+class UV25X2(BTechColor):
+ """Baofeng Tech UV25X2"""
+ MODEL = "UV-25X2"
+ BANDS = 2
+ _vhf_range = (130000000, 180000000)
+ _uhf_range = (400000000, 521000000)
+ _magic = MSTRING_UV25X2
+ _fileid = [UV25X2_fp, ]
+
+
+ at directory.register
+class UV25X4(BTechColor):
+ """Baofeng Tech UV25X4"""
+ MODEL = "UV-25X4"
+ BANDS = 4
+ _vhf_range = (130000000, 180000000)
+ _220_range = (200000000, 271000000)
+ _uhf_range = (400000000, 521000000)
+ _350_range = (350000000, 391000000)
+ _magic = MSTRING_UV25X4
+ _fileid = [UV25X4_fp, ]
+
+
+ at directory.register
+class UV50X2(BTechColor):
+ """Baofeng Tech UV50X2"""
+ MODEL = "UV-50X2"
+ BANDS = 2
+ _vhf_range = (130000000, 180000000)
+ _uhf_range = (400000000, 521000000)
+ _magic = MSTRING_UV25X2
+ _fileid = [UV50X2_fp, ]
+ _power_levels = [chirp_common.PowerLevel("High", watts=50),
+ chirp_common.PowerLevel("Low", watts=10)]
+
+
+ at directory.register
class KT7900D(BTechColor):
"""QYT KT7900D"""
VENDOR = "QYT"
More information about the chirp_devel
mailing list