[chirp_devel] [PATCH 3 of 3] [uv5r] Expose ANI code as an array of integer settings

Dan Smith
Tue Jun 5 16:36:45 PDT 2012


# HG changeset patch
# User Dan Smith <dsmith at danplanet.com>
# Date 1338939395 25200
# Node ID aeba22a01cfd02549f365be764cc61b1a988197e
# Parent  dc35edce4a5c5fd16989a29d4810df0c2d3e71d3
[uv5r] Expose ANI code as an array of integer settings
Fixes #188

diff -r dc35edce4a5c -r aeba22a01cfd chirp/uv5r.py
--- a/chirp/uv5r.py	Tue Jun 05 16:36:15 2012 -0700
+++ b/chirp/uv5r.py	Tue Jun 05 16:36:35 2012 -0700
@@ -38,6 +38,9 @@
      unknown5:2;
 } memory[128];
 
+#seekto 0x0CB2;
+u8 ani[5];
+
 #seekto 0x0E28;
 struct {
   u8 squelch;
@@ -468,6 +471,15 @@
                                                 COLOR_LIST[_settings.txled]))
         basic.append(rs)
 
+        _ani = self._memobj.ani
+        rs = RadioSetting("_ani", "ANI Code",
+                          RadioSettingValueInteger(0, 9, _ani[0]),
+                          RadioSettingValueInteger(0, 9, _ani[1]),
+                          RadioSettingValueInteger(0, 9, _ani[2]),
+                          RadioSettingValueInteger(0, 9, _ani[3]),
+                          RadioSettingValueInteger(0, 9, _ani[4]))
+        advanced.append(rs)
+
         return group
 
     def set_settings(self, settings):
@@ -477,7 +489,12 @@
                 self.set_settings(element)
                 continue
             try:
-                setattr(_settings, element.get_name(), element.value)
+                # Elements that start with "_" should be applied to the
+                # top-level memobj, otherwise to memobj.settings
+                if element.get_name().startswith("_"):
+                    setattr(self._memobj, element.get_name()[1:], element.value)
+                else:
+                    setattr(_settings, element.get_name(), element.value)
             except Exception, e:
                 print element.get_name()
                 raise



More information about the chirp_devel mailing list