[chirp_devel] [PATCH] [UV-50X3] Add Support for BTech UV-50X3 - Other Settings

Jim Unroe
Tue Jul 12 17:53:46 PDT 2016


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1468370700 14400
# Node ID f1406051cec8d0aab0e90414e2a233a7cd57da0e
# Parent  339dbb706cc0bbb2dd8635ec6ee602c2302bb079
[UV-50X3] Add Support for BTech UV-50X3 - Other Settings

This patch adds the UV-50X3 miscellaneous settings.

related to #3815

diff -r 339dbb706cc0 -r f1406051cec8 chirp/drivers/vgc.py
--- a/chirp/drivers/vgc.py	Tue Jul 12 20:25:54 2016 -0400
+++ b/chirp/drivers/vgc.py	Tue Jul 12 20:45:00 2016 -0400
@@ -310,6 +310,9 @@
 LIST_DATASPD = ["1200 bps", "9600 bps"]
 LIST_DATASQL = ["Busy/TX", "Busy", "TX"]
 
+# Other settings lists
+LIST_CPUCLK = ["Clock frequency 1", "Clock frequency 2"]
+
 # valid chars on the LCD
 VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \
     "`{|}!\"#$%&'()*+,-./:;<=>?@[]^_"
@@ -866,7 +869,8 @@
         """Translate the bit in the mem_struct into settings in the UI"""
         _mem = self._memobj
         basic = RadioSettingGroup("basic", "Basic Settings")
-        top = RadioSettings(basic)
+        other = RadioSettingGroup("other", "Other Settings")
+        top = RadioSettings(basic, other)
 
         # Basic
 
@@ -1050,6 +1054,36 @@
                                _mem.settings.tot]))
         basic.append(tot)
 
+        # Other
+
+        dw = RadioSetting("settings.dw", "Dual watch",
+                          RadioSettingValueBoolean(_mem.settings.dw))
+        other.append(dw)
+
+        cpuclk = RadioSetting("settings.cpuclk", "CPU clock frequency",
+                              RadioSettingValueList(LIST_CPUCLK,LIST_CPUCLK[
+                                  _mem.settings.cpuclk]))
+        other.append(cpuclk)
+
+        def _filter(name):
+            filtered = ""
+            for char in str(name):
+                if char in VALID_CHARS:
+                    filtered += char
+                else:
+                    filtered += " "
+            return filtered
+
+        line16 = RadioSetting("poweron_msg.line16", "Power-on message",
+                              RadioSettingValueString(0, 16, _filter(
+                                  _mem.poweron_msg.line16)))
+        other.append(line16)
+
+        line32 = RadioSetting("embedded_msg.line32", "Embedded message",
+                              RadioSettingValueString(0, 32, _filter(
+                                  _mem.embedded_msg.line32)))
+        other.append(line32)
+
         return top
 
     def set_settings(self, settings):
@@ -1080,6 +1114,12 @@
                     if element.has_apply_callback():
                         LOG.debug("Using apply callback")
                         element.run_apply_callback()
+                    elif setting == "line16":
+                        setattr(obj, setting, str(element.value).rstrip(
+                            " ").ljust(16, "\xFF"))
+                    elif setting == "line32":
+                        setattr(obj, setting, str(element.value).rstrip(
+                            " ").ljust(32, "\xFF"))
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)



More information about the chirp_devel mailing list