[chirp_devel] [PATCH] [ic208] Replace unsupported chars with *

Marco Filippi IZ3GME
Thu Jun 6 14:31:56 PDT 2013


# HG changeset patch
# User Marco Filippi <iz3gme.marco at gmail.com>
# Date 1370554300 -7200
# Node ID 479bba5dcfaf3597dc5208bca3c9c6db0954d603
# Parent  94f8b7626b59614b5b67825df6b019c52ed70518
[ic208] Replace unsupported chars with *
Fix #911

diff -r 94f8b7626b59 -r 479bba5dcfaf chirp/ic208.py
--- a/chirp/ic208.py	mer giu 05 02:26:40 2013 +0200
+++ b/chirp/ic208.py	gio giu 06 23:31:40 2013 +0200
@@ -84,7 +84,10 @@
 def get_name(_mem):
     """Decode the name from @_mem"""
     def _get_char(val):
-        return CHARSET[int(val)]
+        try:
+            return CHARSET[int(val)]
+        except KeyError:
+            return "*"
 
     name_bytes = [_mem.name1, _mem.name2, _mem.name3,
                   _mem.name4, _mem.name5, _mem.name6]
@@ -97,7 +100,10 @@
 def set_name(_mem, name):
     """Encode @name in @_mem"""
     def _get_index(char):
-        return CHARSET_REV[char]
+        try:
+            return CHARSET_REV[char]
+        except KeyError:
+            return CHARSET_REV["*"]
 
     name = name.ljust(6)[:6]
 



More information about the chirp_devel mailing list