[chirp_devel] [PATCH] Fix UV-5R PTT-ID to support A-D and *, # characters

Dan Smith
Mon Apr 1 19:49:31 PDT 2013


# HG changeset patch
# User Dan Smith <dsmith at danplanet.com>
# Date 1364870963 25200
# Node ID 41658ac74d75c6775b6f6504ee0c6d983253e1ed
# Parent  4cf8a92f36a5aef6fbdd7ab3a63e28f242bccf92
Fix UV-5R PTT-ID to support A-D and *, # characters

diff -r 4cf8a92f36a5 -r 41658ac74d75 chirp/uv5r.py
--- a/chirp/uv5r.py	Mon Apr 01 17:33:31 2013 -0700
+++ b/chirp/uv5r.py	Mon Apr 01 19:49:23 2013 -0700
@@ -1055,18 +1055,19 @@
 
         dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
         group.append(dtmf)
+        dtmfchars = "0123456789 *#ABCD"
 
         for i in range(0, 15):
             _codeobj = self._memobj.pttid[i].code
-            _code = "".join(["%x" % x for x in _codeobj if int(x) != 0xFF])
+            _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
             val = RadioSettingValueString(0, 5, _code, False)
-            val.set_charset("0123456789")
+            val.set_charset(dtmfchars)
             rs = RadioSetting("pttid/%i.code" % i, "PTT ID Code %i" % (i + 1), val)
             def apply_code(setting, obj):
                 code = []
                 for j in range(0, 5):
                     try:
-                        code.append(int(str(setting.value)[j]))
+                        code.append(dtmfchars.index(str(setting.value)[j]))
                     except IndexError:
                         code.append(0xFF)
                 obj.code = code



More information about the chirp_devel mailing list