[chirp_devel] [PATCH 1 of 1] [ft8x7] pad labels to a minimum of 5 char

Marco Filippi IZ3GME
Wed Jun 26 00:16:05 PDT 2013


# HG changeset patch
# User Marco Filippi <iz3gme.marco at gmail.com>
# Date 1372230594 -7200
# Node ID 4fdc3ad642a237b5f70614ce051d3d4129547f8f
# Parent  598c397d39c0ab9366256a4fef6ef9e7d426ec50
[ft8x7] pad labels to a minimum of 5 char
the bug seems to be limited to a few production lot of ft857d but padding
is safe for all radios in ft8x7 family and it can avoid future problems
Fix #937

diff --git a/chirp/ft817.py b/chirp/ft817.py
--- a/chirp/ft817.py
+++ b/chirp/ft817.py
@@ -687,12 +687,12 @@
         _mem.rit = 0	# not supported in chirp
         _mem.freq = mem.freq / 10
         _mem.offset = mem.offset / 10
-        for i in range(0, min(len(mem.name.rstrip()),8)):
-            _mem.name[i] = ord(mem.name[i])
-        # rfill with 0xff to mimic radio
-        # "quick&dirty" use of i from previous cicle 
-        for i in range(i+1,8):
-            _mem.name[i] = 0xff
+        # there are ft857D that have problems with short labels, see bug #937
+        # padding to 5 char is safe for all ft8x7 radio so why should i do it only for some?
+        # left align the label and then rfill with 0xff to mimic radio
+        label = '{:\xff<8}'.format('{:<5}'.format(mem.name.rstrip()))
+        for i in range(0, min(len(label),8)):
+            _mem.name[i] = ord(label[i])
         
         for setting in mem.extra:
             setattr(_mem, setting.get_name(), setting.value)



More information about the chirp_devel mailing list