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

Jim Unroe
Tue Sep 6 19:37:17 PDT 2016


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1473215345 14400
# Node ID 1cdb5cfe1d38bfa398bccaf3121953510bc88933
# Parent  e45119059c9f885080d9a9679a4c0af34226fb6d
[UV-5X3] Fix Out-of-Range Settings

The factory neglected to set 2 settings with valid values in the production
radios which caused CHIRP to fail with an out-of-range condition.

This patch adds bounds checking so that if these settings have out-of-range
values, they are set to the same default values as the pre-production radios.

Bug #3995

diff -r e45119059c9f -r 1cdb5cfe1d38 chirp/drivers/uv5x3.py
--- a/chirp/drivers/uv5x3.py	Sun Sep 04 18:26:49 2016 -0700
+++ b/chirp/drivers/uv5x3.py	Tue Sep 06 22:29:05 2016 -0400
@@ -1119,16 +1119,22 @@
         rs.set_apply_callback(apply_code, self._memobj.ani)
         dtmfd.append(rs)
 
+        if _mem.ani.resettime > 0x9F:
+            val = 0x4F
+        else:
+            val = _mem.ani.resettime
         rs = RadioSetting("ani.resettime", "Reset Time",
                           RadioSettingValueList(LIST_RESETTIME,
-                                                LIST_RESETTIME[
-                                                _mem.ani.resettime]))
+                                                LIST_RESETTIME[val]))
         dtmfd.append(rs)
 
+        if _mem.ani.delayproctime > 0x27:
+            val = 0x04
+        else:
+            val = _mem.ani.delayproctime
         rs = RadioSetting("ani.delayproctime", "Delay Processing Time",
                           RadioSettingValueList(LIST_DELAYPROCTIME,
-                                                LIST_DELAYPROCTIME[
-                                                _mem.ani.delayproctime]))
+                                                LIST_DELAYPROCTIME[val]))
         dtmfd.append(rs)
 
         # Service settings



More information about the chirp_devel mailing list