[chirp_devel] [PATCH 1 of 1] [uv-b5] Add split duplex and calculate shift

Marco Filippi IZ3GME
Wed Sep 25 07:48:58 PDT 2013


# HG changeset patch
# User Marco Filippi <iz3gme.marco at gmail.com>
# Date 1380120350 -7200
# Node ID 401141aaaeac79db78a8de0a1293268842873e71
# Parent  6ef322950bd884fa4148386eb94771b14fb641a1
[uv-b5] Add split duplex and calculate shift
Implement feature #1149

diff --git a/chirp/uvb5.py b/chirp/uvb5.py
--- a/chirp/uvb5.py
+++ b/chirp/uvb5.py
@@ -214,7 +214,7 @@
             raise errors.RadioError("Radio NAK'd block at address 0x%04x" % i)
         do_status(radio, "to", i)
 
-DUPLEX = ["", "-", "+", 'off']
+DUPLEX = ["", "-", "+", 'off', "split"]
 CHARSET = "0123456789- ABCDEFGHIJKLMNOPQRSTUVWXYZ/_+*"
 SPECIALS = {
     "VFO1": -2,
@@ -389,8 +389,12 @@
         _mem.freq = mem.freq / 10
 
         if mem.duplex == "off":
-            _mem.duplex = DUPLEX.index("-")
+            _mem.duplex = DUPLEX.index("-") 
             _mem.offset = _mem.freq
+        elif mem.duplex == "split":
+            diff = mem.offset - mem.freq 
+            _mem.duplex = DUPLEX.index("-") if diff < 0 else DUPLEX.index("+")
+            _mem.offset = abs(diff)
         else:
             _mem.offset = mem.offset / 10
             _mem.duplex = DUPLEX.index(mem.duplex)
@@ -413,6 +417,15 @@
         for setting in mem.extra:
             setattr(_mem, setting.get_name(), setting.value)
 
+    def validate_memory(self, mem):
+        msgs = chirp_common.CloneModeRadio.validate_memory(self, mem)
+
+        if mem.duplex == "split" and abs(mem.freq - mem.offset)>70000:
+            msgs.append(chirp_common.ValidationError(
+                    "Max split is 70MHz"))
+        return msgs
+
+
     def get_settings(self):
         basic = RadioSettingGroup("basic", "Basic Settings")
         group = RadioSettingGroup("top", "All Settings", basic)



More information about the chirp_devel mailing list