[chirp_devel] [PATCH] [uv5r] Add setting to allow editing the 'Alarm Code' value

Jim Unroe
Sun Feb 24 07:11:39 PST 2013


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1361718412 18000
# Node ID 0769d077d73a547e8f0d906f7c78ac8218658f0f
# Parent  8fbc1dcadde02c96bed90c499f9c5d72d2d5b819
[uv5r] Add setting to allow editing the 'Alarm Code' value
Expand ANI structure and include 'alarmcode' in that expansion
Add 'Alarm Code' setting to DTMF Settings menu
#615

diff -r 8fbc1dcadde0 -r 0769d077d73a chirp/uv5r.py
--- a/chirp/uv5r.py	Sat Feb 23 14:03:24 2013 -0800
+++ b/chirp/uv5r.py	Sun Feb 24 10:06:52 2013 -0500
@@ -49,8 +49,24 @@
   u8 unused[11];
 } pttid[15];
 
-#seekto 0x0CB2;
+#seekto 0x0C88;
 struct {
+  u8 code222[3];
+  u8 unused222[2];
+  u8 code333[3];
+  u8 unused333[2];
+  u8 alarmcode[3];
+  u8 unused119[2];
+  u8 unknown1;
+  u8 code555[3];
+  u8 unused555[2];
+  u8 code666[3];
+  u8 unused666[2];
+  u8 code777[3];
+  u8 unused777[2];
+  u8 unknown2;
+  u8 code60606[5];
+  u8 code70707[5];
   u8 code[5];
   u8 unused1:6,
      aniid:2;
@@ -1079,6 +1095,22 @@
                                                 options[self._memobj.ani.aniid]))
         dtmf.append(rs)
 
+        _codeobj = self._memobj.ani.alarmcode
+        _code = "".join(["%x" % x for x in _codeobj if int(x) != 0xFF])
+        val = RadioSettingValueString(0, 3, _code, False)
+        val.set_charset("0123456789")
+        rs = RadioSetting("ani.alarmcode", "Alarm Code", val)
+        def apply_code(setting, obj):
+            alarmcode = []
+            for j in range(0, 3):
+                try:
+                    alarmcode.append(int(str(setting.value)[j]))
+                except IndexError:
+                    alarmcode.append(0xFF)
+            obj.alarmcode = alarmcode
+        rs.set_apply_callback(apply_code, self._memobj.ani)
+        dtmf.append(rs)
+
         rs = RadioSetting("dtmfst", "DTMF Sidetone",
                           RadioSettingValueList(DTMFST_LIST,
                                                 DTMFST_LIST[_settings.dtmfst]))



More information about the chirp_devel mailing list