# HG changeset patch
# User Brian Dickman <brian.maybe@gmail.com>
# Date 1472622871 25200
#      Tue Aug 30 22:54:31 2016 -0700
# Node ID 2e7f65569ba66c5ca8d9d3733ae8067e3948361a
# Parent  bf777f74e27695ef2f54e7852dda88fb14bbfa2d
[leixen] Support non-standard tones on VV898 radio memories. Fixes #3899.

This issue used to cause some download corruption when a radio memory had one of the non-standard tones (as the factory image did). Note that there is no RadioFeatures "valid tones" map, so these extra tones can not currently be selected during new memory creation.

diff -r bf777f74e276 -r 2e7f65569ba6 chirp/drivers/leixen.py
--- a/chirp/drivers/leixen.py Mon Aug 29 10:29:40 2016 -0700
+++ b/chirp/drivers/leixen.py Tue Aug 30 22:54:31 2016 -0700
@@ -356,6 +356,15 @@
     ack = radio.pipe.read(8)
 
 
+class LeixenMemory(chirp_common.Memory):
+    '''Leixen memory which supports non-standard tones and codes'''
+    def __init__(self):
+        chirp_common.Memory.__init__(self)
+
+        self._valid_map["rtone"] = TONES
+        self._valid_map["ctone"] = TONES
+
+
 # Declaring Aliases
 class LT898UV(chirp_common.Alias):
     VENDOR = "LUITON"
@@ -466,7 +475,7 @@
         _mem = self._memobj.memory[number - 1]
         _name = self._memobj.name[number - 1]
 
-        mem = chirp_common.Memory()
+        mem = LeixenMemory()
         mem.number = number
 
         if _mem.get_raw()[:4] == "\xFF\xFF\xFF\xFF":