[chirp_devel] [PATCH 2 of 4] [KG-UV8D] Fix memory label get/set

Marco Filippi IZ3GME
Fri Jan 16 01:30:23 PST 2015


# HG changeset patch
# User Marco Filippi <iz3gme.marco at gmail.com>
# Date 1421396204 -3600
#      Fri Jan 16 09:16:44 2015 +0100
# Node ID c70c9f0a2935d9455894e3f69ecfd46dd2eb60fb
# Parent  0a9659ddd83b60e5615fd4cc82aa02843d7674d9
[KG-UV8D] Fix memory label get/set

After adding radio image, automated tests revealed that empty label chars were
not handled correctly
As a side effect of defining element as u8 we can now see their values in
developper browser

discovered working on #2143

diff --git a/chirp/kguv8d.py b/chirp/kguv8d.py
--- a/chirp/kguv8d.py
+++ b/chirp/kguv8d.py
@@ -246,7 +246,7 @@
 
     #seekto 0x4780;
     struct {
-        char    name[8];
+        u8    name[8];
     } names[1000];
 
     #seekto 0x6700;
@@ -517,7 +517,8 @@
             mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10
 
         for char in _nam.name:
-            mem.name += str(char)
+            if char != 0:
+                mem.name += chr(char)
         mem.name = mem.name.rstrip()
 
         dtcs_pol = ["N", "N"]
@@ -649,9 +650,11 @@
         # set to mute mode to QT (not QT+DTMF or QT*DTMF)
         _mem.mute_mode = 0
 
-        for i in range(0, len(mem.name)):
-            if mem.name[i]:
-                _nam.name[i] = mem.name[i]
+        for i in range(0, len(_nam.name)):
+            if i < len(mem.name) and mem.name[i]:
+                _nam.name[i] = ord(mem.name[i])
+            else:
+                _nam.name[i] = 0x0
         self._memobj.valid[mem.number] = MEM_VALID
 
     def _get_settings(self):



More information about the chirp_devel mailing list