[chirp_devel] [PATCH] [uv5r] Add setting to allow editing the 'Alarm Code' value
# HG changeset patch # User Jim Unroe rock.unroe@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]))
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];
Just so I'm clear, are you adding the other elements here and planning to use them later (i.e. everything other than alarmcode).
On Sun, Feb 24, 2013 at 2:45 PM, Dan Smith dsmith@danplanet.com wrote:
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];
Just so I'm clear, are you adding the other elements here and planning to use them later (i.e. everything other than alarmcode).
Dan,
That's a valid question. I debated about this myself and probably should have asked your opinion about it.
I considered making another structure for just the alarm code. But this area of memory is what I call the ANI block. It definitely has other set of codes within this block. But at this point I don't if the UV-5R is even capable of using them. If I discover how to use them, sure I will add those to the list of features.
What you you rather see? 'alarmcode' flanked by large unknowns or a separate structure until a usefulness for the rest of the memory locations can be established? Jim
What you you rather see? 'alarmcode' flanked by large unknowns or a separate structure until a usefulness for the rest of the memory locations can be established?
No, that's fine, I was just wondering whether I was supposed to connect them to something in the existing code. I guess I should make bitwise support comments so that we can document some of that stuff inline :)
participants (2)
-
Dan Smith
-
Jim Unroe