[chirp_devel] [PATCH] [IC-T8A] Add support for reading and writing channel names. Closes #3627

Tom Hayward
Tue May 3 14:49:09 PDT 2016


# HG changeset patch
# User Tom Hayward <tom at tomh.us>
# Date 1462311878 25200
#      Tue May 03 14:44:38 2016 -0700
# Node ID 98f5a40fa7f21d964706a77d6d882767d773e1d1
# Parent  e7747f518dcd7d9636607ab190d9c27a380e7728
[IC-T8A] Add support for reading and writing channel names. Closes #3627

diff -r e7747f518dcd -r 98f5a40fa7f2 chirp/drivers/ict8.py
--- a/chirp/drivers/ict8.py	Mon Apr 11 21:02:43 2016 -0400
+++ b/chirp/drivers/ict8.py	Tue May 03 14:44:38 2016 -0700
@@ -35,6 +35,11 @@
 
 struct memory memory[100];
 
+#seekto 0x0400;
+struct {
+  char name[4];
+} names[100];
+
 #seekto 0x0600;
 struct flags flags[100];
 """
@@ -65,7 +70,8 @@
         rf.valid_skips = ["", "S"]
         rf.valid_modes = ["FM"]
         rf.memory_bounds = (0, 99)
-        rf.has_name = False
+        rf.valid_name_length = 4
+        rf.valid_characters = chirp_common.CHARSET_UPPER_NUMERIC
         rf.has_dtcs = False
         rf.has_dtcs_polarity = False
         rf.has_tuning_step = False
@@ -78,11 +84,13 @@
 
     def get_raw_memory(self, number):
         return (str(self._memobj.memory[number]) +
-                str(self._memobj.duptone[number]))
+                str(self._memobj.names[number]) +
+                str(self._memobj.flags[number]))
 
     def get_memory(self, number):
         _mem = self._memobj.memory[number]
         _flg = self._memobj.flags[number]
+        _name = self._memobj.names[number]
 
         mem = chirp_common.Memory()
         mem.number = number
@@ -98,12 +106,15 @@
         mem.duplex = DUPLEX[_flg.duplex]
         mem.tmode = TMODES[_flg.tmode]
         mem.skip = _flg.skip and "S" or ""
+        if _name.name.get_raw() != "\xFF\xFF\xFF\xFF":
+            mem.name = str(_name.name).rstrip()
 
         return mem
 
     def set_memory(self, mem):
         _mem = self._memobj.memory[mem.number]
         _flg = self._memobj.flags[mem.number]
+        _name = self._memobj.names[mem.number]
 
         if mem.empty:
             _flg.empty = True
@@ -119,3 +130,8 @@
         _flg.duplex = DUPLEX.index(mem.duplex)
         _flg.tmode = TMODES.index(mem.tmode)
         _flg.skip = mem.skip == "S"
+
+        if mem.name:
+            _name.name = mem.name.ljust(4)
+        else:
+            _name.name = "\xFF\xFF\xFF\xFF"



More information about the chirp_devel mailing list