[chirp_devel] [PATCH] [UV-5X3] Fix for Out-of-Range Values

Jim Unroe
Sat Nov 12 13:31:34 PST 2016


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1478985715 18000
# Node ID 6042d1b0b34d47d0fc78de71db7d24014c860603
# Parent  37474c501a92467c5122a6ec080e81da2526ea48
[UV-5X3] Fix for Out-of-Range Values

The UV-5X3 apparently ships from the factory with invalid values for
the Group Code and Space Code settings. This patch intercepts
these invalid settings and changes them to the same default values
that the OEM software sets them to.

Related to #4215

diff -r 37474c501a92 -r 6042d1b0b34d chirp/drivers/uv5x3.py
--- a/chirp/drivers/uv5x3.py	Fri Nov 11 17:58:33 2016 -0500
+++ b/chirp/drivers/uv5x3.py	Sat Nov 12 16:21:55 2016 -0500
@@ -1128,14 +1128,20 @@
             val = LIST_DTMF_SPECIAL_VALUES[index]
             obj.set_value(val)
 
-        idx = LIST_DTMF_SPECIAL_VALUES.index(_mem.ani.groupcode)
+        if _mem.ani.groupcode in LIST_DTMF_SPECIAL_VALUES:
+            idx = LIST_DTMF_SPECIAL_VALUES.index(_mem.ani.groupcode)
+        else:
+            idx = LIST_DTMF_SPECIAL_VALUES.index(0x0B)
         rs = RadioSetting("ani.groupcode", "Group Code",
                           RadioSettingValueList(LIST_DTMF_SPECIAL_DIGITS,
                                                 LIST_DTMF_SPECIAL_DIGITS[idx]))
         rs.set_apply_callback(apply_dmtf_listvalue, _mem.ani.groupcode)
         dtmfd.append(rs)
 
-        idx = LIST_DTMF_SPECIAL_VALUES.index(_mem.ani.spacecode)
+        if _mem.ani.spacecode in LIST_DTMF_SPECIAL_VALUES:
+            idx = LIST_DTMF_SPECIAL_VALUES.index(_mem.ani.spacecode)
+        else:
+            idx = LIST_DTMF_SPECIAL_VALUES.index(0x0C)
         rs = RadioSetting("ani.spacecode", "Space Code",
                           RadioSettingValueList(LIST_DTMF_SPECIAL_DIGITS,
                                                 LIST_DTMF_SPECIAL_DIGITS[idx]))



More information about the chirp_devel mailing list