[chirp_devel] [PATCH] [IC2100H] add setting to enable display of alphanumeric channel names

Jim Unroe
Mon Jul 7 16:33:44 PDT 2014


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1404775866 14400
# Node ID eed658e1424ebdf3c6c6712daa9281f780813e53
# Parent  8d54d97bd2667b2f6919fff177e68b43cbd745ed
[IC2100H] add setting to enable display of alphanumeric channel names

import RadioSettings from chirp.settings
add "anm"  (alphanumeric) parameter to structures
add mem.extra code to "def get_memory(self, number):"
add "Alphanumeric Name" setting
add code to enable "anm" when a memory with a "name is edited
add mem.extra code to "def set_memory(self, mem):"

related to issue #1733

diff -r 8d54d97bd266 -r eed658e1424e chirp/ic2100.py
--- a/chirp/ic2100.py	Sun Jun 22 08:10:06 2014 -0400
+++ b/chirp/ic2100.py	Mon Jul 07 19:31:06 2014 -0400
@@ -15,6 +15,10 @@
 
 from chirp import chirp_common, icf, util, directory
 from chirp import bitwise, memmap
+from chirp.settings import RadioSetting, RadioSettingGroup, \
+    RadioSettingValueInteger, RadioSettingValueList, \
+    RadioSettingValueBoolean, RadioSettingValueString, \
+    RadioSettingValueFloat, InvalidValueError
 
 MEM_FORMAT = """
 struct {
@@ -25,7 +29,9 @@
   u8    unknown1;
   bbcd  offset[2];
   u8    is_12_5:1,
-        unknownbits:3,
+        unknownbit1:1,
+        anm:1,
+        unknownbit2:1,
         duplex:2,
         tmode:2;
   u8    ctone;
@@ -43,7 +49,9 @@
   u8    unknown1;
   bbcd  offset[2];
   u8    is_12_5:1,
-        unknownbits:3,
+        unknownbit1:1,
+        anm:1,
+        unknownbit2:1,
         duplex:2,
         tmode:2;
   u8    ctone;
@@ -59,7 +67,9 @@
   u8    unknown1;
   bbcd  offset[2];
   u8    is_12_5:1,
-        unknownbits:3,
+        unknownbit1:1,
+        anm:1,
+        unknownbit2:1,
         duplex:2,
         tmode:2;
   u8    ctone;
@@ -218,6 +228,12 @@
         mem.tmode = TMODES[_mem.tmode]
         mem.duplex = DUPLEX[_mem.duplex]
         
+        mem.extra = RadioSettingGroup("Extra", "extra")
+
+        rs = RadioSetting("anm", "Alphanumeric Name",
+                          RadioSettingValueBoolean(_mem.anm))
+        mem.extra.append(rs)
+
         return mem
 
     def set_memory(self, mem):
@@ -240,6 +256,7 @@
             else:
                 _skp &= ~mask
             _mem.name = mem.name.ljust(6)
+            _mem.anm = mem.name.strip() != ""
 
         _set_freq(_mem, mem.freq)
         _set_offset(_mem, mem.offset)
@@ -248,5 +265,8 @@
         _mem.tmode = TMODES.index(mem.tmode)
         _mem.duplex = DUPLEX.index(mem.duplex)
 
+        for setting in mem.extra:
+            setattr(_mem, setting.get_name(), setting.value)
+
     def get_raw_memory(self, number):
         return repr(self._memobj.memory[number])



More information about the chirp_devel mailing list